#! /bin/sh

#
# Copyright (c) 1997 by Sun Microsystems, Inc.
#
 
if [ -x /bin/mach ]; then
  PROC=`/bin/mach`
elif [ -x /usr/ucb/mach ]; then
  PROC=`/usr/ucb/mach`
elif [ `/bin/uname -r | /bin/cut -d. -f1` = "5" ]; then
  PROC=`/bin/uname -p`
else
  PROC=unknown
fi
TOP=`/bin/dirname $0`
if [ "$TOP" = "." ]; then
        TOP=`pwd`
fi
TOP=`/bin/dirname $TOP`
REL=`/bin/uname -r`
SE="$TOP"/bin/se.$PROC.$REL
if [ -z "$SEPATH" ]; then
  SEPATH="$TOP"/examples:.
else
  SEPATH="$SEPATH":"$TOP"/examples:.
fi
if [ -z "$SEINCLUDE" ]; then
  SEINCLUDE="$TOP"/include
else
  SEINCLUDE="$SEINCLUDE":"$TOP"/include
fi

# ifspeed hack
if [ `netstat -k | grep -c ifspeed` -gt 0 ]; then
  DEFS="-DHME_PATCH_IFSPEED"
fi

# QFE hack - this ends up as the number of interfaces plus 2
IF_COUNT="-DMAX_IF=`netstat -i | wc -l | tr -d ' '`"

export SEPATH SEINCLUDE
if [ -x $SE ]; then
  exec $SE $DEFS $IF_COUNT $@
  exit $?
else
  echo "$0": Unsupported platform: $PROC SunOS $REL
  exit 1
fi
exit 0
