Subject: Re: lpr -P bug (Sorry I have not gnats access)
To: None <>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 04/28/1996 06:47:20
> The following piece of code ([...lpr.c...]) seems to have a small
> bug:

> if (printer == NULL && (printer = getenv("PRINTER")) == NULL)
>                 printer = DEFLP;

> Unfortunately if you have "PRINTER=default_queue_to_use" defined and
> you have specified: "lpr -P queue_to_use" the print job goes to the
> "default_queue_to_use" in your environment variable because the of
> reuse of the variable "printer" in the lpr.c code.

It does?  Do you actually observe this, or are you guessing based on
the code?  Your proposed fix looks as though it would have the same
semantics as the code you quoted above: if printer is not NULL, nothing
happens, otherwise getenv("PRINTER") is used if it's non-NULL,
otherwise DEFLP is used.  If this isn't what you observe, either it's
due to some other code botching it or the code you quoted is being
severely miscompiled (which implies a compiler bug).

					der Mouse