#! /bin/csh -f # Last edited on 2001-06-10 14:35:43 by stolfi set usage = "$0 TITLE" # Creates an index page "index.html" for the MP004 homework hand-in images. # Reads files # ras.txt : RA numbers of all registered students # aus.txt : RA numbers of absentees if ( $#argv != 1 ) then echo "usage: ${usage}"; exit 1 endif set title = "$1"; shift; set tooldir = "${STOLFIHOME}/public_html/mp004-2001-1-A/progs/tools" set path = ( . ${tooldir} ${STOLFIHOME}/pkg/netpbm-1mar1994-1/PUB/${PLATFORM}/bin/ $path ) set rafile = "ras.txt" set abfile = "aus.txt" set ofile = "index.html" if ( -r ${abfile} ) then process-ausentes `cat ${abfile} | egrep -v '^ *([#]|$)'` endif # Process all students set ras = ( `cat ${rafile} | egrep -v '^ *([#]|$)'` ) if ( -e ${ofile} ) then /bin/mv ${ofile} ${ofile}~ endif cat <> ${ofile} ${title}

${title}

EOF @ n = 0 foreach ra ( ${ras} ) # Ckeck if the POV-ray source exists: if ( ! ( -r ${ra}/main.pov ) ) then set source = "[×]" else set source = '[fonte]' # Build image if necessary: if ( ( ! ( -r ${ra}/main.gif ) ) || ( -z ${ra}/main.gif ) ) then echo "=== creating image ${ra}/main.gif ===" ( cd ${ra} && make main.gif ) endif endif if ( -r ${ra}/main.gif ) then # Remove bogus or outdated thumbnail if ( -r ${ra}/icon.gif ) then if ( ( -z ${ra}/icon.gif ) || { /usr/bin/test ${ra}/main.gif -nt ${ra}/icon.gif } ) then /bin/rm -f ${ra}/icon.gif endif endif # Make sure the thumbnail does exist: if ( ! ( -r ${ra}/icon.gif ) ) then echo "=== creating thumbnail image for ${ra}/main.gif ===" ( cd ${ra} && make icon.gif ) endif # Use image itself: set imgname = "${ra}/main.gif" set iconame = "${ra}/icon.gif" else # Remove thumbnail, if any if ( -r ${ra}/icon.gif ) /bin/rm -f ${ra}/icon.gif set imgname = "missing.gif" set iconame = "missing-s.gif" endif # Output the entry if ( ${n} == 0 ) then echo " " >> ${ofile} endif cat <> ${ofile} EOF @ n = ${n} + 1 if ( ${n} >= 4 ) then echo " " >> ${ofile} @ n = 0 endif end if ( ${n} > 0 ) then echo " " >> ${ofile} endif cat <> ${ofile}
${ra}  
${source}  
EOF