[mod.recipes] software contribution--print new pages

thomas@utah-gr (Spencer W. Thomas) (02/24/86)

I put together this little script to be able to easily print out "new"
recipes together with an updated index.  Obviously one doesn't want to
run off the entire cookbook each time a few new recipes come in, but one
would like to keep the index up to date.  The scheme for deciding on
"new" certainly has some holes in it, but it's better than nothing, I
think.  For what it's worth, here it is.

=Spencer
#! /bin/sh
# rcnew.t - make new cookbook pages for the typesetter
#
# Spencer Thomas, January 1986
# after rcbook.t by Brian Reid, November 1985
#
TROFF="DEFTROFF"
PATH=DEFPATH
export PATH
TMAC=/tmp/tmac.$$
INDEX=/tmp/Index.$$
trap "rm -f $TMAC $INDEX" 0 1 2 3 15
TFLAG=
KEEPDIR=DEFDIR
while [ $# -gt 0 ];
do
    case $1 in
	    -t) TFLAG="$1";;
	    -*) echo $0: Unknown option $1 1>&2 ; exit;;
	    "") KEEPDIR=DEFDIR;;
	    *) KEEPDIR=$1;;
    esac
    shift
done
if [ ! -d $KEEPDIR ]; then
	echo Your keep directory $KEEPDIR does not seem to exist. 1>&2
	exit 1
fi;
# if Index.keep exists, then a previous rcnew bombed.  Use the old one.
if [ ! -e Index.keep ]; then
	mv INDEX Index.keep
fi;
echo Typesetting cookbook from files newer than \
    `ls -l $KEEPDIR/Index.keep | awk '/./ {printf("%s %s %s", $5, $6, $7);}'`\
	 in $KEEPDIR 1>&2
cd $KEEPDIR
rcindex -t $KEEPDIR
cat > $TMAC << 'tmac.recip'
TMAC.RECIP
tmac.recip
set `date`
TODAY="$3 $2 $6"
sed -e "s/DATE/$TODAY/" > $INDEX << 'Index'
.RH MOD.RECIPES-SOURCE INDEX Recipes DATE 
.ll 6.5i
.nf
.br
.de XX
.tr ~ 
.ta 2.4iR 2.6i 5.3i
	\\$1~~~~~\\$2	\\$3 \\$4	\\$5
..
.so INDEX
Index
rcintro > Introduction
$TROFF $TFLAG $TMAC Introduction $INDEX \
	`find . -name '[a-z]*' -newer Index.keep -print | grep '^./[^/]*$'`
rm Index.keep