#! /bin/csh -f # Last edited on 2001-05-14 01:00:35 by stolfi set usage = "$0 RA TITLE" # Creates an index page "RA/index.html" for the MP004 project hand-in # images of the students with given students RA. Also rebuilds the # student's images if necessary. Assumes the images and other files # are in subdirectories RA/MM-DD-ini and RA/MM-DD-fin for each of the # dates in `dates.txt'. Gets the project name from `projects.txt'. if ( $#argv != 2 ) then echo "usage: ${usage}"; exit 1 endif set ra = "$1"; shift; set title = "$1"; shift; set path = ( . ${STOLFIHOME}/pkg/netpbm-1mar1994-1/PUB/${PLATFORM}/bin/ $path ) # Check for validity of RA if ( ! ( -d ${ra} ) ) then echo "directory ${ra} does not exist"; exit 1 endif # Filename of output page: set ofile = "${ra}/index.html" if ( -e ${ofile} ) then /bin/mv ${ofile} ${ofile}~ endif # Get the student's project name set subtitle = `grep ${ra} project-names.txt | head -1` # Get lab class dates: set days = ( `cat dates.txt` ) cat <> ${ofile} ${title}

${title}

${subtitle}

EOF echo " " >> ${ofile} foreach day ( $days ) echo " " >> ${ofile} end echo " " >> ${ofile} set lastdir = "${days[1]}-fin" foreach phase ( ini fin ) echo " " >> ${ofile} foreach day ( $days ) set subdir = ${day}-${phase} set dir = ${ra}/${subdir} # Ckeck if the POV-ray source exists: if ( ! ( -r ${dir}/main.pov ) ) then set source = "[×××]" else set source = '[pov]' # Remember last version that was turned in if ( "${phase}" == "fin" ) set lastdir = "${subdir}" # Build image if necessary: if ( ! { cmp -s ${dir}/main.gif absent.gif } ) then echo "=== remaking ${dir}/main.gif ==" ( cd ${dir} && make main.gif |& tee make-main.log ) endif endif if ( -r ${dir}/main.gif ) then # Remove bogus or outdated thumbnail if ( -r ${dir}/icon.gif ) then if ( ( -z ${dir}/icon.gif ) || { /usr/bin/test ${dir}/main.gif -nt ${dir}/icon.gif } ) then /bin/rm -f ${dir}/icon.gif endif endif # Make sure the thumbnail does exist: if ( ! ( -r ${dir}/icon.gif ) ) then # Make sure the thumbnail does exist: echo "=== remaking ${dir}/icon.gif ===" ( cd ${dir} && make icon.gif |& tee make-icon.log ) endif # Use the image itself: set imgname = "${subdir}/main.gif" set iconame = "${subdir}/icon.gif" else # Remove thumbnail, if any if ( -r ${dir}/icon.gif ) /bin/rm -f ${dir}/icon.gif # Use dummy image: set imgname = "../missing.gif" set iconame = "../missing-s.gif" endif # Make pointer to movie, if it exists: if ( -r ${dir}/movie.gif ) then set movie = '[filme]' else set movie = '' endif # Output the entry cat <> ${ofile} EOF end echo " " >> ${ofile} end rm -f ${ra}/final ( cd ${ra} && ln -s ${lastdir} final ) cat <> ${ofile}
${day} 
${movie}  
${source}  
EOF