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/calendar/calendar.c | |
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/calendar/calendar.c')
-rw-r--r-- | usr.bin/calendar/calendar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index 9ea6589bdd3..35a73f6a944 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.c,v 1.18 2002/06/23 03:07:21 deraadt Exp $ */ +/* $OpenBSD: calendar.c,v 1.19 2002/12/08 16:50:07 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -43,7 +43,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; #else -static char rcsid[] = "$OpenBSD: calendar.c,v 1.18 2002/06/23 03:07:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: calendar.c,v 1.19 2002/12/08 16:50:07 millert Exp $"; #endif #endif /* not lint */ @@ -92,7 +92,7 @@ main(argc, argv) (void)setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "-abf:t:A:B:")) != -1) + while ((ch = getopt(argc, argv, "abf:t:A:B:-")) != -1) switch (ch) { case '-': /* backward contemptible */ case 'a': |