From c5a38b6fdf1c2335f7f5558976e478f12d297990 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 8 Dec 2002 16:50:08 +0000 Subject: 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. --- usr.sbin/lpr/lprm/lprm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin/lpr') 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; -- cgit v1.2.3