xref: /freebsd/share/examples/printing/psdfX (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1#!/bin/sh
2#
3#  psdf - DVI to PostScript printer filter
4#  Installed in /usr/local/libexec/psdf
5#
6#  Invoked by lpd when user runs lpr -d
7#
8
9orig_args="$@"
10
11fail() {
12    echo "$@" 1>&2
13    exit 2
14}
15
16while getopts "x:y:n:h:" option; do
17    case $option in
18        x|y)  ;; # Ignore
19	n)    login=$OPTARG ;;
20	h)    host=$OPTARG ;;
21	*)    echo "LPD started `basename $0` wrong." 1>&2
22              exit 2
23              ;;
24    esac
25done
26
27[ "$login" ] || fail "No login name"
28[ "$host" ] || fail "No host name"
29
30( /u/kelly/freebsd/printing/filters/make-ps-header $login $host "DVI File"
31  /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args
32