summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2006-09-22 17:01:38 +0000
committerache <ache@FreeBSD.org>2006-09-22 17:01:38 +0000
commiteb7bc007cc135b4fb22c1c3c7fe6f0581a73c30f (patch)
tree50806f3e27ef367be4d836c3cd44cc31f8ee1793 /lib/libc
parentfdb36f8d074291fe047a05a5bdec3d633160c6ae (diff)
downloadFreeBSD-src-eb7bc007cc135b4fb22c1c3c7fe6f0581a73c30f.zip
FreeBSD-src-eb7bc007cc135b4fb22c1c3c7fe6f0581a73c30f.tar.gz
Be more GNU compatible:
don't be greedy on the GNU "::" extension when arg separated by whitespace and POSIX_CORRECTLY is set. From POSIX point of view this is unclear situation, so minimal assumption looks right.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/getopt_long.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c
index 47eab1f..6073444 100644
--- a/lib/libc/stdlib/getopt_long.c
+++ b/lib/libc/stdlib/getopt_long.c
@@ -558,7 +558,6 @@ start:
optarg = NULL;
if (*place) /* no white space */
optarg = place;
- /* XXX: disable test for :: if PC? (GNU doesn't) */
else if (oli[1] != ':') { /* arg not optional */
if (++optind >= nargc) { /* no arg */
place = EMSG;
@@ -568,7 +567,10 @@ start:
return (BADARG);
} else
optarg = nargv[optind];
- } else if (!(flags & FLAG_PERMUTE)) {
+ }
+#ifndef GNU_COMPATIBLE
+ /* XXX: disable test for :: if PC? (GNU doesn't) */
+ else if (!(flags & FLAG_PERMUTE)) {
/*
* If permutation is disabled, we can accept an
* optional arg separated by whitespace so long
@@ -577,6 +579,7 @@ start:
if (optind + 1 < nargc && *nargv[optind + 1] != '-')
optarg = nargv[++optind];
}
+#endif
place = EMSG;
++optind;
}
OpenPOWER on IntegriCloud