Subject: Re: local filters and remote printer with lpd
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 04/03/2001 23:24:02
> > a netbsd mailing list already and also pointed out that the (imho)
> > rather stupid restriction of not starting filters when stuff is
> > intended for a remote printer is removed since quite some time from
> > the FreeBSD lpd (so it might be beneficial to look at what they've done.)
> 
> I am looking at it now. (The patch doesn't apply automatically -- so I am
> applying it by hand.)

I patched src/usr.sbin/lpr/lpd/printjob.c using the ideas from the FreeBSD
patch.

Using the NetBSD lpd "-r" switch and an "of" (output filter) I am able to
now process the file locally and print remotely. Yeah :)

But I do have a problem! The file is processed locally twice and sent as
one job to the remote. For example:

One print job done local (using my logging as shown my earlier mail):

Apr  3 23:07:44 rainier lpd[3782]: echo first_two_chars is %!
Apr  3 23:07:44 rainier lpd[3783]: echo first_line is %!PS-Adobe-1.0
Apr  3 23:07:45 rainier lpd[3786]: user reed printed with ghostscript
Apr  3 23:07:52 rainier lpd[3789]: echo first_two_chars is
Apr  3 23:07:52 rainier lpd[3790]: echo first_line is
Apr  3 23:07:52 rainier lpd[3793]: user reed printed in plain text

Remote only has one:
Apr  3 23:07:49 pilchuck lpd[3570]: user reed printed to raw

The document I printed (/usr/src/xsrc/xfree/xc/doc/specs/BDF/fig1.ps) is
one page. It printed great. Then more garbage went to my printer
giving me a PCL XL error (second page printed).

Now I need to look now very closely to printjob.c.

If anyone can test or look at the patch, it is at
http://www.reedmedia.net/misc/netbsd/patches/printjob.c-diff
This patch is made against
 $NetBSD: printjob.c,v 1.22.4.2 2000/10/17 19:50:23 tv Exp $
which is part of 1.5.1_ALPHA.

The patch supposedly also lets "if" (IF, input filter) also work locally
when printing remotely; I haven't tested this yet.

Also, can someone please explain the difference between "if" and "of"?

Thanks,

   Jeremy C. Reed
   http://www.reedmedia.net/