#! /bin/ksh

PRG=`whence $0` >/dev/null 2>&1

# If PRG is a symlink, trace it to the real home directory
while [ -L "$PRG" ]
do
    newprg=`expr "\`/bin/ls -l "$PRG"\`" : ".*$PRG -> \(.*\)"`
    expr "$newprg" : '^/' >/dev/null || newprg="`dirname $PRG`/$newprg"
    PRG="$newprg"
done

WEBCANAL_HOME=`dirname $PRG`/../..

if [ ! -f $WEBCANAL_HOME/lib/webcanal.jar ] ; then
  echo "could not find $WEBCANAL_HOME/lib/webcanal.jar";
  exit 1
fi

# If JRE is included in the package, use it
if [ -f $WEBCANAL_HOME/jre/bin/jre ] ; then
  JRE=$WEBCANAL_HOME/jre/bin/jre
else
  JRE=jre
fi

unset CLASSPATH
exec $JRE -cp $WEBCANAL_HOME/lib/webcanal.jar inria.tools.rtp.RTPDump $*
