From fd0b69a4e7f57297f9c011c75820432d693e21a5 Mon Sep 17 00:00:00 2001 From: tilghman Date: Mon, 23 Jul 2007 19:51:41 +0000 Subject: Merge the dialplan_aesthetics branch. Most of this patch simply converts applications using old methods of parsing arguments to using the standard macros. However, the big change is that the really old way of specifying application and arguments separated by a comma will no longer work (e.g. NoOp,foo|bar). Instead, the way that has been recommended since long before 1.0 will become the only method available (e.g. NoOp(foo,bar). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76703 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_externalivr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apps/app_externalivr.c') diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 63c182337..31cdafd0a 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -58,7 +58,7 @@ static const char *app = "ExternalIVR"; static const char *synopsis = "Interfaces with an external IVR application"; static const char *descrip = -" ExternalIVR(command[|arg[|arg...]]): Forks an process to run the supplied command,\n" +" ExternalIVR(command[,arg[,arg...]]): Forks an process to run the supplied command,\n" "and starts a generator on the channel. The generator's play list is\n" "controlled by the external application, which can add and clear entries\n" "via simple commands issued over its stdout. The external application\n" @@ -244,7 +244,6 @@ static struct playlist_entry *make_entry(const char *filename) static int app_exec(struct ast_channel *chan, void *data) { struct playlist_entry *entry; - const char *args = data; int child_stdin[2] = { 0,0 }; int child_stdout[2] = { 0,0 }; int child_stderr[2] = { 0,0 }; @@ -252,7 +251,6 @@ static int app_exec(struct ast_channel *chan, void *data) int gen_active = 0; int pid; char *argv[32]; - int argc = 1; char *buf, *command; FILE *child_commands = NULL; FILE *child_errors = NULL; @@ -263,6 +261,9 @@ static int app_exec(struct ast_channel *chan, void *data) }; struct ivr_localuser *u = &foo; sigset_t fullset, oldset; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(cmd)[32]; + ); sigfillset(&fullset); pthread_sigmask(SIG_BLOCK, &fullset, &oldset); @@ -270,14 +271,13 @@ static int app_exec(struct ast_channel *chan, void *data) u->abort_current_sound = 0; u->chan = chan; - if (ast_strlen_zero(args)) { + if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n"); return -1; } buf = ast_strdupa(data); - - argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0])); + AST_STANDARD_APP_ARGS(args, buf); if (pipe(child_stdin)) { ast_chan_log(LOG_WARNING, chan, "Could not create pipe for child input: %s\n", strerror(errno)); -- cgit v1.2.3