diff options
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r-- | parse-options-cb.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c index 26a4c7d08a..298decf48f 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -210,24 +210,25 @@ int parse_opt_string_list(const struct option *opt, const char *arg, int unset) return 0; } -int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset) +int parse_opt_strvec(const struct option *opt, const char *arg, int unset) { + struct strvec *v = opt->value; + + if (unset) { + strvec_clear(v); + return 0; + } + + if (!arg) + return -1; + + strvec_push(v, arg); return 0; } -/** - * Report that the option is unknown, so that other code can handle - * it. This can be used as a callback together with - * OPTION_LOWLEVEL_CALLBACK to allow an option to be documented in the - * "-h" output even if it's not being handled directly by - * parse_options(). - */ -enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, - const struct option *opt, - const char *arg, int unset) +int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset) { - BUG_ON_OPT_ARG(arg); - return PARSE_OPT_UNKNOWN; + return 0; } /** |