Index: apps/app_playback.c =================================================================== --- apps/app_playback.c (revision 83213) +++ apps/app_playback.c (working copy) @@ -75,14 +75,6 @@ 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_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 ( 2 == a->argc ) { + ast_cli(a->fd, "say mode is [%s]\n", old_mode); + return CLI_SUCCESS; + } else if ( 3 != a->argc ) + 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 @@ 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)