summaryrefslogtreecommitdiff
path: root/pbx/pbx_ael.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-10-11 19:03:06 +0000
committerRussell Bryant <russell@russellbryant.com>2007-10-11 19:03:06 +0000
commite97a723cf1710d0c40bcbe7ac53fc943abedd2c4 (patch)
tree44dcb2c14abed6932db4f248b17626a01a38f59b /pbx/pbx_ael.c
parent8a52c889883f2013e377d87389f07aec5b781122 (diff)
Merge a ton of NEW_CLI conversions. Thanks to everyone that helped out! :)
(closes issue #10724) Reported by: eliel Patches: chan_skinny.c.patch uploaded by eliel (license 64) chan_oss.c.patch uploaded by eliel (license 64) chan_mgcp.c.patch2 uploaded by eliel (license 64) pbx_config.c.patch uploaded by seanbright (license 71) iax2-provision.c.patch uploaded by eliel (license 64) chan_gtalk.c.patch uploaded by eliel (license 64) pbx_ael.c.patch uploaded by seanbright (license 71) file.c.patch uploaded by seanbright (license 71) image.c.patch uploaded by seanbright (license 71) cli.c.patch uploaded by moy (license 222) astobj2.c.patch uploaded by moy (license 222) asterisk.c.patch uploaded by moy (license 222) res_limit.c.patch uploaded by seanbright (license 71) res_convert.c.patch uploaded by seanbright (license 71) res_crypto.c.patch uploaded by seanbright (license 71) app_osplookup.c.patch uploaded by seanbright (license 71) app_rpt.c.patch uploaded by seanbright (license 71) app_mixmonitor.c.patch uploaded by seanbright (license 71) channel.c.patch uploaded by seanbright (license 71) translate.c.patch uploaded by seanbright (license 71) udptl.c.patch uploaded by seanbright (license 71) threadstorage.c.patch uploaded by seanbright (license 71) db.c.patch uploaded by seanbright (license 71) cdr.c.patch uploaded by moy (license 222) pbd_dundi.c.patch uploaded by moy (license 222) app_osplookup-rev83558.patch uploaded by moy (license 222) res_clioriginate.c.patch uploaded by moy (license 222) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85460 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx/pbx_ael.c')
-rw-r--r--pbx/pbx_ael.c93
1 files changed, 45 insertions, 48 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index 68902a073..f5a54f0bf 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -948,65 +948,62 @@ static int pbx_load_module(void)
}
/* CLI interface */
-static int ael2_debug_read(int fd, int argc, char *argv[])
+static char *handle_cli_ael_debug_multiple(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- aeldebug |= DEBUG_READ;
- return 0;
-}
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ael debug [read|tokens|macros|contexts|off]";
+ e->usage =
+ "Usage: ael debug [read|tokens|macros|contexts|off]\n"
+ " Enable AEL read, token, macro, or context debugging,\n"
+ " or disable all AEL debugging messages. Note: this\n"
+ " currently does nothing.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
-static int ael2_debug_tokens(int fd, int argc, char *argv[])
-{
- aeldebug |= DEBUG_TOKENS;
- return 0;
-}
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ if (!strcasecmp(a->argv[2], "read"))
+ aeldebug |= DEBUG_READ;
+ else if (!strcasecmp(a->argv[2], "tokens"))
+ aeldebug |= DEBUG_TOKENS;
+ else if (!strcasecmp(a->argv[2], "macros"))
+ aeldebug |= DEBUG_MACROS;
+ else if (!strcasecmp(a->argv[2], "contexts"))
+ aeldebug |= DEBUG_CONTEXTS;
+ else if (!strcasecmp(a->argv[2], "off"))
+ aeldebug = 0;
+ else
+ return CLI_SHOWUSAGE;
-static int ael2_debug_macros(int fd, int argc, char *argv[])
-{
- aeldebug |= DEBUG_MACROS;
- return 0;
+ return CLI_SUCCESS;
}
-static int ael2_debug_contexts(int fd, int argc, char *argv[])
+static char *handle_cli_ael_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- aeldebug |= DEBUG_CONTEXTS;
- return 0;
-}
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ael reload";
+ e->usage =
+ "Usage: ael reload\n"
+ " Reloads AEL configuration.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
-static int ael2_no_debug(int fd, int argc, char *argv[])
-{
- aeldebug = 0;
- return 0;
-}
+ if (a->argc != 2)
+ return CLI_SHOWUSAGE;
-static int ael2_reload(int fd, int argc, char *argv[])
-{
- return (pbx_load_module());
+ return (pbx_load_module() ? CLI_FAILURE : CLI_SUCCESS);
}
-static struct ast_cli_entry cli_ael_no_debug = {
- { "ael", "no", "debug", NULL },
- ael2_no_debug, NULL,
- NULL };
-
static struct ast_cli_entry cli_ael[] = {
- { { "ael", "reload", NULL },
- ael2_reload, "Reload AEL configuration" },
-
- { { "ael", "debug", "read", NULL },
- ael2_debug_read, "Enable AEL read debug (does nothing)" },
-
- { { "ael", "debug", "tokens", NULL },
- ael2_debug_tokens, "Enable AEL tokens debug (does nothing)" },
-
- { { "ael", "debug", "macros", NULL },
- ael2_debug_macros, "Enable AEL macros debug (does nothing)" },
-
- { { "ael", "debug", "contexts", NULL },
- ael2_debug_contexts, "Enable AEL contexts debug (does nothing)" },
-
- { { "ael", "nodebug", NULL },
- ael2_no_debug, "Disable AEL debug messages",
- NULL, NULL, &cli_ael_no_debug },
+ NEW_CLI(handle_cli_ael_reload, "Reload AEL configuration"),
+ NEW_CLI(handle_cli_ael_debug_multiple, "Enable AEL debugging flags")
};
static int unload_module(void)