Make return code in noarg case GNU-compatible
This commit is contained in:
parent
d92dc3946d
commit
8848539902
@ -311,26 +311,26 @@ This practice is wrong, and should not be used in any current development.
|
||||
.\" to
|
||||
.\" mean the preceding option takes an optional argument.
|
||||
.\" .El
|
||||
.It
|
||||
Return value in case of missing argument if first character
|
||||
(after
|
||||
.Ql +
|
||||
or
|
||||
.Ql - )
|
||||
in option string is not
|
||||
.Ql \&: :
|
||||
.Bl -tag -width ".Bx"
|
||||
.It Tn GNU
|
||||
returns
|
||||
.Ql \&?
|
||||
.It Bx
|
||||
returns
|
||||
.Ql \&:
|
||||
(since
|
||||
.Bx Ns 's
|
||||
.Fn getopt
|
||||
does).
|
||||
.El
|
||||
.\" .It
|
||||
.\" Return value in case of missing argument if first character
|
||||
.\" (after
|
||||
.\" .Ql +
|
||||
.\" or
|
||||
.\" .Ql - )
|
||||
.\" in option string is not
|
||||
.\" .Ql \&: :
|
||||
.\" .Bl -tag -width ".Bx"
|
||||
.\" .It Tn GNU
|
||||
.\" returns
|
||||
.\" .Ql \&?
|
||||
.\" .It Bx
|
||||
.\" returns
|
||||
.\" .Ql \&:
|
||||
.\" (since
|
||||
.\" .Bx Ns 's
|
||||
.\" .Fn getopt
|
||||
.\" does).
|
||||
.\" .El
|
||||
.\" .It
|
||||
.\" Handling of
|
||||
.\" .Ql --a
|
||||
|
@ -284,7 +284,11 @@ parse_long_options(char * const *nargv, const char *options,
|
||||
optopt = long_options[match].val;
|
||||
else
|
||||
optopt = 0;
|
||||
#ifdef GNU_COMPATIBLE
|
||||
return (BADCH);
|
||||
#else
|
||||
return (BADARG);
|
||||
#endif
|
||||
}
|
||||
if (long_options[match].has_arg == required_argument ||
|
||||
long_options[match].has_arg == optional_argument) {
|
||||
|
Loading…
Reference in New Issue
Block a user