From: Rich Felker Date: Sun, 21 Dec 2014 00:49:19 +0000 (-0500) Subject: set optopt in getopt_long X-Git-Tag: v1.1.6~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0217ed72f986d78b177f1a014e93f2150105bb44;p=oweals%2Fmusl.git set optopt in getopt_long this is undocumented but possibly expected behavior of GNU getopt_long, and useful when error message printing has been suppressed. --- diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c index 45992f85..e5a4a75a 100644 --- a/src/misc/getopt_long.c +++ b/src/misc/getopt_long.c @@ -76,6 +76,7 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring if (cnt==1) { i = match; optind++; + optopt = longopts[i].val; if (*opt == '=') { if (!longopts[i].has_arg) { if (optstring[0] == ':' || !opterr)