#!/bin/csh -f
#
# Sole argument is a port number, if desired,
# if none is given defaults to 4201.
#
# if you want to be restarting this from outside this directory,
# set this to the game directory, like .../mage/game
set GAMEDIR = `pwd`
set muck = `/bin/ps aux | /bin/grep netmage | /usr/ucb/wc -l`
if ($muck > 1) exit 0
cd $GAMEDIR
if (-r data/in.new.PANIC) then
set end = "`tail -1 data/in.new.PANIC`"
if ("$end" == "***END OF DUMP***" ) then
mv data/in.new.PANIC data/in.new
else
rm data/in.new.PANIC
echo "Warning: PANIC dump failed on "`date` | mail "`whoami`@`hostname`"
endif
endif
mv -f data/in data/in.old
if (-r data/in.new) then
mv data/in.new data/in
else
cp data/in.old data/in
endif
./netmage data/in data/in.new $1 > /dev/null &