#!/bin/sh
#
# Mathematica 4.0 command file
#
# Copyright 1988 - 1999  Wolfram Research, Inc.
#

spath=`expr $0'/' : '\(/\)[^/]*//*$' \| $0'/' : \
            '\(.*[^/]\)//*[^/][^/]*//*$' \| .`

if [ "." = $spath ]; then
   FEPATH=`pwd`
else
   if [ .`(echo $spath | grep "^/")` = .$spath ]; then
      FEPATH=$spath
   else
      FEPATH="`pwd`/$spath"
   fi
fi

sysid=`basename $FEPATH`

topdir=`\cd $FEPATH/../../Files; pwd`
bindir=$topdir/SystemFiles/FrontEnd/Binaries/$sysid

PATH=$topdir/../Executables/$sysid:$PATH
export PATH

PSRESOURCEPATH=$PSRESOURCEPATH:$topdir/SystemFiles/Graphics/SystemResources
export PSRESOURCEPATH

XFILESEARCHPATH=$topdir/SystemFiles/FrontEnd/SystemResources/X/%N:$topdir/SystemFiles/FrontEnd/SystemResources/X/%T/%N%S
export XFILESEARCHPATH

font=$topdir/SystemFiles/Fonts/Type1

echo `xset q` | grep $font > /dev/null 2>&1

[ $? -ne 0 ] && xset fp+ $font

font=$topdir/SystemFiles/Fonts/X

echo `xset q` | grep $font > /dev/null 2>&1

[ $? -ne 0 ] && xset fp+ $font

xset fp rehash


if [ ! -x "$bindir/Mathematica" ] ; then
   echo "Mathematica front end executable"
   echo "$bindir/Mathematica"
   echo "not found.  Your installation may be incomplete or corrupted."
   echo "Note that you must call this script directly, and not"
   echo "through a symbolic link."
   exit
fi

exec $bindir/Mathematica -topDirectory $topdir "$@"
 
