From nobody@FreeBSD.ORG Wed Nov  3 03:54:39 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 6B47414CF1; Wed,  3 Nov 1999 03:54:38 -0800 (PST)
Message-Id: <19991103115438.6B47414CF1@hub.freebsd.org>
Date: Wed,  3 Nov 1999 03:54:38 -0800 (PST)
From: thepinkpages@email.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: lprm(1) unaware of lp(1) Environment Variables (LPDEST)
X-Send-Pr-Version: www-1.0

>Number:         14682
>Category:       bin
>Synopsis:       [patch] lprm(1) unaware of lp(1) Environment Variables (LPDEST)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gad
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov  3 04:00:00 PST 1999
>Closed-Date:    
>Last-Modified:  Sat Nov 13 11:38:54 UTC 2010
>Originator:     Jesus monroy
>Release:        3.3
>Organization:
Digital Marshalls
>Environment:
FreeBSD spammie.mozie.com 3.3-RELEASE FreeBSD 3.3-RELEASE #0: Thu Sep 16 23:40:35 GMT 1999     jkh@highwing.cdrom.com:/usr/src/sys/compile/GENERIC  i386
>Description:
lp(1) allows the setting of the default printer via 
Environment Variables (LPDEST or PRINTER).
lprm(1) only recongnizes PRINTER, therefore if
the default printer is set only in LPDEST, then 
lprm(1) does not behave as expected since PRINTER
may be null(non-exsistant).
>How-To-Repeat:
setenv LPDEST (yourprinter)
lp (afile)
lprm -
>Fix:
add LPDEST as an option to lprm(1)
or 
document this failing in lp(1) and lprm(1)

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->marko 
Responsible-Changed-By: marko 
Responsible-Changed-When: Sat Jul 29 03:09:43 PDT 2000 
Responsible-Changed-Why:  
I'll take this. 
This problem also affects lpq(1), lpr(1), and pac(8). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=14682 

From: Mark Ovens <marko@freebsd.org>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: docs/14682: lprm(1) unaware of lp(1) Environment Variables (LPDEST)
Date: Mon, 31 Jul 2000 22:19:15 +0100

 Whilst investigating this problem I found in /usr/bin/lp:
 
 	# Posix 1003.2 compliant print spooler interface.
 
 	[snip]
 
 	# Posix says LPDEST gets precedence over PRINTER
 	dest=${LPDEST:-${PRINTER:-lp}}
 
 So it would seem that the Right Thing(tm) to do is to make the other
 programs POSIX-compliant by making them honour the LPDEST environment
 variable rather than simply documenting the fact that they don't (the
 manpages need updating to reflect this).
 
 
 --- ./lp/lp.1.orig	Sat Jul 29 13:26:50 2000
 +++ ./lp/lp.1	Sat Jul 29 13:28:32 2000
 @@ -74,7 +74,11 @@
  or
  .Ev PRINTER
  .Pq with this precedence
 -are taken as the destination printer.
 +are taken as the destination printer. If neither
 +.Ev LPDEST
 +or
 +.Ev PRINTER
 +are set then the default line printer is used.
  .It Fl n Ar num
  Specify that
  .Ar num
 
 
 
 --- ./lpq/lpq.1.orig	Sat Jul 29 13:10:33 2000
 +++ ./lpq/lpq.1	Sat Jul 29 13:24:16 2000
 @@ -61,9 +61,13 @@
  .It Fl P
  Specify a particular printer, otherwise the default
  line printer is used (or the value of the
 +.Ev LPDEST
 +or
  .Ev PRINTER
 -variable in the
 -environment). All other arguments supplied are interpreted as user
 +variables in the
 +environment, see the
 +.Sx ENVIRONMENT
 +section below). All other arguments supplied are interpreted as user
  names or job numbers to filter out only those jobs of interest.
  .It Fl l
  Information about each of the files comprising the job entry
 @@ -100,9 +104,14 @@
  .Xr lpc  8
  command can be used to restart the printer daemon.
  .Sh ENVIRONMENT
 -If the following environment variable exists, it is used by
 -.Nm lpq :
 +If the following environment variables exist, they are used by
 +.Nm lpq
 +(if both exist,
 +.Ev LPDEST
 +will be used):
  .Bl -tag -width PRINTER
 +.It Ev LPDEST
 +Specifies an alternate default printer.
  .It Ev PRINTER
  Specifies an alternate default printer.
  .El
 
 --- ./lpr/lpr.1.orig	Sat Jul 29 13:29:58 2000
 +++ ./lpr/lpr.1	Sat Jul 29 13:38:14 2000
 @@ -119,9 +119,13 @@
  .It Fl P
  Force output to a specific printer.  Normally,
  the default printer is used (site dependent), or the value of the
 -environment variable
 +environment variables
 +.Ev LPDEST
 +or
  .Ev PRINTER
 -is used.
 +is used (see the
 +.Sx ENVIRONMENT
 +section below).
  .It Fl h
  Suppress the printing of the burst page.
  .It Fl m
 @@ -233,9 +237,12 @@
  .Xr pr 1 .
  .El
  .Sh ENVIRONMENT
 -If the following environment variable exists, it is used by
 -.Nm Ns :
 +If the following environment variables exist, they are used by
 +.Nm
 +(if both exist, LPDEST will be used):
  .Bl -tag -width PRINTER
 +.It Ev LPDEST
 +Specifies an alternate default printer.
  .It Ev PRINTER
  Specifies an alternate default printer.
  .El
 
 --- ./lprm/lprm.1.orig	Sat Jul 29 13:39:08 2000
 +++ ./lprm/lprm.1	Sat Jul 29 13:46:01 2000
 @@ -59,8 +59,14 @@
  .Bl -tag -width indent
  .It Fl P Ns Ar printer
  Specify the queue associated with a specific
 -.Ar printer
 -(otherwise the default printer is used).
 +.Ar printer ,
 +otherwise the default printer is used (or the value of the
 +.Ev LPDEST
 +or
 +.Ev PRINTER
 +environment variables, see the
 +.Sx ENVIRONMENT
 +section below).
  .It Fl
  If a single
  .Sq Fl
 @@ -106,16 +112,30 @@
  any spooling files.  If a daemon is killed, a new one is
  automatically restarted upon completion of file removals.
  .Sh ENVIRONMENT
 -If the following environment variable exists, it is utilized by
 -.Nm lprm .
 +If the following environment variables exist, they are utilized by
 +.Nm lprm
 +(if both exist,
 +.Ev LPDEST
 +will be used).
  .Bl -tag -width PRINTER
 +.It Ev LPDEST
 +If the environment variable
 +.Ev LPDEST
 +exists,
 +and a printer has not been specified with the
 +.Fl P
 +option,
 +the default printer is assumed from 
 +.Ev LPDEST .
  .It Ev PRINTER
  If the environment variable
  .Ev PRINTER
  exists,
  and a printer has not been specified with the
  .Fl P
 -option,
 +option, and the
 +.Ev LPDEST
 +environment variable does not exist,
  the default printer is assumed from 
  .Ev PRINTER .
  .El
 
 --- ./pac/pac.8.orig	Sat Jul 29 13:46:56 2000
 +++ ./pac/pac.8	Sat Jul 29 13:49:26 2000
 @@ -60,8 +60,12 @@
  Accounting is done for the named printer.
  Normally, accounting is done for the default printer (site dependent) or
  the value of the environment variable
 +.Ev LPDEST
 +or
  .Ev PRINTER
 -is used.
 +is used (see the
 +.Sx ENVIRONMENT
 +section below).
  .It Fl c
  Cause the output to be sorted by cost; usually the
  output is sorted alphabetically by name.
 @@ -85,6 +89,18 @@
  Statistics are only printed for user(s)
  .Ar name ;
  usually, statistics are printed for every user who has used any paper.
 +.El
 +.Sh ENVIRONMENT
 +If the following environment variables exist, they are used by
 +.Nm
 +(if both exist,
 +.Ev LPDEST
 +will be used):
 +.Bl -tag -width PRINTER
 +.It Ev LPDEST
 +Specifies an alternate default printer.
 +.It Ev PRINTER
 +Specifies an alternate default printer.
  .El
  .Sh FILES
  .Bl -tag -width /var/account/?_sum -compact
 
 --- ./lpq/lpq.c.orig	Sat Jul 29 12:26:34 2000
 +++ ./lpq/lpq.c	Sat Jul 29 14:26:17 2000
 @@ -116,7 +116,9 @@
  			usage();
  		}
  
 -	if (!aflag && printer == NULL && (printer = getenv("PRINTER")) == NULL)
 +	if (!aflag && printer == NULL &&
 +				!((printer = getenv("LPDEST")) != NULL ||
 +				(printer = getenv("PRINTER")) != NULL))
  		printer = DEFLP;
  
  	for (argc -= optind, argv += optind; argc; --argc, ++argv)
 
 --- ./lpr/lpr.c.orig	Sat Jul 29 12:46:14 2000
 +++ ./lpr/lpr.c	Sat Jul 29 14:30:47 2000
 @@ -265,7 +265,8 @@
  	argv += optind;
  	if (errs)
  		usage();
 -	if (printer == NULL && (printer = getenv("PRINTER")) == NULL)
 +	if (printer == NULL && !((printer = getenv("LPDEST")) != NULL ||
 +				(printer = getenv("PRINTER")) != NULL))
  		printer = DEFLP;
  	chkprinter(printer, pp);
  	if (pp->no_copies && ncopies > 1)
 
 --- ./lprm/lprm.c.orig	Sat Jul 29 12:36:51 2000
 +++ ./lprm/lprm.c	Sat Jul 29 14:31:40 2000
 @@ -150,7 +150,8 @@
  			}
  		}
  	}
 -	if (printer == NULL && (printer = getenv("PRINTER")) == NULL)
 +	if (printer == NULL && !((printer = getenv("LPDEST")) != NULL ||
 +				(printer = getenv("PRINTER")) != NULL))
  		printer = DEFLP;
  
  	rmjob(printer);
 
 --- ./pac/pac.c.orig	Sat Jul 29 13:06:32 2000
 +++ ./pac/pac.c	Sat Jul 29 14:32:13 2000
 @@ -173,7 +173,8 @@
  		(void) enter(--cp);
  		allflag = 0;
  	}
 -	if (printer == NULL && (printer = getenv("PRINTER")) == NULL)
 +	if (printer == NULL && !((printer = getenv("LPDEST")) != NULL ||
 +				(printer = getenv("PRINTER")) != NULL))
  		printer = DEFLP;
  	if (!chkprinter(printer)) {
  		printf("pac: unknown printer %s\n", printer);
 
 
 -- 
   If I buy a copy of WinDelete, and it doesn't delete Windows,
   am I entitled to my money back?
 ________________________________________________________________
 51.44N  FreeBSD - The Power To Serve http://www.freebsd.org
 2.057W  My Webpage http://ukug.uk.freebsd.org/~mark
 mailto:marko@freebsd.org                http://www.radan.com
 
 
Responsible-Changed-From-To: marko->gad 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Fri Mar 14 21:58:55 PST 2003 
Responsible-Changed-Why:  

marko is no longer with us, and gad is the resident lp* expert 

http://www.freebsd.org/cgi/query-pr.cgi?pr=14682 
>Unformatted:
