# /bin/csh -f # Last edited on 2003-05-23 11:20:13 by stolfi set usage = "$0 MM-DD" set disc = mc930 # To be executed in a subdirectory "tpXX/casa" or "tpXX/aula" # # Fetches the ".pov", ".inc", and ".gif" files of all students, # from ~[ra]NNNNNN/public_html/${disc}/MM-DD/ to ./NNNNNN, # where NNNNNN is the student's RA number. # Also creates copy of every file, named "*-orig.{pov,inc.gif}", # in preparation of editing and re-rendering by the instructor. # Requires a file "rausrs.txt" with the format RA numbers of all students. if ( $#argv != 1 ) then echo "usage" ${usage}"; exit 1 endif set mmdd = "$1"; shift set bugs = "bugs.txt" if ( -r ${bugs} ) then mv -v ${bugs} ${bugs}~~ endif touch ${bugs} # Make sure that there are links to files peculiar to this homework: foreach f ( \ Makefile \ missing.gif missing-s.gif \ absent.gif absent-s.gif \ rausrs.txt aus.txt title.txt \ ) if ( ! -r ${f} ) ln -s ../${f} end foreach rausr ( `cat rausrs.txt | egrep -v '^ *([#]|$)' | gawk '//{print $1 "." $2;}' ` ) set ra = ${rausr:r} set usr = ${rausr:e} # Create hand-in subdirectory for student set dir = "${ra}" if ( ! ( -d ${dir} ) ) mkdir ${dir} if ( ! ( -r ${dir}/Makefile ) ) then ( cd ${dir} && ln -s ../Makefile ) endif # Fetch student files, if any: set pub = ~${usr}/public_html set expdir = ${pub}/${disc}/${mmdd} echo ${pub} if ( ! ( -d ${pub}/. ) ) then echo "** directory ${pub} not found" echo "${ra} : ${pub} not found" >> ${bugs} else if ( ! ( -d ${expdir} ) ) then echo "** ${expdir} not found **" echo "${ra} : ${expdir} not found" >> ${bugs} else if ( ! ( -r ${expdir}/main.pov ) ) then echo "** ${expdir}/main.pov not found **" echo "${ra} : ${expdir}/main.pov not found" >> ${bugs} else cp -aivu ${expdir}/*.{pov,inc,gif} $dir/ ls -l $dir/*.{pov,inc,gif} foreach f ( `ls $dir/*.{pov,inc,gif} | egrep -v '[-]orig[.]'` ) cp -pi $f ${f:r}-orig.${f:e} end endif end