On Mon, Oct 02, 2006 at 02:49:56AM +1000, Ian Smith wrote:
> Re: freebsd-questions Digest, Vol 152, Issue 13
> On Sun, 1 Oct 2006 [EMAIL PROTECTED] wrote:
> > Message: 30
> > Date: Sat, 30 Sep 2006 17:12:10 -0700
> > From: Gary Kline <[EMAIL PROTECTED]>
> > Subject: triouble with my Deskjet 500
> Hi Gary,
> > The trouble is that it only prints in ASCII Aand fails to fails
> > to print xv images or anything else PostScript. I'm playing
> > around withthe following in /usr//local/libexec:
[[ ... ]]
> > It's pretty obviously that I can toss the first several lines that
> > came from the original hpif file; this was before I cared about
> > graphics. I lost the ghostscript part when my system had its
> > fatal trap. Anybody out there who has an ancient hp djet500?
> > or can help otherwise. I'm out of ideas.
> I ran into exactly this after upgrading 4.5-R to 5.4-R (now 5.5-S); that
> fancy stderr/stdout dance doesn't seem to work &/| be needed anymore. I
> got sick of Mozilla crashing trying to print and dug up this fix, forget
> where/how. Way over commented, but times like this it comes in handy :)
> #% /usr/local/libexec/if-lq850 smithi 6/4/3
> #% v2 29/6/6, maybe the 3>&1 stuff is what doesn't work in 5.4-R?
> #% as advised by FreeBSD handbook, from:
> # ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500
> # as installed in /usr/local/libexec/hpif
> #% modified for printer canon bj10sx (configured as an epson lq850)
After fmessing around for an hour I found the bug that was
introduced by the new/"improved"/(free) CUPS' lp*. The *only*
script change [[ at least that I can see ]] is that
"sOutputFile=" now fails to understand /dev/fd/3. I got my old
"hpif working with only-ASCII and your version working with
only-[Gh|P]ostscript, or mostly since your file did print some
ASCII. But for me, it hung for some timeout or <???>.
I dropped in your Postscript working lines, minus the
re-direction stuff and voila! Yes for good old fashioned ASCII
and Postscript both.
Appended if my new hpif. (I have four servers with
name-change rather than change four /etc/printcaps:-).
PS: file appended. note lines 39-46... .
PPS: comments appreciated; it's hard to *overcomment*, IMHO.
Gary Kline [EMAIL PROTECTED] www.thought.org Public service Unix
3 # hpif - Simple text input filter for lpd for HP-PCL based printers
4 # Installed in /usr/local/libexec/hpif
6 # Simply copies stdin to stdout. Ignores all filter arguments.
7 # Tells printer to treat LF as CR+LF. Writes a form feed character
8 # after printing job.
10 ###printf "\033&k2G" && cat && printf "\f" && exit 0
13 # ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500
14 # Installed in /usr/local/libexec/ifhp
17 # Treat LF as CR+LF:
19 printf "\033&k2G" || exit 2
22 # Read first two characters of the file
24 IFS="" read -r first_line
25 first_two_chars=`expr "$first_line" : '\(..\)'`
27 if [ "$first_two_chars" = "%!" ]; then
29 # It is PostScript; use Ghostscript to scan-convert and print it.
31 # Note that PostScript files are actually interpreted programs,
32 # and those programs are allowed to write to stdout, which will
33 # mess up the printed output. So, we redirect stdout to stderr
34 # and then make descriptor 3 go to stdout, and have Ghostscript
35 # write its output there. Exercise for the clever reader:
36 # capture the stderr output from Ghostscript and mail it back to
37 # the user originating the print job.
39 ###exec 3>&1 1>&2
40 ###/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 \
41 ###-sOutputFile=/dev/fd/3 - && exit 0
45 /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 \
46 -sOutputFile=- - && exit 0
50 # Plain text or HP/PCL, so just print it directly; print a form
51 # at the end to eject the last page.
53 echo "$first_line" && cat && printf "\033&l0H" &&
54 exit 0
57 exit 2
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"