]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/examples/printing/psif
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / share / examples / printing / psif
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
8 read first_line
9 first_two_chars=`expr "$first_line" : '\(..\)'`
10
11 if [ "$first_two_chars" = "%!" ]; then
12    #
13    #  PostScript job, print it.
14    #
15    echo "$first_line" && cat && printf "\004" && exit 0
16    exit 2
17 else
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
23 fi