diff options
author | ache <ache@FreeBSD.org> | 2006-09-22 17:01:38 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2006-09-22 17:01:38 +0000 |
commit | eb7bc007cc135b4fb22c1c3c7fe6f0581a73c30f (patch) | |
tree | 50806f3e27ef367be4d836c3cd44cc31f8ee1793 /lib/libc/stdlib/getopt_long.c | |
parent | fdb36f8d074291fe047a05a5bdec3d633160c6ae (diff) | |
download | FreeBSD-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/stdlib/getopt_long.c')
-rw-r--r-- | lib/libc/stdlib/getopt_long.c | 7 |
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; } |