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