Subject: Re: local filters and remote printer with lpd
To: Jeremy C. Reed <reed@reedmedia.net>
From: Frederick Bruckman <fb@enteract.com>
List: netbsd-help
Date: 04/03/2001 22:09:06
On Tue, 3 Apr 2001, Jeremy C. Reed wrote:

> On Tue, 3 Apr 2001, Frederick Bruckman wrote:
> > My "lpd", NetBSD-1.5, doesn't even have an "-r" option. What's that
> > supposed to do?
>
> Strange. I am trying to look at the lpd history and even older lpd's
> (before 1.5) have "-r":
>      -r      The -r flag allows the ``of'' filter to be use if specified for a
>              remote printer.  Traditionally, lpd would not use the output fil-
>              ter for remote printers.
> (I am using 1.5.1_ALPHA under i386.)

Hmm. You're right. It's 1.4.3 that doesn't have "-r". I had xterms
open on two machines, and got confused. Sorry.

> The remote lpd says:
> Apr  3 18:32:11 pilchuck lpd[3032]: protocol screwup

Huh. That message is only emitted in
src/usr.sbin/lpr/lpd/recvjob.c:readjob(). It's very likely nearly the
same code on Debian linux. The protocol that's "screwed up" is
evidently very simple. I don't understand it completely, but it looks
like Ctl-A, Ctl-B and Ctl-C have special significance. Maybe you need
to escape those characters in your output filter, and reconstruct them
with an input filter on your "raw" printer on the remote end, like

  sed -e 's/^A/^[&/g' -e 's/^B/^[&/g' -e 's/^C/^[&/g' -e 's/^[/^[&/g'

and

  sed -e 's/^[^A/^A/g' -e 's/^[^B/^B/g' -e 's/^[^C/^C/g' -e 's/^[^[/^[/g'

where "^A" signifies the actual character, typed as Ctrl-V Ctrl-A.
Just a thought.


Frederick