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: https://origsvn.digium.com/svn/asterisk/trunk@83381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker
2007-09-20 23:14:30 +00:00
parent dd3ef30d67
commit 857f785a40
3 changed files with 252 additions and 222 deletions

View File

@@ -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)