#
# (c) 2004 BRUNIE-Software GmbH


if [ $USER != "brunie" ] ; then
	echo "   Nur unter Benutzer 'brunie' zugelassen!"
	exit
fi

curdir=`pwd`
uci=$1

if [ -n "$uci" ] ; then
	if [ ! -f "/brunie/$uci.dat" ] ; then
		echo ""
		echo "  Der UCI $uci existiert nicht!"
		echo ""
		uci=""
	fi
fi

if [ -z "$uci" ] ; then
	cd /brunie
	ucilist=""
	for uci in `ls *.dat`; do
		pos=`expr index $uci .`
		pos=`expr $pos - 1`
		uci=`expr substr $uci 1 $pos`
		if [ -n "$ucilist" ] ; then
			ucilist="$ucilist, "
		fi
		ucilist="$ucilist$uci"
	done

	echo ""
	echo "  Aufruf: gtm <UCI>"
	echo ""
	echo "    Vorhandene UCIs = $ucilist"
	echo ""
	cd $curdir
	exit
fi

echo ""
echo "BRUNIE/GT.M for Linux, UCI: $uci"

#int1='zshow "*":^|"/brunie/SYS.gld"|%JOBEXAM("ZSHOW",$J)'
#int2='kill ^|"/brunie/SYS.gld"|%JOBEXAM("JOB",$J)'
#gtm_zinterrupt="$int1 $int2"
#export gtm_zinterrupt
gtm_dist="/usr/gtm"
export gtm_dist
gtmroutines="$uci $gtm_dist"
export gtmroutines
gtmgbldir="$uci"
export gtmgbldir
gtm_ztrap_form="popadaptive"
export gtm_ztrap_form
gtm_ztrap_new="TRUE"
export gtm_ztrap_new
PATH="$PATH:$gtm_dist"
export PATH
cd /brunie
$gtm_dist/mumps -di
cd $curdir
