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.
This commit is contained in:
Rich Felker committed 2014-12-20 19:49:19 -05:00
1 parent 91184c4f16
commit 0217ed72f9
1 file changed
+1
+1
View File
@@ -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)