*
* (c) 2013 Jan Moskyto Matejka <mq@ucw.cz>
* (c) 2014 Martin Mares <mj@ucw.cz>
+ * (c) 2014 Pavel Charvat <pchar@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
opt_failure("Cannot parse the value of %s: %s", THIS_OPT, e);
break;
}
+ case CT_XTYPE:
+ {
+ const char * e = item->u.xtype->parse(value, ptr, cf_get_pool());
+ if (e)
+ opt_failure("Cannot parse the value of %s: %s", THIS_OPT, e);
+ break;
+ }
default:
ASSERT(0);
}
item->u.call(item, value, data);
break;
}
+ case OPT_CL_BREAK:
+ oc->stop_parsing = 2;
+ break;
default:
ASSERT(0);
}
opt_prepare_items(oc, options);
int force_positional = 0;
- int i;
+ int i, start_i = 0;
for (i=0; argv[i] && !oc->stop_parsing; i++) {
+ start_i = i;
char *arg = argv[i];
opt_invoke_hooks(oc, OPT_HOOK_BEFORE_ARG, NULL, NULL);
if (arg[0] != '-' || force_positional)
opt_check_required(oc);
opt_invoke_hooks(oc, OPT_HOOK_FINAL, NULL, NULL);
- return i;
+ return (oc->stop_parsing < 2 ? i : start_i);
}