#!/bin/sh # # Submit a file. # # File: hpcm_submit # Author: Bob Walton # Date: Tue Oct 4 11:04:49 EDT 2005 # # The authors have placed this program in the public # domain; they make no warranty and accept no liability # for this program. # # RCS Info (may not be true date or author): # # $Author: hc3 $ # $Date: 2005/10/04 15:51:45 $ # $RCSfile: hpcm_submit,v $ # $Revision: 1.8 $ extensions=".c .cc .java .lsp" files="" qualifier="" case "$1" in "" | -doc*) echo " hpcm_submit [-qualifier] problem[.extension] [file ...] Submits the files for the problem. If no files are given, the problem name with exten- sion is taken to be the name of a single file. If in this case there is no extension, one of the fol- lowing extensions is selected $extensions so that the file problem.extension is readable. It is an error if no suitable extensions are found or more than one is found. Legal qualifiers are- in Return judge's input for first case where problem had Incorrect Output or a Formatting Error. inout Ditto but return both judge's input and output. first Ditto but return only summary of first error. summary Ditto but return summary of first several errors. solution On Completely Correct submission, return judge's solution. Qualifiers are often not legal for particular contests." exit 1 ;; -*) qualifier=" "`expr "$1" : '-\(.*\)$'` shift ;; esac problem="$1" if test $# -gt 1 then shift files="$@" else case "$problem" in *.* ) files="$problem" ;; *) found=no for e in $extensions do if test -r "$problem$e" then if test $found = yes then echo too many \ "$problem.*" files found exit 1 fi files="$problem$e" found=yes fi done if test $found = no then echo "no suitable $problem.* file found" exit 1 fi problem=$files ;; esac fi # Submit program files by email. # ( echo Subject: submit $problem$qualifier; \ for file in $files; \ do \ echo ""; \ echo HPCM_BEGIN "$file"; \ sed -e '/^/s//../' < "$file"; \ echo HPCM_END "$file"; \ done ) \ | hpcm_sendmail