projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
91184c4
)
set optopt in getopt_long
author
Rich Felker
<dalias@aerifal.cx>
Sun, 21 Dec 2014 00:49:19 +0000
(19:49 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Sun, 21 Dec 2014 00:49:19 +0000
(19:49 -0500)
this is undocumented but possibly expected behavior of GNU
getopt_long, and useful when error message printing has been
suppressed.
src/misc/getopt_long.c
patch
|
blob
|
history
diff --git
a/src/misc/getopt_long.c
b/src/misc/getopt_long.c
index 45992f8563e5bfc783d2fbaebff72df58aa18d0e..e5a4a75adcb94740901a03a3465a9ce47f02114c 100644
(file)
--- 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)