aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse-options.c3
-rw-r--r--parse-options.h8
2 files changed, 10 insertions, 1 deletions
diff --git a/parse-options.c b/parse-options.c
index 632c1346c..cd9268691 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;
diff --git a/parse-options.h b/parse-options.h
index 5eb499b99..470bb3329 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -17,6 +17,7 @@ enum parse_opt_type {
OPTION_STRING,
OPTION_INTEGER,
OPTION_CALLBACK,
+ OPTION_LOWLEVEL_CALLBACK,
OPTION_FILENAME
};
@@ -43,6 +44,10 @@ enum parse_opt_option_flags {
struct option;
typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
+struct parse_opt_ctx_t;
+typedef int parse_opt_ll_cb(struct parse_opt_ctx_t *ctx,
+ const struct option *opt, int unset);
+
/*
* `type`::
* holds the type of the option, you must have an OPTION_END last in your
@@ -87,7 +92,8 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
* useful for users of OPTION_NEGBIT.
*
* `callback`::
- * pointer to the callback to use for OPTION_CALLBACK.
+ * pointer to the callback to use for OPTION_CALLBACK or
+ * OPTION_LOWLEVEL_CALLBACK.
*
* `defval`::
* default value to fill (*->value) with for PARSE_OPT_OPTARG.