
#! /bin/sh 

#judges mailbox
MAIL=$MAIL

#a public dir where score lives
#(the scoreboard should be local an only readable by judges,
# cause "score should be setuid judges)
LOCAL=/usr/contest

#four hours:
LENGTH=14400

cd $HOME
rm -f /tmp/prob*.txt


rm -f t[0-9]*[0-9]*
rm -f keep/*
rm -f subdir/*

#version:21
echo "21">xxxx
/bin/cp /dev/null listofteams

while :
do
read teamno
case $teamno in
	"") echo null team number;exit;;
	-1)break;
esac
echo team$teamno>>listofteams
read cat
read name


	echo $teamno $cat $name >>xxxx
	echo $teamno $cat $name


done
echo "-1 -1 xx">>xxxx
#change the following line to y for a live start
zork=y
case $zork in
	y)
	for i in 1 2 3 4 5 6 13 14 15 16 17 18
	do
	/bin/cp prob$i.txt /tmp
	done ;;
esac
chmod og+r /tmp/*.txt

/bin/cp scoreboard scoreboard.old
seconds=`${LOCAL}/seconds`
echo $seconds >> xxxx
echo $seconds > starttime
echo endtime = $endtime
endtime=`expr $seconds '+' ${LENGTH}`
echo endtime = $endtime
echo $endtime > endtime
/bin/cp xxxx scoreboard
chmod og-rwx scoreboard


${LOCAL}/score
n mal
n ${MAIL}
