xref: /freebsd/share/examples/printing/psif (revision 2ad872c5794e4c26fdf6ed219ad3f09ca0d5304a)
1#!/bin/sh
2#
3#  psif - Print PostScript or plain text on a PostScript printer
4#  Script version; NOT the version that comes with lprps
5#  Installed in /usr/local/libexec/psif
6#
7
8read first_line
9first_two_chars=`expr "$first_line" : '\(..\)'`
10
11if [ "$first_two_chars" = "%!" ]; then
12   #
13   #  PostScript job, print it.
14   #
15   echo "$first_line" && cat && printf "\004" && exit 0
16   exit 2
17else
18   #
19   #  Plain text, convert it, then print it.
20   #
21   ( echo "$first_line"; cat ) | /usr/local/bin/textps && printf "\004" && exit 0
22   exit 2
23fi
24