#!/bin/sh -f

# Special settings to run MuPAD without any local modifications

MuPAD_ROOT_PATH=`dirname $0`/../..
export MuPAD_ROOT_PATH

#
#    shell skrict 'mprintps'
#
#    This script is used for printing mupad graphics
#    stored in PostScript format. The arguments are:
#
#    $1 - the name of the printer
#    $2 - the name of the file, which is to be printed
#         (/tmp/help_picture.ps).
#
#    This shell skript has to distinguish the different
#    print commands, like for instance 'lpr' under Sunos
#    or 'lp' under Solaris.
#
#    In order to check under which arcitecture the current
#    job is running, the shell script 'sysinfo' is used.

ARCH="`$MuPAD_ROOT_PATH/share/bin/sysinfo`"

case $ARCH in

     decalpha)  pstring="lp -c -d$1 $2" ;;
     i86pc)     pstring="lpr -P$1 $2" ;;
     sun3)      pstring="lpr -P$1 $2" ;;
     sun4)      pstring="lpr -P$1 $2" ;;
     solaris)   pstring="lp -c -d$1 $2" ;;
     sgi4)      pstring="lp -P$1 $2" ;;
     sgi5)      pstring="lp -c -d$1 $2" ;;
     ibmrs6000) pstring="lpr -P$1 $2" ;;
     i386)      pstring="lpr -P$1 $2" ;;
     linux)     pstring="lpr -P$1 $2" ;;
     pmax)      pstring="lp -c -d$1 $2" ;;
     uvax)      pstring="lp -c -d$1 $2" ;;
     hp)        pstring="lp -c -d$1 $2" ;;
     netbsd)    pstring="lpr -P$1 $2" ;;
     freebsd)   pstring="lpr -P$1 $2" ;;

esac

#
#    Use pstring and print the file
#

$pstring

#
#    Remove the PostScript-File
#
rm -f $2

exit
