home *** CD-ROM | disk | FTP | other *** search
- :
- # Copyright 1985, 1986, 1987, 1988 Chris Lewis
- # All Rights Reserved
- #
- # Permission to copy and further distribute is freely given provided
- # this copyright notice remains intact and that this software is not
- # sold for profit.
- #
- # Project: Generic Troff drivers
- # Module: psroff.sh
- # Author: Chris Lewis
- # Specs: troff driver
- #
- #ident "@(#)psroff.sh: 1.15 Copyright 89/07/14 14:47:46 Chris Lewis"
- term=false
- type=`basename $0 | sed -e 's/^\(..\).*/\1/'`
- copies=1
- for i in $*
- do
- case $i in
- -X)
- set -x
- ;;
- -t)
- term=true
- ;;
- -T*)
- device=`echo $i | sed -e 's/-T//'`
- ;;
- -d*)
- type=`echo $i | sed -e 's/-d//'`
- ;;
- -n*)
- copies=`echo $i | sed -e 's/-n//'`
- ;;
- -D | -m)
- debug="$debug $i"
- ;;
- -)
- files="$files $i"
- ;;
- -rL*)
- eval `echo $i | sed -e 's/-rL\(..*\)\(.\)$/length=\1 prec=\2/'`
- if [ -z "$length" -o -z "$prec" ]
- then
- echo "Bad length definition ($i) - must have value and scale" \
- >&2
- exit 1
- fi
- length="-l$length$prec"
- args="$args $i"
- ;;
- -*)
- args="$args $i"
- ;;
- *)
- files="$files $i"
- if [ ! -r $i ]
- then
- echo "$0: cannot open $i" >&2
- exit 1
- fi
- ;;
- esac
- done
-
- if [ -x troff2ps ]
- then
- t2=./troff2ps
- else
- t2=%%LIBDIR%%/troff2ps
- fi
-
- # If you add a driver, you will have to add it here too:
- case $type in
- lj | lk) OUTPUT="%%LJOUTPUT%%" ;;
- ps) OUTPUT="%%PSOUTPUT%%" ;;
- dt) OUTPUT="%%DTOUTPUT%%" ;;
- *)
- echo "$0: don't understand $type drivers" >&2
- exit 1
- ;;
- esac
- if $term
- then
- ( troff -t $args $files 2>&1 ) | $t2 $length -d$type $debug $device
- exit $?
- else
- eval "( troff -t $args $files 2>&1 ) | $t2 $length -d$type $debug $device $OUTPUT"
- exit $?
- fi
-