#!/bin/sh
#
# SET SITE-SPECIFIC VARIABLES HERE!
#

REFDIR=.

#
# The PRINTER variable needs to be set to the printer you wish to print to.
# For best results, it should be a POSTSCRIPT printer.
#

PRINTER=-Plw

#
# Check these.  IF YOU DO NOT HAVE GRN, YOU WILL NEED TO GET IT IN ORDER TO
# PRINT THIS DOCUMENT.
#

MACROS="-me"
SOELIM=soelim
TBL="dtbl"

#
# IF you have the GRN preprocessor for TROFF (which converts Gremlin output into
# TROFF line-drawing commands) you can print the reference manual as is.  If
# not, you will have to un-comment out the second definition for GRN.  You will
# be able to print the documentation, but without any illustrations.
#

GRN="grn $PRINTER"

# GRN="$REFDIR/eatgrn"

PSROFF="psroff $PRINTER $MACROS "
DITROFF="ditroff $FLAGS $MACROS "
TROFF="troff $PRINTER $MACROS "

cd $REFDIR

# ----------------
# 	collect sources
# ----------------
SOURCES='pgtmacs '
x=1
numargs=$#
while test $x -le $numargs ; do
   SOURCES="$SOURCES $1"
   x=`expr $x + 1`
   shift
done

# ----------------
# 	generate tmp file from sources
# ----------------
touch /tmp/soe.$$
for i in $SOURCES
do
	if (test ! -f $i)
	then
		co $i
	fi
	echo ".so $i" >> /tmp/soe.$$
done

# ----------------
# 	generate output and remove temp file
# ----------------
$SOELIM /tmp/soe.$$ | $TBL | $GRN | $PSROFF -t > quickref.t
rm -f /tmp/soe.$$
