You'd need something like this on top. Documentation/technical/api-parse-options says that non-zero return is used to signal an error. parse-options.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/parse-options.c b/parse-options.c index 132d34c..71a8056 100644 --- a/parse-options.c +++ b/parse-options.c @@ -94,14 +94,14 @@ static int get_value(struct parse_opt_ctx_t *p, case OPTION_CALLBACK: if (unset) - return (*opt->callback)(opt, NULL, 1); + return (*opt->callback)(opt, NULL, 1) ? (-1) : 0; if (opt->flags & PARSE_OPT_NOARG) - return (*opt->callback)(opt, NULL, 0); + return (*opt->callback)(opt, NULL, 0) ? (-1) : 0; if (opt->flags & PARSE_OPT_OPTARG && !p->opt) - return (*opt->callback)(opt, NULL, 0); + return (*opt->callback)(opt, NULL, 0) ? (-1) : 0; if (!arg) return opterror(opt, "requires a value", flags); - return (*opt->callback)(opt, get_arg(p), 0); + return (*opt->callback)(opt, get_arg(p), 0) ? (-1) : 0; case OPTION_INTEGER: if (unset) { @@ -276,9 +276,9 @@ int parse_options_step(struct parse_opt_ctx_t *ctx, if (*ctx->opt == 'h') return parse_options_usage(usagestr, options); switch (parse_short_opt(ctx, options)) { - case -1: + case -1: return parse_options_usage(usagestr, options); - case -2: + case -2: goto unknown_fixup; } if (ctx->opt) @@ -318,9 +318,9 @@ unknown_fixup: if (!strcmp(arg + 2, "help")) return parse_options_usage(usagestr, options); switch (parse_long_opt(ctx, arg + 2, options)) { - case -1: + case -1: return parse_options_usage(usagestr, options); - case -2: + case -2: return PARSE_OPT_UNKNOWN; } } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html