#!/bin/sh -f

# Special settings to run MuPAD without any local modifications

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

# Path for XView libraries distributed with MuPAD

XVP=${MuPAD_ROOT_PATH}/${SYSINFO}/xview

if test -n "$LD_LIBRARY_PATH" ; then
  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${XVP}:/usr/local/X11/lib:/usr/openwin/lib
else
  LD_LIBRARY_PATH=${XVP}:/usr/local/X11/lib:/usr/openwin/lib
fi
export LD_LIBRARY_PATH

if [ "$SYSINFO" = "hp" ] ; then  
  if test -n "$SHLIB_PATH" ; then
    SHLIB_PATH=${XVP}:$SHLIB_PATH
  else
    SHLIB_PATH=${XVP}
  fi
  export SHLIB_PATH
fi

if test -n "$FONT_PATH" ; then  
  FONT_PATH=$MuPAD_ROOT_PATH/share/doc/hytex/fonts:$FONT_PATH
else
  FONT_PATH=$MuPAD_ROOT_PATH/share/doc/hytex/fonts
fi
export FONT_PATH

# This Bourne or Korn Shell script runs MuPAD's online-manual 
# as a standalone tool in the background.

MuPAD_BIN=$MuPAD_ROOT_PATH/`$MuPAD_ROOT_PATH/share/bin/sysinfo`/bin

HYTEX_PATH=$MuPAD_ROOT_PATH/share/doc/hytex
export HYTEX_PATH

if [ $# -gt 1 ] ; then
   echo "usage: manual [document]"
   exit 1
fi
if [ $# -eq 1 ] ; then
   $MuPAD_BIN/hypage $1 & 
else
   $MuPAD_BIN/hypage $MuPAD_ROOT_PATH/share/doc/hytex/man_eng 1> /dev/null 2> /dev/null &
fi
