diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/getopt_long.3 | 40 | ||||
-rw-r--r-- | lib/libc/stdlib/getopt_long.c | 4 |
2 files changed, 24 insertions, 20 deletions
diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3 index 88738b0..bd5d2b9 100644 --- a/lib/libc/stdlib/getopt_long.3 +++ b/lib/libc/stdlib/getopt_long.3 @@ -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 diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c index eef627a..74f8aa0 100644 --- a/lib/libc/stdlib/getopt_long.c +++ b/lib/libc/stdlib/getopt_long.c @@ -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) { |