diff options
author | Siteshwar Vashisht <siteshwar@gmail.com> | 2014-07-02 17:04:58 +0530 |
---|---|---|
committer | Siteshwar Vashisht <siteshwar@gmail.com> | 2014-07-02 17:04:58 +0530 |
commit | 7d47ec4c46792e70481959673fbfdec2adba1719 (patch) | |
tree | c1d312b4d0c0dce9c5a2aa0f45435e35c3bf42b6 /wgetopt.cpp | |
parent | 14cdd24f78c5bba1d5930c95c5b164c9f0f96810 (diff) |
Properly handle invalid arguments in builtins
Fixes #1522
Diffstat (limited to 'wgetopt.cpp')
-rw-r--r-- | wgetopt.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/wgetopt.cpp b/wgetopt.cpp index ecf1121e..2d2117f6 100644 --- a/wgetopt.cpp +++ b/wgetopt.cpp @@ -638,7 +638,10 @@ _wgetopt_internal(int argc, wchar_t *const *argv, const wchar_t *optstring, cons fwprintf(stderr, _(L"%ls: Invalid option -- %lc\n"), argv[0], c); } woptopt = c; - woptind++; + + if (*nextchar != '\0') + woptind++; + return '?'; } if (temp[1] == ':') |