summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-06-06 14:45:29 +0000
committerRussell Bryant <russell@russellbryant.com>2007-06-06 14:45:29 +0000
commit6ddcfff1c7768cf1f617bb905929fe9f60d6751f (patch)
treecc7885bf1d179837ce797f2d2aa936b9205773ce /res
parent40df1fb4647f2c1c4b47ff04717cb36b17f6de9b (diff)
Change "show parkedcalls" to "parkedcalls show" and mark the previous command
as deprecated. Also, convert the CLI command to the new style. (issue #9861, patch from eliel) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_features.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/res/res_features.c b/res/res_features.c
index 5efc9e839..7c240a7ef 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -2398,42 +2398,60 @@ static char showfeatures_help[] =
"Usage: feature list\n"
" Lists currently configured features.\n";
-static int handle_parkedcalls(int fd, int argc, char *argv[])
+static char *handle_parkedcalls(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct parkeduser *cur;
int numparked = 0;
- ast_cli(fd, "%4s %25s (%-15s %-12s %-4s) %-6s \n", "Num", "Channel"
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "parkedcalls show";
+ e->usage =
+ "Usage: parkedcalls show\n"
+ " List currently parked calls\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc > e->args)
+ return CLI_SHOWUSAGE;
+
+ ast_cli(a->fd, "%4s %25s (%-15s %-12s %-4s) %-6s \n", "Num", "Channel"
, "Context", "Extension", "Pri", "Timeout");
ast_mutex_lock(&parking_lock);
for (cur = parkinglot; cur; cur = cur->next) {
- ast_cli(fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
+ ast_cli(a->fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
,cur->parkingexten, cur->chan->name, cur->context, cur->exten
,cur->priority, cur->start.tv_sec + (cur->parkingtime/1000) - time(NULL));
numparked++;
}
ast_mutex_unlock(&parking_lock);
- ast_cli(fd, "%d parked call%s.\n", numparked, ESS(numparked));
+ ast_cli(a->fd, "%d parked call%s.\n", numparked, ESS(numparked));
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
+}
+
+static char *handle_parkedcalls_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char *res = handle_parkedcalls(e, cmd, a);
+ if (cmd == CLI_INIT)
+ e->command = "show parkedcalls";
+ return res;
}
-static char showparked_help[] =
-"Usage: show parkedcalls\n"
-" Lists currently parked calls.\n";
+static struct ast_cli_entry cli_show_parkedcalls_deprecated = NEW_CLI(handle_parkedcalls_deprecated, "List currently parked calls.");
static struct ast_cli_entry cli_features[] = {
{ { "feature", "show", NULL },
handle_showfeatures, "Lists configured features",
showfeatures_help },
- { { "show", "parkedcalls", NULL },
- handle_parkedcalls, "Lists parked calls",
- showparked_help },
+ NEW_CLI(handle_parkedcalls, "List currently parked calls", .deprecate_cmd = &cli_show_parkedcalls_deprecated),
};
/*! \brief Dump lot status */