diff --git a/wgetopt.cpp b/wgetopt.cpp index ecf1121e5..2d2117f6d 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] == ':')