#! /bin/sh
#
# browser-call script for the IPSEN/PROGRES-System.
#
# $Id$
#
 
#
# This file sets appropriate environment variables, creates an independant
# TMPGRAS directory, and starts the browser.
#
# Calling Scheme:
#   EdgeCallExecutable <Executable> <GraphName> <NodeNumber> <StyleFile>
#
 
#
# Create an independant TMPGRAS directory, so we don't get conflicts
# with the one used by the PROGRES-System
#
# Remark: Is this still necessary when using RGRAS?
#
TMPGRAS="`date +/usr/tmp/EDGE$USER%H%M%S`"
export TMPGRAS
mkdir $TMPGRAS
chmod go+rwx $TMPGRAS

#
# Setting of the GRAS environment variables:
#
GRASALLOC=500
export GRASALLOC

#
# Change the DISPLAY variable to refer to screennumber 0. This is necessary
# due to a bug in the edge system. The edge Systen does not display edges
# when started on another screen.
#
# Remark: The displaynumber is set to 0 too. I don't know if this is
#         necessary.
#
DISPLAY=`echo $DISPLAY | awk -F: '{print $1}' - `:0.0
export DISPLAY

# Determine which operating system version the host has
osver=`uname -r`
case $osver in
5.*)    # Solaris 2.x
        PLATFORM=sol2
        OSACCESSDIR=SOL2;;
4.1.*)  # SunOS 4.1.x
        PLATFORM=sunos4
        OSACCESSDIR=SUNOS4;;
*)      echo 'unknown os version' ;;
esac
unset osver
export PLATFORM OSACCESSDIR


#
# extend LD_LIBRARY_PATH:
#
unset LD_LIBRARY_PATH
#LD_LIBRARY_PATH="$GRASBROWSERLIBPATH/lib/${OSACCESSDIR}:$LD_LIBRARY_PATH"
#export LD_LIBRARY_PATH

#
# Call the browser with instancename, GraphName, NodeNumber, StyleFile and
# geometry.
#
#echo "calling: $GRASBROWSERLOADPATH/bin/${OSACCESSDIR}/$1 \
#     -graph $2 -node $3 -stylefile $4 -geometry 1022x474+126+396 \
#     -pool $PROJECT $5 $6"

$GRASBROWSERLOADPATH/bin/${OSACCESSDIR}/$1 \
     -graph $2 -node $3 -stylefile $4 -geometry 1022x474+126+396 \
     -pool $PROJECT $5 $6

#
# Kill the specially created TMPGRAS directory, since we do not change
# the graph, we have no further use for it.
#
rm -rf $TMPGRAS

#
# EOF
#
