case $# in
	0)	exec $0 -h;exit 0;;
esac
case $OS in
	XENIX)	DOSCOPY="doscp -r";;
	MSDOS)	DOSCOPY="copy";;
	UNIX)	;;
	MKS)	DOSCOPY="cp";;
	*)		echo "($0) <no OS var in environment>";
			echo "($0) <assuming XENIX>\n";
			DOSCOPY="doscp -r";;
esac
KPR="-L -w180 -c2 -p66"
TMP=pr$$.tmp
DOS=NO
FUX=cat
PRT=YES
PG=hpl
FL=
H='
==========
hpl [-options] [file(s)]
==========
add font instructions for hp laser jet printer.
==========
-pl nn  page length (66)
-tl nn  text length (66)
-tm nn  top margin (0)
-lm nn  left margin (10)
-rm nn  right margin (132)
-li nn  lines/inch (6)
-co nn  copies (1)
-sl     light strokes (default)
-sm     medium strokes
-sb     bold strokes
-rom    roman-8 (default)
-ibm    ibm-pc-usa
-pic    pica (10) (default)
-lpr    line printer (16.66)
-lan    landscape
-por    portrait
-nopr   no print (output file only)
-o name write output to named file
-O name write to named dos file with conversion
-kpr    use kpr (default cat)
-S nn   kpr segment switch
-t      kpr header switch
-T      kpr tab compression
-w nn   width for kpr (default 180)
-c nn   colunns for kpr (default 2)
-p nn   page length in lines for kpr (default 66)
==========
NOTES
==========
*   lines 1 and 66 do not print with the defaults
*   with lpr and li = 8 effective pl is 86 with 1-2, 85-86
    not printing
==========
'
PS='&l2A'
AA='E'
PL='&l66P'
TL='&l66F'
TM='&l0E'
LM='&a10L'
RM='&a132M'
LI='&l6D'
SS='(8U'
OR='&l0O'
CO='&l1X'
OC=$CO
CO=
SW='&(s0B'
PF='(I00'
TF='(s0p12h10v0s0b8T'
FP='&k0S'
LT='&k2G'
ZZ='&l0H'
:
while   :
do
case $1 in
	-h)     clear;echo "$H"|less;exit 0;;
	-o)		shift;PRT=NO;OUT=$1;;
	-O)		shift;DOS=YES;PRT=NO;OUT=$1;;
    -pl)    shift;PL="&l$1P";;
    -tl)    shift;TL="&l$1F";;
    -tm)    shift;TM="&l$1E";;
    -lm)    shift;LM="&a$1L";;
    -rm)    shift;RM="&a$1M";;
    -li)    shift;LI="&l$1D";;
	-hi)	shift;HI="&k$1H";;
    -co)    shift;CO="&l$1X";;
    -sl)    SW="&(s-3B";;
    -sm)    SW="&(s0B";;
    -sb)    SW="&(s3B";;
    -rom)   FS="(8U";;
    -ibm)   FS="(10U";;
    -lpr)   TF='(s0p16.66h7v0s0b8T';;
    -pic)   FP="&k0S";;
    -por*)  OR="&l0O";;
    -lan*)  OR="&l1O";;
	-nopr*)	PRT=NO;;
	-kpr)	FUX="kpr";;
	-T)		KPR="$KPR -T1";;
	-t)		KPR="$KPR -t1";;
	-S)		shift;KPR="$KPR -S$1";;
	-w)		shift;KPR="$KPR -w$1";;
	-c)		shift;KPR="$KPR -c$1";;
	-p)		shift;KPR="$KPR -p$1";;
    -x)     set -x;;
        -*)     echo "<unknown option> $1";sleep 10;exec $PG -h;exit 0;;
        *)      FL="$FL $1";;
esac
case $# in
    0|1)    break;;
    *)      shift;;
esac
done
:
trap 'rm -f $TMP;exit' 1 2 3 4 14
:
XX="$AA$OR$CO$LI$HI$PL$TM$TL$LM$SW$TF$LT"
:
{
echo -n "$XX"
case $FUX in
	kpr)	kpr "$KPR" "$FL";;
	cat) 	cat ${FL="-"};;
esac
echo "$OC"
echo "$ZZ"
} > $TMP
:
case $DOS in
	YES)	$DOSCOPY $TMP $OUT;
			rm -f $TMP;
			exit 0;;
	*)		;;
esac
:
case $PRT in
	YES)	/dos/print $TMP;exit 0;;
	NO)		;;
esac
case $OUT in
	"")		OUT=$TMP;;
	*)		mv $TMP $OUT;;
esac
echo "output file: $OUT"
