ifhp revision 225736
138465Smsmith#!/bin/sh 238465Smsmith# 338465Smsmith# ifhp - Print Ghostscript-simulated PostScript on a DesJet 500 438465Smsmith# Installed in /usr/local/libexec/hpif 538465Smsmith 638465Smsmith# 738465Smsmith# Treat LF as CR+LF: 838465Smsmith# 938465Smsmithprintf "\033&k2G" || exit 2 1038465Smsmith 1138465Smsmith# 1238465Smsmith# Read first two characters of the file 1338465Smsmith# 1438465Smsmithread first_line 1538465Smsmithfirst_two_chars=`expr "$first_line" : '\(..\)'` 1638465Smsmith 1738465Smsmithif [ "$first_two_chars" = "%!" ]; then 1838465Smsmith # 1938465Smsmith # It is PostScript; use Ghostscript to scan-convert and print it 2038465Smsmith # 2138465Smsmith /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \ 2238465Smsmith && exit 0 2338465Smsmith 2438465Smsmithelse 2538465Smsmith # 2638465Smsmith # Plain text or HP/PCL, so just print it directly; print a form 27124140Sobrien # at the end to eject the last page. 28124140Sobrien # 29124140Sobrien echo "$first_line" && cat && printf "\f" && exit 0 3038465Smsmithfi 31234898Smarius 32234898Smariusexit 2 3367227Sobrien