diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 14:45:29 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 14:45:29 +0000 |
commit | d57c5f9d0a22828a0098808fb1f4ec6994f0be38 (patch) | |
tree | cc7885bf1d179837ce797f2d2aa936b9205773ce /res | |
parent | 1545e6dfd505ebe19c52b41bd879fd7bf27bbfb2 (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: http://svn.digium.com/svn/asterisk/trunk@67697 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_features.c | 40 |
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 */ |