diff options
author | millert <> | 2002-12-10 17:51:42 +0000 |
---|---|---|
committer | millert <> | 2002-12-10 17:51:42 +0000 |
commit | 2304367f418c4d1085e25e4f99c9afd1951bf1d2 (patch) | |
tree | 4adab705018a9113bb5e464903951866510eff9d /src/lib | |
parent | 6cf34007b3615170b5c08a4ce38f7077516f1e14 (diff) | |
download | openbsd-2304367f418c4d1085e25e4f99c9afd1951bf1d2.tar.gz openbsd-2304367f418c4d1085e25e4f99c9afd1951bf1d2.tar.bz2 openbsd-2304367f418c4d1085e25e4f99c9afd1951bf1d2.zip |
When doing permutation, only treat "-" as an option if it was specified
in optstring. Problem noticed by Theo.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libc/stdlib/getopt_long.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c index 413ec24f4e..0cdc4d652f 100644 --- a/src/lib/libc/stdlib/getopt_long.c +++ b/src/lib/libc/stdlib/getopt_long.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getopt_long.c,v 1.10 2002/12/08 17:52:26 millert Exp $ */ | 1 | /* $OpenBSD: getopt_long.c,v 1.11 2002/12/10 17:51:42 millert Exp $ */ |
2 | /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ | 2 | /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ |
3 | 3 | ||
4 | /* | 4 | /* |
@@ -64,7 +64,7 @@ | |||
64 | */ | 64 | */ |
65 | 65 | ||
66 | #if defined(LIBC_SCCS) && !defined(lint) | 66 | #if defined(LIBC_SCCS) && !defined(lint) |
67 | static char *rcsid = "$OpenBSD: getopt_long.c,v 1.10 2002/12/08 17:52:26 millert Exp $"; | 67 | static char *rcsid = "$OpenBSD: getopt_long.c,v 1.11 2002/12/10 17:51:42 millert Exp $"; |
68 | #endif /* LIBC_SCCS and not lint */ | 68 | #endif /* LIBC_SCCS and not lint */ |
69 | 69 | ||
70 | #include <err.h> | 70 | #include <err.h> |
@@ -348,8 +348,9 @@ start: | |||
348 | nonopt_start = nonopt_end = -1; | 348 | nonopt_start = nonopt_end = -1; |
349 | return (-1); | 349 | return (-1); |
350 | } | 350 | } |
351 | if (*(place = nargv[optind]) != '-') { /* found non-option */ | 351 | if (*(place = nargv[optind]) != '-' || |
352 | place = EMSG; | 352 | (place[1] == '\0' && strchr(options, '-') == NULL)) { |
353 | place = EMSG; /* found non-option */ | ||
353 | if (flags & FLAG_ALLARGS) { | 354 | if (flags & FLAG_ALLARGS) { |
354 | /* | 355 | /* |
355 | * GNU extension: | 356 | * GNU extension: |