#!/bin/csh -f # Electronic submission script. # # Copyright (c) 1997 The Board of Trustees of The Leland Stanford Junior # University. All rights reserved. # # Permission to use, copy, modify and distribute this software for any # purpose is hereby granted without fee, provided that the above # copyright notice and this permission notice appear in all copies of # this software and that you do not sell the software. Commercial # licensing is available by contacting the author. # # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. # # Author: # Apostolos Lerios # Computer Science Department # Stanford University # U.S.A. # http://graphics.stanford.edu/~tolis/ # ERROR CHECKING. if ($HOSTTYPE != "sun4") then echo "" echo You must log on an elaine to execute the submission script. echo "" exit endif # DEFINE CONFIGURATION. # User identification. set UserLogin = `whoami` set UserID = `finger $UserLogin@leland | grep Login` # Timestamp. set Timestamp = `date` # Files we require. set SrcFiles = "*.c *.C *.cc *.c++ *.h" set MakeFiles = "[Mm]akefile" set ExecFiles = "assignment" set DocTxtFiles = "README" set DocHTMLFiles = "index.html" # Work directory. set AssgnDir = `pwd` # Mail message destination. set MailDest = "cs248sub@leland" # Archive name. set Archive = "dsShd8dSD7" # INSTRUCTIONS. # Print instructions. clear set MissingFile = 0 ls $SrcFiles >& /dev/null if ($status) then cat << END ************************** WARNING ************************** "submit" believes that the current directory, namely $AssgnDir is not your work directory, since it does not contain any source code, i.e. files matching the pattern $SrcFiles However, since artificial intelligence is a myth, you may override this warning and proceed with the submission. ************************** WARNING ************************** END set MissingFile = 1 else ls $MakeFiles >& /dev/null if ($status) then cat << END ************************** WARNING ************************** "submit" believes that the current directory, namely $AssgnDir is not your work directory, since it does not contain a makefile, i.e. a file matching the pattern $MakeFiles However, since artificial intelligence is a myth, you may override this warning and proceed with the submission. ************************** WARNING ************************** END set MissingFile = 1 else ls $ExecFiles >& /dev/null if ($status) then cat << END ************************** WARNING ************************** "submit" believes that the current directory, namely $AssgnDir is not your work directory, since it does not contain an executable, i.e. a file matching the pattern $ExecFiles However, since artificial intelligence is a myth, you may override this warning and proceed with the submission. ************************** WARNING ************************** END set MissingFile = 1 else ls $DocTxtFiles >& /dev/null set TxtNotExists = $status ls $DocHTMLFiles >& /dev/null if ($status && $TxtNotExists) then cat << END ************************** WARNING ************************** "submit" believes that the current directory, namely $AssgnDir is not your work directory, since it does not contain any documentation, i.e. file matching the patterns $DocTxtFiles $DocHTMLFiles However, since artificial intelligence is a myth, you may override this warning and proceed with the submission. ************************** WARNING ************************** END set MissingFile = 1 endif endif endif endif if (! $MissingFile) then cat << END Before submitting your work make sure that the current directory, namely $AssgnDir is your work directory. The artificially intelligent "submit" believes that it is, indeed. END endif # Verify submission condition is satisfied. echo -n "Is the current directory your work directory (y/n)? " set Ans = $< if ($Ans != 'y') then echo "" echo Please \"cd\" to your work directory, and echo then try executing the \"submit\" program again. echo "" exit endif # MAIL WORK DIRECTORY. echo "" echo Please wait... cd .. set Archive = "$Archive.tar.gz" tar cf - `basename $AssgnDir` | gzip -f | uuencode $Archive \ | /usr/ucb/mail -s "$UserID" $MailDest # SHOW CONFIRMATION MESSAGE. clear cat << END Unlike other submission programs you may have used, "submit" does not send out an e-mail message notifying you of successful completion of the submission process. "submit" has done its job if it has executed without any errors. "submit" packaged the contents of your work directory and mailed them to our account. No file or directory permissions have been changed. You may now delete your work directory, if you so wish. END # MAIL CONFIRMATION. cat << END | /usr/ucb/mail -s "$UserID" $MailDest $UserID $Timestamp $AssgnDir END