mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
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.
This commit is contained in:
parent
4a75dc2585
commit
f27c7b4713
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162555
@ -558,7 +558,6 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
|
||||
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 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
|
||||
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 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
|
||||
if (optind + 1 < nargc && *nargv[optind + 1] != '-')
|
||||
optarg = nargv[++optind];
|
||||
}
|
||||
#endif
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user