#!/bin/csh -f

# Arguments are filename root, filename extension, handout number,
# core name of target directory, and output tty for errors/status.
# The arguments may be preceded by "make" options.

set makeopts = ""
while ("$1" =~ -* && "$1" != "-")
  set makeopts = ($makeopts $1)
  shift
end

if ("$1" == "-") shift

set targtrans = ~/.www/$4

make $makeopts web/$1-installedfrom$2.ts > $5

echo -n ' <LI>'`grep 'Handout '$3 $1.tex | sed 's+\\[^ ]*++g' | sed 's+Handout .* Handout+Handout+'`': '
echo $1 | sed 's+hw+homework +\
               s+lab+lab +\
               s+ex+exam +\
               s+code+ code+\
               s+-soln+ solutions+\
               s+soln+ solutions+\
               s+samp+sample +\
               s+fin+final+\
               s+syl+syllabus+\
               s+studinfo+student information to turn in+\
               s+^\(.*\)$+\1.+'
echo '  <\!--#include virtual="/~rig/cgi-bin/avail/~rig/'$4/$1'" -->'
