turns printfs back on
[freebsd-src/fkvm-freebsd.git] / share / examples / printing / ifhp
blobace0fab4214b3c6add49d786e05ad064388b2c14
1 #!/bin/sh
3 # ifhp - Print Ghostscript-simulated PostScript on a DesJet 500
4 # Installed in /usr/local/libexec/hpif
7 # Treat LF as CR+LF:
9 printf "\033&k2G" || exit 2
12 # Read first two characters of the file
14 read first_line
15 first_two_chars=`expr "$first_line" : '\(..\)'`
17 if [ "$first_two_chars" = "%!" ]; then
19 # It is PostScript; use Ghostscript to scan-convert and print it
21 /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \
22 && exit 0
24 else
26 # Plain text or HP/PCL, so just print it directly; print a form
27 # at the end to eject the last page.
29 echo "$first_line" && cat && printf "\f" && exit 0
32 exit 2