summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/getopt_long.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2004-03-06 14:24:10 +0000
committerache <ache@FreeBSD.org>2004-03-06 14:24:10 +0000
commitc94e5bebf56c687d9580ddca6ce99b3744c2b175 (patch)
tree405b32a3fc68f2299c2fc9cf4497f7c24a7cd70f /lib/libc/stdlib/getopt_long.c
parent97dc367f937a8222c806908a545e7756d4e75444 (diff)
downloadFreeBSD-src-c94e5bebf56c687d9580ddca6ce99b3744c2b175.zip
FreeBSD-src-c94e5bebf56c687d9580ddca6ce99b3744c2b175.tar.gz
Make GNU-compatible following case:
single '-' in command line and '-' (non-first) in options
Diffstat (limited to 'lib/libc/stdlib/getopt_long.c')
-rw-r--r--lib/libc/stdlib/getopt_long.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c
index 74f8aa0..dfaff42 100644
--- a/lib/libc/stdlib/getopt_long.c
+++ b/lib/libc/stdlib/getopt_long.c
@@ -413,7 +413,11 @@ start:
return (-1);
}
if (*(place = nargv[optind]) != '-' ||
+#ifdef GNU_COMPATIBLE
+ place[1] == '\0') {
+#else
(place[1] == '\0' && strchr(options, '-') == NULL)) {
+#endif
place = EMSG; /* found non-option */
if (flags & FLAG_ALLARGS) {
/*
OpenPOWER on IntegriCloud