diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-20 23:14:30 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-20 23:14:30 +0000 |
commit | e05724ff65a8b5e3b1dfb993a0726bab7b560c02 (patch) | |
tree | b9bb698c1d4490231aa31c8c252283a03d1e1946 /apps/app_playback.c | |
parent | 41e37ccb3586cc2caf7d592504d4ed7a52f5d397 (diff) |
More NEW_CLI conversions.
(issue #10724)
Patches:
app_playback.c.patch uploaded by moy (license 222)
app_minivm.c.patch uploaded by eliel (license 64)
astmm.c.patch uploaded by eliel (license 64)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@83381 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_playback.c')
-rw-r--r-- | apps/app_playback.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/apps/app_playback.c b/apps/app_playback.c index db9e0e1f8..01fafa7d6 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -75,14 +75,6 @@ static struct ast_config *say_cfg = NULL; static const void *say_api_buf[40]; static const char *say_old = "old"; static const char *say_new = "new"; -static const char say_load_usage[] = -"Usage: say load [new|old]\n" -" say load\n" -" Report status of current say mode\n" -" say load new\n" -" Set say method, configured in say.conf\n" -" say load old\n" -" Set old say metod, coded in asterisk core\n"; static void save_say_mode(const void *arg) { @@ -366,17 +358,31 @@ static int say_init_mode(char *mode) { } -static int __say_cli_init(int fd, int argc, char *argv[]) +static char *__say_cli_init(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { const char *old_mode = say_api_buf[0] ? say_new : say_old; char *mode; - - if (argc == 2) { - ast_cli(fd, "say mode is [%s]\n", old_mode); - return RESULT_SUCCESS; - } else if (argc != 3) - return RESULT_SHOWUSAGE; - mode = argv[2]; + switch (cmd) { + case CLI_INIT: + e->command = "say load [new|old]"; + e->usage = + "Usage: say load [new|old]\n" + " say load\n" + " Report status of current say mode\n" + " say load new\n" + " Set say method, configured in say.conf\n" + " say load old\n" + " Set old say metod, coded in asterisk core\n"; + return NULL; + case CLI_GENERATE: + return NULL; + } + if (a->argc == 2) { + ast_cli(a->fd, "say mode is [%s]\n", old_mode); + return CLI_SUCCESS; + } else if (a->argc != 3) + return CLI_SHOWUSAGE; + mode = a->argv[2]; if (!strcmp(mode, old_mode)) { ast_log(LOG_NOTICE, "say mode is %s already\n", mode); @@ -385,23 +391,13 @@ static int __say_cli_init(int fd, int argc, char *argv[]) ast_log(LOG_NOTICE, "init say.c from %s to %s\n", old_mode, mode); } } - - return RESULT_SUCCESS; + return CLI_SUCCESS; } - static struct ast_cli_entry cli_playback[] = { - { { "say", "load", NULL }, - __say_cli_init, "Set or show the say mode", - say_load_usage }, - - { { "say", "load", "new", NULL }, - __say_cli_init, "Set the say mode", - say_load_usage }, - - { { "say", "load", "old", NULL }, - __say_cli_init, "Set the say mode", - say_load_usage }, + NEW_CLI(__say_cli_init, "Set or show the say mode"), + NEW_CLI(__say_cli_init, "Set the say mode"), + NEW_CLI(__say_cli_init, "Set the say mode"), }; static int playback_exec(struct ast_channel *chan, void *data) |