aboutsummaryrefslogtreecommitdiffstats
path: root/main/cli.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-15 16:20:23 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-15 16:20:23 +0000
commit10ba53709e77f01accf2b636d4998fed84df2a8b (patch)
tree16eb00a673c1a9d8a855ec4c7fcdd8e81f7fdf50 /main/cli.c
parentfd41174e4ac2000e7892ac366a60e5f6013ecbee (diff)
move another deprecated command to the new style
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47663 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c51
1 files changed, 13 insertions, 38 deletions
diff --git a/main/cli.c b/main/cli.c
index 1f5874914..aca498638 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -708,40 +708,6 @@ static int handle_commandcomplete(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int handle_debugchan_deprecated(int fd, int argc, char *argv[])
-{
- struct ast_channel *c=NULL;
- int is_all;
-
- /* 'debug channel {all|chan_id}' */
- if (argc != 4)
- return RESULT_SHOWUSAGE;
-
- is_all = !strcasecmp("all", argv[3]);
- if (is_all) {
- global_fin |= DEBUGCHAN_FLAG;
- global_fout |= DEBUGCHAN_FLAG;
- c = ast_channel_walk_locked(NULL);
- } else {
- c = ast_get_channel_by_name_locked(argv[3]);
- if (c == NULL)
- ast_cli(fd, "No such channel %s\n", argv[3]);
- }
- while (c) {
- if (!(c->fin & DEBUGCHAN_FLAG) || !(c->fout & DEBUGCHAN_FLAG)) {
- c->fin |= DEBUGCHAN_FLAG;
- c->fout |= DEBUGCHAN_FLAG;
- ast_cli(fd, "Debugging enabled on channel %s\n", c->name);
- }
- ast_channel_unlock(c);
- if (!is_all)
- break;
- c = ast_channel_walk_locked(c);
- }
- ast_cli(fd, "Debugging on new channels is enabled\n");
- return RESULT_SUCCESS;
-}
-
static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_channel *c = NULL;
@@ -805,6 +771,18 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str
return RESULT_SUCCESS;
}
+static char *handle_debugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char *res;
+
+ if (cmd == CLI_HANDLER && a->argc != e->args + 1)
+ return CLI_SHOWUSAGE;
+ res = handle_core_set_debug_channel(e, cmd, a);
+ if (cmd == CLI_INIT)
+ e->command = "debug channel";
+ return res;
+}
+
static char *handle_nodebugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char *res;
@@ -1071,10 +1049,7 @@ static struct ast_cli_entry builtins[] = {
{ { NULL }, NULL, NULL, NULL }
};
-static struct ast_cli_entry cli_debug_channel_deprecated = {
- { "debug", "channel", NULL },
- handle_debugchan_deprecated, NULL,
- NULL, complete_ch_3 };
+static struct ast_cli_entry cli_debug_channel_deprecated = NEW_CLI(handle_debugchan_deprecated, "Enable debugging on channel");
static struct ast_cli_entry cli_module_load_deprecated = {
{ "load", NULL },