status.sh (775B)
1 #!/bin/sh 2 printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' 3 4 sub=${PATH_INFO##*/} 5 rest=${PATH_INFO%/*} 6 user=${rest##*/} 7 8 dir=/var/lib/ojudge/submissions/$user/$sub 9 10 [ -d "$dir" ] || { echo "<p>No such submission</p>"; exit 0; } 11 12 show() { 13 echo "<h2>$1</h2><pre>" 14 sed 's/&/\&/g; s/</\</g' "$2" 15 echo "</pre>" 16 } 17 18 if [ -e "/var/lib/ojudge/pending-review/$user/$sub" ]; then 19 echo '<meta http-equiv="refresh" content="3">' 20 echo "<h1>Submission $sub: pending</h1>" 21 elif [ -e "$dir/results/results.txt" ]; then 22 echo "<h1>Submission $sub: judged</h1>" 23 show Results "$dir/results/results.txt" 24 [ -s "$dir/results/output.txt" ] && show Output "$dir/results/output.txt" 25 else 26 echo "<h1>Submission $sub: no results (judging failed?)</h1>" 27 fi