diff options
author | 2002-12-08 16:50:07 +0000 | |
---|---|---|
committer | 2002-12-08 16:50:07 +0000 | |
commit | 02e888b369762a3215b598dfe992ae507a88dfe5 (patch) | |
tree | 1ff3d63a38c76ab486a8b19841b870d12f6480b1 /usr.bin/split/split.c | |
parent | getopt returns -1, not EOF (diff) | |
download | wireguard-openbsd-02e888b369762a3215b598dfe992ae507a88dfe5.tar.xz wireguard-openbsd-02e888b369762a3215b598dfe992ae507a88dfe5.zip |
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/split/split.c')
-rw-r--r-- | usr.bin/split/split.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index d052b919235..bc8be83fa95 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -1,4 +1,4 @@ -/* $OpenBSD: split.c,v 1.6 2002/02/16 21:27:53 millert Exp $ */ +/* $OpenBSD: split.c,v 1.7 2002/12/08 16:50:07 millert Exp $ */ /* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)split.c 8.3 (Berkeley) 4/25/94"; #else -static char rcsid[] = "$OpenBSD: split.c,v 1.6 2002/02/16 21:27:53 millert Exp $"; +static char rcsid[] = "$OpenBSD: split.c,v 1.7 2002/12/08 16:50:07 millert Exp $"; #endif #endif /* not lint */ @@ -85,7 +85,7 @@ main(argc, argv) int ch; char *ep, *p; - while ((ch = getopt(argc, argv, "-0123456789b:l:p:")) != -1) + while ((ch = getopt(argc, argv, "0123456789b:l:p:-")) != -1) switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': |