#!/bin/sh
#
#  MathReader 4.2 command file for Linux-PPC
#
#  Copyright 1988-2002 Wolfram Research, Inc.
#

topdir=/tmp/B.b49f17/MathReader4-4.2.1-root-builder/usr/lib/MathReader

XUSERFILESEARCHPATH=$topdir/SystemFiles/FrontEnd/SystemResources/X/%N
export XUSERFILESEARCHPATH

LD_LIBRARY_PATH=$topdir/SystemFiles/Libraries/$sysid:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

userDisplay=`echo "$@" | sed 's/.*-display \{1,\}.*:[^ ]\{1,\}.*/setting user display/'` 
if [ "$userDisplay" = "setting user display" ]; then
  userDisplay=`echo "$@" | sed 's/.*\(-display[ ]*[^ ]*\).*/\1/'`
else
  userDisplay=""
fi

# append wri fonts to the font path if they are not already present

havefonts=`xlsfonts -fn '-wri-Mathematica*-*-*-*-*-*-*-*-*-*-*-*-*' 2>&1 $userDisplay | grep -c "wri"`
font=$topdir/SystemFiles/Fonts/Type1
[ $havefonts -lt 2 ] && xset fp+ $font $userDisplay
font=$topdir/SystemFiles/Fonts/BDF
[ $havefonts -lt 2 ] && xset fp+ $font $userDisplay
xset fp rehash $userDisplay

bindir=$topdir/SystemFiles/FrontEnd/Binaries/Linux-PPC
if [ ! -f $bindir/MathReader ] ; then
   echo
   echo "-----------------------------------------------------------------------------"
   echo "MathReader executable"
   echo "$bindir/MathReader"
   echo "not found.  Your MathReader installation may be incomplete or corrupted."
   echo "-----------------------------------------------------------------------------"
   echo
   exit
fi
exec $bindir/MathReader -topDirectory $topdir "$@"

