[asterisk-commits] qwell: trunk r94814 - /trunk/apps/app_exec.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 26 16:14:21 CST 2007


Author: qwell
Date: Wed Dec 26 16:14:21 2007
New Revision: 94814

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94814
Log:
Make 'else' argument to ExecIf optional.  Clean up the description and usage text a bit.

Closes issue #11564, patch by pnlarsson (with some extra cleanup by me).

Modified:
    trunk/apps/app_exec.c

Modified: trunk/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_exec.c?view=diff&rev=94814&r1=94813&r2=94814
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Wed Dec 26 16:14:21 2007
@@ -77,9 +77,9 @@
 static char *app_execif = "ExecIf";
 static char *execif_synopsis = "Executes dialplan application, conditionally";
 static char *execif_descrip = 
-"  ExecIF (<expr>?<app>(<data>):<app2>(<data2>))\n"
-"If <expr> is true, execute and return the result of <app>(<data>).\n"
-"If <expr> is true, but <app> is not found, then the application\n"
+"  ExecIF (<expr>?<appiftrue>(<args>)[:<appiffalse>(<args>)])\n"
+"If <expr> is true, execute and return the result of <appiftrue>(<args>).\n"
+"If <expr> is true, but <appiftrue> is not found, then the application\n"
 "will return a non-zero value.\n";
 
 static int exec_exec(struct ast_channel *chan, void *data)
@@ -162,7 +162,7 @@
 
 	AST_NONSTANDARD_APP_ARGS(expr, parse, '?');
 	if (ast_strlen_zero(expr.remainder)) {
-		ast_log(LOG_ERROR, "Usage: ExecIf(<cond>?<appiftrue>(<args>):<appiffalse>(<args))\n");
+		ast_log(LOG_ERROR, "Usage: ExecIf(<expr>?<appiftrue>(<args>)[:<appiffalse>(<args)])\n");
 		return -1;
 	}
 
@@ -187,8 +187,8 @@
 			ast_log(LOG_WARNING, "Could not find application! (%s)\n", apps.t);
 			res = -1;
 		}
-	} else {
-		if (!ast_strlen_zero(apps.f) && (app = pbx_findapp(apps.f))) {
+	} else if (!ast_strlen_zero(apps.f)) {
+		if ((app = pbx_findapp(apps.f))) {
 			res = pbx_exec(chan, app, S_OR(falsedata, ""));
 		} else {
 			ast_log(LOG_WARNING, "Could not find application! (%s)\n", apps.f);




More information about the asterisk-commits mailing list