#!/bin/sh
# handle roff file for latex, expects args %f %S
set -e			# die on any error
BASE=`basename $2 .roff`
IN=$2			# input file
TMP=$BASE.tmp		# temporary file
OUT=$BASE.eps		# output file, in this case, also temporary

[ -f "$IN" ] || exit 1	# ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
   echo "$0: $TMP is in the way" 1>&2
   exit 1
fi
 
gtbl "$IN" | groff -Tps > $TMP
ps2epsi "$TMP" "$OUT" 1>&2
rm -f "$TMP" 
echo \\includegraphics{$OUT}