Update ifhp script to something working on 4.X and 5.X. This example is

now similar to the one installed by default in
/usr/share/examples/printing/ifhp

PR:		docs/65766
Submitted by:	Simon Barner <barner@in.tum.de>
This commit is contained in:
Marc Fonvieille 2004-06-21 10:39:30 +00:00
parent 8aac675ba7
commit 2b371d78f0
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=21207

View file

@ -1936,10 +1936,11 @@ fi</programlisting>
<programlisting>#!/bin/sh
#
# ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500
# Installed in /usr/local/libexec/ifhp
# Installed in /usr/share/examples/printing/ifhp
#
# Treat LF as CR+LF:
# Treat LF as CR+LF (to avoid the "staircase effect" on HP/PCL
# printers):
#
printf "\033&amp;k2G" || exit 2
@ -1953,17 +1954,8 @@ if [ "$first_two_chars" = "%!" ]; then
#
# It is PostScript; use Ghostscript to scan-convert and print it.
#
# Note that PostScript files are actually interpreted programs,
# and those programs are allowed to write to stdout, which will
# mess up the printed output. So, we redirect stdout to stderr
# and then make descriptor 3 go to stdout, and have Ghostscript
# write its output there. Exercise for the clever reader:
# capture the stderr output from Ghostscript and mail it back to
# the user originating the print job.
#
exec 3&gt;&amp;1 1&gt;&amp;2
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 \
-sOutputFile=/dev/fd/3 - &amp;&amp; exit 0
-sOutputFile=- - &amp;&amp; exit 0
else
#
# Plain text or HP/PCL, so just print it directly; print a form feed