#!/bin/sh
export LD_LIBRARY_PATH=./
NF=ta3d
tgfile=`ls -l $0 | awk '{print $NF}'`
exe=`dirname $tgfile`

if [ $exe = "." ]
then
	exe=`pwd`
fi

yes=`echo $exe | head -c 2 | grep -c "/"`

if [ "$yes" = "0" ]
then
	exe=`pwd`/${exe}
fi

cd ${exe}
restart=2
quickrestart=""
while [ $restart = 2 ] || [ $restart = 3 ]
do
${exe}/ta3d-bin $quickrestart $1 $2 $3 $4 $5 $6 $7 $8 $9 $10
restart=$?
if [ $restart = 3 ]
then
	quickrestart="--quick-restart --restore"
else
	quickrestart="--quick-restart"
fi
done
