summaryrefslogtreecommitdiff
path: root/src/misc/getopt_long.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-12-20 19:49:19 -0500
committerRich Felker <dalias@aerifal.cx>2014-12-20 19:49:19 -0500
commit0217ed72f986d78b177f1a014e93f2150105bb44 (patch)
tree42d3c73eac92f1d7a0469e0c12d153ac381c5155 /src/misc/getopt_long.c
parent91184c4f16b143107fa9935edebe5d2b20bd70d8 (diff)
downloadmusl-0217ed72f986d78b177f1a014e93f2150105bb44.tar.gz
musl-0217ed72f986d78b177f1a014e93f2150105bb44.tar.bz2
musl-0217ed72f986d78b177f1a014e93f2150105bb44.tar.xz
musl-0217ed72f986d78b177f1a014e93f2150105bb44.zip
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.
Diffstat (limited to 'src/misc/getopt_long.c')
-rw-r--r--src/misc/getopt_long.c1
1 files changed, 1 insertions, 0 deletions
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)