121240Swosch#!/bin/sh 221240Swosch# 321240Swosch# ifhp - Print Ghostscript-simulated PostScript on a DesJet 500 421240Swosch# Installed in /usr/local/libexec/hpif 521240Swosch 621240Swosch# 721240Swosch# Treat LF as CR+LF: 821240Swosch# 921240Swoschprintf "\033&k2G" || exit 2 1021240Swosch 1121240Swosch# 1221240Swosch# Read first two characters of the file 1321240Swosch# 1421240Swoschread first_line 1521240Swoschfirst_two_chars=`expr "$first_line" : '\(..\)'` 1621240Swosch 1721240Swoschif [ "$first_two_chars" = "%!" ]; then 1821240Swosch # 1921240Swosch # It is PostScript; use Ghostscript to scan-convert and print it 2021240Swosch # 2121240Swosch /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \ 2221240Swosch && exit 0 2321240Swosch 2421240Swoschelse 2521240Swosch # 2621240Swosch # Plain text or HP/PCL, so just print it directly; print a form 2721240Swosch # at the end to eject the last page. 2821240Swosch # 2943107Srnordier echo "$first_line" && cat && printf "\f" && exit 0 3021240Swoschfi 3121240Swosch 3221240Swoschexit 2 33