From 8b74d75cd26d28d38d2ff88267585fc308b89cef Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 6 Mar 2010 21:34:40 +0100 Subject: parse-options: add parse_options_concat() to concat options Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- parse-options.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'parse-options.c') diff --git a/parse-options.c b/parse-options.c index c83035d01..8546d8526 100644 --- a/parse-options.c +++ b/parse-options.c @@ -659,3 +659,18 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset) *target = unset ? 2 : 1; return 0; } + +int parse_options_concat(struct option *dst, size_t dst_size, struct option *src) +{ + int i, j; + + for (i = 0; i < dst_size; i++) + if (dst[i].type == OPTION_END) + break; + for (j = 0; i < dst_size; i++, j++) { + dst[i] = src[j]; + if (src[j].type == OPTION_END) + return 0; + } + return -1; +} -- cgit v1.2.1