dma(8): Use FALLTHROUGH consistently.
[dragonfly.git] / share / examples / printing / if-gs-ljet4
blob0573645aac0b76d6d8662459558657c4ec020fd9
1 #!/bin/sh
3 # Printer filter for postscript or plain text with output to a HP laserjet.
4 # This requires two packages to be installed:
6 # /usr/dports/print/ghostscript9 (or later)
7 # /usr/dports/print/enscript
9 # lp|ps|local line printer:\
10 # :sh:mx#0:sf:\
11 # :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:\
12 # :if=/usr/local/libexec/if-gs-ljet4:
14 read first_line
15 first_two_chars=`expr "$first_line" : '\(..\)'`
17 if [ "$first_two_chars" = "%!" ]; then
19 # PostScript job, print it.
21 (echo "$first_line" && cat && exit 0) | \
22 gs -q -sPAPERSIZE=letter -sDEVICE=ljet4 -sOutputFile=%stdout% -
23 # printf "\004"
24 exit 2
25 else
27 # Plain text, convert it, then print it.
29 ( echo "$first_line"; cat ) | /usr/local/bin/enscript -G | \
30 gs -q -sPAPERSIZE=letter -sDEVICE=ljet4 -sOutputFile=%stdout% -
31 # printf "\004"
32 exit 2