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