X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=parse-options.c;h=42b51ef14514f3c3df454e4b718718a9b58f1612;hb=6578483036695820d05aa7cf482a38169ad321bf;hp=632c1346c6bc6fd17a516b82771ba607961d3e4f;hpb=b57c68a69e028cc41eb01404dc4446a463c0e464;p=thirdparty%2Fgit.git diff --git a/parse-options.c b/parse-options.c index 632c1346c6..42b51ef145 100644 --- a/parse-options.c +++ b/parse-options.c @@ -66,6 +66,9 @@ static int get_value(struct parse_opt_ctx_t *p, return opterror(opt, "takes no value", flags); switch (opt->type) { + case OPTION_LOWLEVEL_CALLBACK: + return (*(parse_opt_ll_cb *)opt->callback)(p, opt, unset); + case OPTION_BIT: if (unset) *(int *)opt->value &= ~opt->defval; @@ -370,7 +373,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx, if (parse_nodash_opt(ctx, arg, options) == 0) continue; if (ctx->flags & PARSE_OPT_STOP_AT_NON_OPTION) - break; + return PARSE_OPT_NON_OPTION; ctx->out[ctx->cpidx++] = ctx->argv[0]; continue; } @@ -452,6 +455,7 @@ int parse_options(int argc, const char **argv, const char *prefix, switch (parse_options_step(&ctx, options, usagestr)) { case PARSE_OPT_HELP: exit(129); + case PARSE_OPT_NON_OPTION: case PARSE_OPT_DONE: break; default: /* PARSE_OPT_UNKNOWN */