options: fix "--"

Handling this was accidentally forgotten when command line parsing was
refactored. The added recursive call should be a tail recursion with
all reasonable compilers, and it shouldn't be possible to provoke a
stack overflow.
This commit is contained in:
wm4 2012-09-02 20:30:16 +02:00
parent 1ba5a8f283
commit b28c6d0ba5
1 changed files with 5 additions and 0 deletions

View File

@ -70,6 +70,11 @@ static int split_opt_silent(struct parse_state *p)
if (p->no_more_opts || !bstr_startswith0(p->arg, "-") || p->arg.len == 1)
return 0;
if (bstrcmp0(p->arg, "--") == 0) {
p->no_more_opts = true;
return split_opt_silent(p);
}
bool old_syntax = !bstr_startswith0(p->arg, "--");
if (old_syntax) {
p->arg = bstr_cut(p->arg, 1);