H='
==========
ldcp [file(s)]
ltcp [file(s)]
==========
    double (ldcp) or triple (ltcp) print for Laser Jet II
    printer.  output is packed.
==========
OPTIONS
==========
-66     use 66 line pages (default 68)
-d a:   drive letter (default a)
-o name base name for output file (becomes name.pct)
==========
'
WF=${TMPDIR?/usr/tmp}/wf$$
trap 'rm -f $WF $WF.z;exit' 0 1 2 3 4 14
:
OUTF=NONE
DRIV=a:
PLEN=68
TLEN=66
PACK="P"
MODE="v"
while :
do
case $1 in
    -x)     set -x;;
    -d)     shift;DRIV=$1;;
    -e)     set -e;;
    -h)     clear;echo "$H";exit 0;;
    -o)     shift;OUTF=$1;;
    -O)     shift;OUTF=$1;;
    -p)     PACK="p";;
    -6*)    TLEN=66;;
    ?*)     LIST="$LIST $1";;
esac
case $# in
    0|1)    break;;
    *)      shift;;
esac
done
case $0 in
    *ldcp)  C=2;;
    *ltcp)  C=3;;
esac
:
echo "$C column print, packed"
:
DOUBLE="-lpr -lan -lm 4 -li 8 -pl $PLEN -tl $TLEN -kpr -p $TLEN -c $C"
:
hpl -o $WF $DOUBLE $LIST
:
pack $WF
:
case $OUTF in
    NONE)   FS=`basename $WF`;;
    *)      FS=$OUTF;;
esac
SUF=".z"
case $OS in
    MSDOS)  SUF="";DOSCOPY="copy";;
    XENIX)  DOSCOPY="doscp -r";;
    MKS)    SUF="";DOSCOPY="mv";;
    *)      echo "($0) <no OS variable in environment>"
            DRIV=
            DOSCOPY="mv";;
esac
eval $DOSCOPY $WF$SUF ${DRIV}$FS.pct
