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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index a3de795..1240a85 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -159,6 +159,23 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
return 0;
}
+struct option *parse_options_dup(const struct option *o)
+{
+ struct option *opts;
+ int nr = 0;
+
+ while (o && o->type != OPTION_END) {
+ nr++;
+ o++;
+ }
+
+ ALLOC_ARRAY(opts, nr + 1);
+ memcpy(opts, o - nr, sizeof(*o) * 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;