#!/bin/csh -f

# Usage: oldpdf fileroot ...

# Fileroot is the given file name or the part preceding ".tex".  So
# you get the same behavior from "oldpdf foo" or "oldpdf foo.tex".

# This command creates fileroot.pdf from fileroot.tex by using the
# initial 8 characters of the filename as a date to substitute for 
# \today usages in the .tex file.  Also modifies date of the .pdf
# file to match that of the .tex file or the date from the filename?


# TO BE CODED.  BELOW IS JUNK FROM ANOTHER COMMAND.



umask 66

set inputbase = `echo $1 | sed 's+\.e$++' | sed 's+\.tex$++'`

shift
set key = "$*"

if ("$key" == "") then
  echo "Enter key:"
  set key = "$<"
endif

del . ${inputbase}soln.tex.e

crypt "$key" <$inputbase.tex.e \
  | sed 's+\\solutionsfalse+\\solutionstrue+\
         s+\\ifsolutions\([^a-zA-Z].*\)\\else[^a-zA-Z].*\\fi+\1+' \
  | crypt "$key"\
  > ${inputbase}soln.tex.e

latc ${inputbase}soln "$key"
