summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-08 16:50:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-08 16:50:08 +0000
commitc5a38b6fdf1c2335f7f5558976e478f12d297990 (patch)
treea24f21bafd589dbe349a9eb8ce3651b05695577c /usr.sbin/lpr
parent575d3fc4197705961dd3a1a91780df758087ebec (diff)
GNU semantics say that if optstring begins with '-' then
each non-option shall be treated as arguments to option '\1'. BSD getopt match '-' in optstring with a '-' on the command line. This is used to support deprecated options like "su -" that would otherwise prevent the use of getopt(). Resolving this simply requires that the leading '-' be moved somewhere else (I moved it to the end of optstring) since position within optstring is not meaningful.
Diffstat (limited to 'usr.sbin/lpr')
-rw-r--r--usr.sbin/lpr/lprm/lprm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/lpr/lprm/lprm.c b/usr.sbin/lpr/lprm/lprm.c
index 0189767a996..fb3de97d42d 100644
--- a/usr.sbin/lpr/lprm/lprm.c
+++ b/usr.sbin/lpr/lprm/lprm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lprm.c,v 1.12 2002/06/08 01:53:43 millert Exp $ */
+/* $OpenBSD: lprm.c,v 1.13 2002/12/08 16:50:07 millert Exp $ */
/* $$NetBSD: lprm.c,v 1.9 1999/08/16 03:12:32 simonb Exp $ */
/*
@@ -45,7 +45,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lprm.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: lprm.c,v 1.12 2002/06/08 01:53:43 millert Exp $";
+static const char rcsid[] = "$OpenBSD: lprm.c,v 1.13 2002/12/08 16:50:07 millert Exp $";
#endif
#endif /* not lint */
@@ -111,7 +111,7 @@ main(int argc, char **argv)
fatal("Your name is too long");
strlcpy(luser, p->pw_name, sizeof(luser));
person = luser;
- while ((ch = getopt(argc, argv, "-P:w:")) != -1) {
+ while ((ch = getopt(argc, argv, "P:w:-")) != -1) {
switch (ch) {
case '-':
users = -1;