home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume17
/
contest-prog
/
part03
/
gr
< prev
next >
Wrap
Text File
|
1989-02-06
|
4KB
|
203 lines
#! /bin/sh
cd $HOME
if test -f lock
then
echo another judge has me busy, try again momentarily
exit
fi
failure=""
touch lock
cat $MAIL >>mal
cp /dev/null $MAIL
fn=`grep Judge: mal |head -1`
case $fn in
"")rm lock;exit;;
esac
fun=` echo $fn | sed 's/Judge/judge/' `
echo $fn
echo $fun
sed "s=$fn=$fun=" mal >/tmp/pqr$$
cp /tmp/pqr$$ mal
rm -f /tmp/pqr$$
echo fn = $fn
fl=`echo $fn|cut -f2 -d' '`
echo fl = $fl
seconds=`echo $fn|cut -f3 -d' '`
echo seconds = $seconds
endtime=`cat endtime`
echo endtime = $endtime
da=`echo $fn|cut -f2 -d';'`
echo da = $da
case $fl in
"")rm -f lock;exit;;
esac
t=`echo $fl|cut -f3 -d'/'`
echo t = $t
case $t in
team0) t=judges;;
esac
echo t = $t
p=`echo $fl|cut -f4 -d'/'`
echo $seconds $endtime
if expr $seconds '>' $endtime
then
echo too late
echo $fn >/tmp/dumb$$
echo "submitted too late">>/tmp/dumb$$
mail $t < /tmp/dumb$$
rm /tmp/dumb$$
rm lock
exit
else
echo not too late
fi
src=`shorten $t.$p`
echo src=$src
echo p = $p
if test -f $src.right
then
echo They seem to have already completed that problem...
echo Do you want to proceed?
read zork
case $zork in
y) ;;
*) rm -f lock;exit;;
esac
fi
s=$fl
echo s = $s
ext=`basename $s`
echo ext = $ext
case $ext in
*.p)c=pc;dot=p;;
*.pas)c=pascal;dot=p;;
*.c)c=cc;dot=c;;
*.f)c=fortran;dot=f;;
*) echo invalid extension;rm -f lock;exit;;
esac
if test -f $s
then
echo cp $s $src.$$.$dot
cp $s $src.$$.$dot
else
echo $s not found
echo $s >/tmp/dumb$$
echo "was not found in your directory">>/tmp/dumb$$
mail $t </tmp/dumb$$
rm -f lock
echo bye
rm -f /tmp/dumb$$
exit
fi
#q=`echo $p|cut -f2 -db`
#q=`echo $q|cut -f1 -d.`
q=`digits $p`
qq=`digits $t`
case $q in
-)q=99;;
esac
case $qq in
-)qq=99;;
esac
echo $qq $q
echo $src.$$.$dot
echo the compiler is $c
if $c -o subdir/${src}.$$.e $src.$$.$dot
then
echo compiled ok ... about to run it
else
echo compilation failed
failure=1
fi
case $failure in
"")
echo about to run $src.$$.e
cp prob$q.in subdir/prob$q.in$$
echo cp prob$q.in subdir/prob$q.in$$
#cd subdir
if test -f prob$q.in
then
echo "chexec8 <subdir/prob$q.in$$ >out subdir/$src.$$.e"
rm -f out
chexec8 <subdir/prob$q.in$$ >out subdir/$src.$$.e
chmod og-rwx out
else
echo prob$q.in$$ not found in gr ... you dummy!
exit
fi
#cd ..
echo through running
diff out prob$q.ans
rm -f subdir/*
if compare out prob$q.ans
then
echo "1" $qq $q $seconds>>scoreboard
echo yes their output is correct
mv out keep/$src.$$.m
rm lock
echo \
"CONGRATS! $t successfully did prob$q at `date`">\
$src.right
mail $t < $src.right
echo "submitted: $seconds">$src.at
echo "$t completed problem $q at `date`">$src.msg
list=""
for i in `cat listofteams` ;
do
case $i in
$t) ;;
*) list="$list $i"
;;
esac
done
mail $list < $src.msg
exit
else
echo "0" $qq $q $seconds >>scoreboard
echo not correct
mv out keep/$src.$$.m
rm lock
echo "do you wish to mail them an explanatory note? "
read zork
case $zork in
y)
echo "mail $t"
mail -s "$p" $t
;;
*) echo "your $p not correct">failure$$
mail -s "$p" $t<failure$$
rm -f failure$$
;;
esac
fi
;;
1)
echo "0" $qq $q $seconds >>scoreboard
echo not correct
mv out keep/$src.$$.m
rm lock
echo "do you wish to mail them an explanatory note? "
read zork
case $zork in
y)
echo "mail $t"
mail -s "$p" $t
;;
*) echo "your $p not correct">failure$$
mail -s "$p" $t<failure$$
rm -f failure$$
;;
esac
esac