Subject: bin/20890: lpr -q option
To: None <>
From: Brian Ginsbach <>
List: netbsd-bugs
Date: 03/25/2003 12:53:23
>Number:         20890
>Category:       bin
>Synopsis:       lpr -q option broken after conversion to getopt
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 25 10:54:00 PST 2003
>Originator:     Brian Ginsbach
>Release:        NetBSD 1.6, current
Cray Inc.
	It appears that when lpr was converted to use getopt(3)
	for argument processing the -q flag was not added to the
	optstring as a valid option.  Now lpr -q file causes a
	usage message to be printed.

	Also the -q option is not currently documented in the man
	page.  The only way to find out about it now is read the
	source.  It is possible that -q was missed in the optstring
	since it was not documented in the 4.4BSD-Lite sources.

	(Note this bug was introduced way back in NetBSD 1.3!)
	lpr -q somefile

	The q option needs to be added to the optstring.  The q
	option should be documented on the lpr(1) man page.

cvs server: Diffing .
Index: lpr.1
RCS file: /cvsroot/src/usr.sbin/lpr/lpr/lpr.1,v
retrieving revision 1.12
diff -u -r1.12 lpr.1
--- lpr.1	2003/02/25 10:36:12	1.12
+++ lpr.1	2003/03/25 18:45:51
@@ -41,7 +41,7 @@
 .Nd off line print
-.Op Fl cdfghlmnprstv
+.Op Fl cdfghlmnqprstv
 .Bk -words
 .Op Fl P Ar printer
@@ -132,6 +132,8 @@
 Suppress the printing of the burst page.
 .It Fl m
 Send mail upon completion.
+.It Fl q
+Queue the print job but do not start the spooling daemon.
 .It Fl r
 Remove the file upon completion of spooling or upon completion of
 printing (with the
Index: lpr.c
RCS file: /cvsroot/src/usr.sbin/lpr/lpr/lpr.c,v
retrieving revision 1.23
diff -u -r1.23 lpr.c
--- lpr.c	2002/07/14 15:28:00	1.23
+++ lpr.c	2003/03/25 18:45:51
@@ -151,7 +151,7 @@
 	errs = 0;
 	while ((c = getopt(argc, argv,
-	    ":#:1:2:3:4:C:J:P:T:U:cdfghi:lmnprstvw:")) != -1) {
+	    ":#:1:2:3:4:C:J:P:T:U:cdfghi:lmnqprstvw:")) != -1) {
 		switch (c) {
 		case '#':		/* n copies */
@@ -761,6 +761,6 @@
 	fprintf(stderr, "%s\n%s\n",
 	    "usage: lpr [-Pprinter] [-#num] [-C class] [-J job] [-T title] "
 	    "[-U user]",
-	    "[-i[numcols]] [-1234 font] [-wnum] [-cdfghlmnprstv] [name ...]");
+	    "[-i[numcols]] [-1234 font] [-wnum] [-cdfghlmnqprstv] [name ...]");