summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index a3de795..c2062ae 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -159,6 +159,24 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
return 0;
}
+struct option *parse_options_dup(const struct option *o)
+{
+ const struct option *orig = o;
+ struct option *opts;
+ int nr = 0;
+
+ while (o && o->type != OPTION_END) {
+ nr++;
+ o++;
+ }
+
+ ALLOC_ARRAY(opts, nr + 1);
+ COPY_ARRAY(opts, orig, nr);
+ memset(opts + nr, 0, sizeof(*opts));
+ opts[nr].type = OPTION_END;
+ return opts;
+}
+
struct option *parse_options_concat(struct option *a, struct option *b)
{
struct option *ret;