diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-08 16:50:08 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-08 16:50:08 +0000 |
commit | c5a38b6fdf1c2335f7f5558976e478f12d297990 (patch) | |
tree | a24f21bafd589dbe349a9eb8ce3651b05695577c /usr.bin/man | |
parent | 575d3fc4197705961dd3a1a91780df758087ebec (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.bin/man')
-rw-r--r-- | usr.bin/man/man.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c index bf77cb11b97..e4ffe0e03ca 100644 --- a/usr.bin/man/man.c +++ b/usr.bin/man/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.22 2002/11/23 18:43:29 espie Exp $ */ +/* $OpenBSD: man.c,v 1.23 2002/12/08 16:50:07 millert Exp $ */ /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95"; #else -static char rcsid[] = "$OpenBSD: man.c,v 1.22 2002/11/23 18:43:29 espie Exp $"; +static char rcsid[] = "$OpenBSD: man.c,v 1.23 2002/12/08 16:50:07 millert Exp $"; #endif #endif /* not lint */ @@ -109,7 +109,7 @@ main(int argc, char *argv[]) machine = sflag = NULL; f_cat = f_how = 0; conffile = p_add = p_path = NULL; - while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:s:S:w")) != -1) + while ((ch = getopt(argc, argv, "aC:cfhkM:m:P:s:S:w-")) != -1) switch (ch) { case 'a': f_all = 1; |