use ast_cli_register_multiple() for pbx CLI commands
authorKevin P. Fleming <kpfleming@digium.com>
Fri, 3 Jun 2005 03:09:20 +0000 (03:09 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Fri, 3 Jun 2005 03:09:20 +0000 (03:09 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5829 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c

diff --git a/pbx.c b/pbx.c
index 02b22ed..11df388 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -3530,47 +3530,23 @@ static int handle_show_dialplan(int fd, int argc, char *argv[])
 /*
  * CLI entries for upper commands ...
  */
-static struct ast_cli_entry show_applications_cli = 
-       { { "show", "applications", NULL }, 
-       handle_show_applications, "Shows registered dialplan applications",
-       show_applications_help, complete_show_applications };
-
-static struct ast_cli_entry show_functions_cli = {
-       { "show", "functions", NULL }, 
-       handle_show_functions,
-       "Shows registered dialplan functions",
-       show_functions_help,
+static struct ast_cli_entry pbx_cli[] = {
+       { { "show", "applications", NULL }, handle_show_applications,
+         "Shows registered dialplan applications", show_applications_help, complete_show_applications },
+       { { "show", "functions", NULL }, handle_show_functions,
+         "Shows registered dialplan functions", show_functions_help },
+       { { "show" , "function", NULL }, handle_show_function,
+         "Describe a specific dialplan function", show_function_help, complete_show_function },
+       { { "show", "application", NULL }, handle_show_application,
+         "Describe a specific dialplan application", show_application_help, complete_show_application },
+       { { "show", "dialplan", NULL }, handle_show_dialplan,
+         "Show dialplan", show_dialplan_help, complete_show_dialplan_context },
+       { { "show", "switches", NULL }, handle_show_switches,
+         "Show alternative switches", show_switches_help },
+       { { "show", "hints", NULL }, handle_show_hints,
+         "Show dialplan hints", show_hints_help },
 };
 
-static struct ast_cli_entry show_function_cli = {
-       { "show" , "function", NULL },
-       handle_show_function,
-       "Describe a specific dialplan function",
-       show_function_help,
-       complete_show_function,
-};
-
-static struct ast_cli_entry show_application_cli =
-       { { "show", "application", NULL }, 
-       handle_show_application, "Describe a specific dialplan application",
-       show_application_help, complete_show_application };
-
-static struct ast_cli_entry show_dialplan_cli =
-       { { "show", "dialplan", NULL },
-               handle_show_dialplan, "Show dialplan",
-               show_dialplan_help, complete_show_dialplan_context };
-
-static struct ast_cli_entry show_switches_cli =
-       { { "show", "switches", NULL },
-               handle_show_switches, "Show alternative switches",
-               show_switches_help, NULL };
-
-static struct ast_cli_entry show_hints_cli =
-       { { "show", "hints", NULL },
-               handle_show_hints, "Show dialplan hints",
-               show_hints_help, NULL };
-
-
 int ast_unregister_application(const char *app) {
        struct ast_app *tmp, *tmpl = NULL;
        if (ast_mutex_lock(&applock)) {
@@ -5990,13 +5966,7 @@ int load_pbx(void)
                ast_verbose( "Registering builtin applications:\n");
        }
        AST_LIST_HEAD_INIT(&globals);
-       ast_cli_register(&show_applications_cli);
-       ast_cli_register(&show_function_cli);
-       ast_cli_register(&show_functions_cli);
-       ast_cli_register(&show_application_cli);
-       ast_cli_register(&show_dialplan_cli);
-       ast_cli_register(&show_switches_cli);
-       ast_cli_register(&show_hints_cli);
+       ast_cli_register_multiple(pbx_cli, sizeof(pbx_cli) / sizeof(pbx_cli[0]));
 
        /* Register builtin applications */
        for (x=0; x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) {