Subject: Re: local filters and remote printer with lpd
To: Jeremy C. Reed <reed@reedmedia.net>
From: Matthias Buelow <mkb@mukappabeta.de>
List: netbsd-help
Date: 04/04/2001 04:46:11
"Jeremy C. Reed" <reed@reedmedia.net> writes:

>I am trying to configure lpd so it will process the data locally before
>sending it to a remote server (which has the printer).

That doesn't work with the NetBSD lpd (or with any BSD-derived lpds
that haven't been modified to support this) since for some obscure
reason, the implementors of lpd explicitly disabled use of local
filters for remote printers and there is no way to re-enable it,
quoting printcap(5):

FILTERS
     If a printer is specified via lp (either local or remote), the lpd(8)
     daemon creates a pipeline of filters to process files for various printer
     types.  The pipeline is not set up for remote printers specified via rm
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     unless the local host is the same as the remote printer host given.  The
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

the lpd -r setting won't work either (as far as I have investigated,
it's broken and does nothing observable, certainly not what was
advertised.)  I have discussed this about a year ago or so on
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.)

The easiest solution, however, is to use LPRng (a BSD-lpd compatible
reimplementation with lotsa extra bloat but also some nice features
and general cleanup).  I didn't use the LPRng from pkgsrc since it
was an older version then (dunno about the status atm) and fetched
"LPRng-3.7.4" from the master site and installed it under /usr/local.
Although I've heard some talking about having to set up bounce queues or
whatever with lprng to solve the above problem, it pretty much worked
(without bounce queues) straight ahead, maybe the advise was for an
older version of LPRng.

My /usr/local/etc/printcap now is the following:

lp|remote laser line printer;\
        :sd=/var/spool/output/eps1:lf=/var/log/lpd-errs:\
        :filter=/usr/local/sbin/lpfilt:\
        :sh:rm=eps1:rp=wastebasket_p1:
ps|remote laser postscript printer;\
        :sd=/var/spool/output/eps1:lf=/var/log/lpd-errs:\
        :filter=/usr/local/sbin/psfilt:\
        :sh:rm=eps1:rp=wastebasket_p1:

Both go via a Lantronix EPS1 printserver (printer name "wastebasket")
to which my el-cheapo laserprinter is connected on the parallel port.
I need to filter postscript through ghostscript since my el-cheapo
printer only does pcl.

The filter in question is specified via the filter= directive, obviously.

Make sure you disable the lpr/lpd/etc. binaries in /usr/{,s}bin, you
won't need them anymore then.

mkb