From: Amitay Isaacs Date: Mon, 11 Nov 2019 06:32:50 +0000 (+1100) Subject: ctdb-common: Add api to add new section/commands to cmdline X-Git-Tag: talloc-2.3.1~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e469d6c1191ab9fa78e1ced6d7aa7b37dce7c5a9;p=thirdparty%2Fsamba.git ctdb-common: Add api to add new section/commands to cmdline Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c index 0ce49b8311a..fc4cb22f066 100644 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@ -326,6 +326,13 @@ static int cmdline_context_destructor(struct cmdline_context *cmdline) return 0; } +int cmdline_add(struct cmdline_context *cmdline, + const char *name, + struct cmdline_command *commands) +{ + return cmdline_section_add(cmdline, name, commands); +} + static int cmdline_parse_options(struct cmdline_context *cmdline, int argc, const char **argv) diff --git a/ctdb/common/cmdline.h b/ctdb/common/cmdline.h index f8c17940a90..b9a128c2cc4 100644 --- a/ctdb/common/cmdline.h +++ b/ctdb/common/cmdline.h @@ -99,6 +99,19 @@ int cmdline_init(TALLOC_CTX *mem_ctx, struct cmdline_command *commands, struct cmdline_context **result); + +/** + * @brief Add command line section/commands + * + * @param[in] cmdline Cmdline context + * @param[in] section Name of section grouping specified commands + * @param[in] commands Commands array + * @return 0 on success, errno on failure + */ +int cmdline_add(struct cmdline_context *cmdline, + const char *section, + struct cmdline_command *commands); + /** * @brief Parse command line options and commands/arguments *