diff options
author | Amitay Isaacs <amitay@gmail.com> | 2019-11-11 17:32:50 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2019-11-14 10:38:34 +0000 |
commit | e469d6c1191ab9fa78e1ced6d7aa7b37dce7c5a9 (patch) | |
tree | a7a419be2668282e7cd20369e3edc159e030faf3 | |
parent | 977a6f7fad8d2985e8e898bd8dc7d3d376164e9d (diff) | |
download | samba-e469d6c1191ab9fa78e1ced6d7aa7b37dce7c5a9.tar.gz |
ctdb-common: Add api to add new section/commands to cmdline
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
-rw-r--r-- | ctdb/common/cmdline.c | 7 | ||||
-rw-r--r-- | ctdb/common/cmdline.h | 13 |
2 files changed, 20 insertions, 0 deletions
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 * |