Subject: Re: Changes to lpd to run if and of on remote printers
To: NetBSD Miscellaneous Technical Discussion List <tech-misc@NetBSD.ORG>
From: David Brownlee <abs@NetBSD.ORG>
List: tech-misc
Date: 08/29/2002 15:49:16
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--0-815399108-1030632556=:21266
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Thu, 29 Aug 2002, Greg A. Woods wrote:
> [ On Wednesday, August 28, 2002 at 15:38:44 (+0100), David Brownlee wrote: ]
> > Subject: Changes to lpd to run if and of on remote printers
> >
> > lpd has a '-r' option to run 'of' for remote printers, but it
> > doesn't actually pass the contents of any files through it.
> >
> > I've come up with a set of patches that handles this - does
> > anyone have any thought/objections/comments?
>
> It sounds like a good idea -- I've wanted to do something like this in
> the past myself, though in that case I ened up using a different host
> with a different print spooling implementation.
This is an updated version that doesn't pass the control file
through the filter (awarded myself 73 dork points and a clue by
four to the head for that)...
--
David/absolute -- www.netbsd.org: No hype required --
--0-815399108-1030632556=:21266
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=diff
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.NEB.4.44.0208291549160.21266@moss.i.formula1.com>
Content-Description:
Content-Disposition: attachment; filename=diff
SW5kZXg6IGxwZC9wcmludGpvYi5jDQo9PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
DQpSQ1MgZmlsZTogL2N2c3Jvb3QvYmFzZXNyYy91c3Iuc2Jpbi9scHIvbHBk
L3ByaW50am9iLmMsdg0KcmV0cmlldmluZyByZXZpc2lvbiAxLjM0DQpkaWZm
IC11IC1CIC1yMS4zNCBwcmludGpvYi5jDQotLS0gbHBkL3ByaW50am9iLmMJ
MjAwMi8wNy8xNCAxNToyODowMAkxLjM0DQorKysgbHBkL3ByaW50am9iLmMJ
MjAwMi8wOC8yOSAxNDo0NzoyMg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