提交 567cc81c 编写于 作者: R Rich Felker

fix handling of "--" with getopt_long argv permutation

if argv permutation is used, the option terminator "--" should be
moved before any skipped non-option arguments rather than being left
in the argv tail where the caller will see and interpret it.
上级 b4ef1830
......@@ -33,7 +33,6 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con
if (i >= argc || !argv[i]) return -1;
if (argv[i][0] != '-') continue;
if (!argv[i][1]) continue;
if (argv[i][1] == '-' && !argv[i][2]) return -1;
break;
}
optind = i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册