ctdb-common: Add api to add new section/commands to cmdline
authorAmitay Isaacs <amitay@gmail.com>
Mon, 11 Nov 2019 06:32:50 +0000 (17:32 +1100)
committerMartin Schwenke <martins@samba.org>
Thu, 14 Nov 2019 10:38:34 +0000 (10:38 +0000)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/common/cmdline.c
ctdb/common/cmdline.h

index 0ce49b8311a37af5f4ad148faaa0f7e00f0177bc..fc4cb22f066059ec6e5a08bf6aa0640dcfd013c2 100644 (file)
@@ -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)
index f8c17940a90cd5460443d0859d2ca17827b13fbd..b9a128c2cc46f2c4a4c949b4d8efc5d288048c80 100644 (file)
@@ -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
  *