[svn-commits] tilghman: branch 1.6.0 r120905 - in /branches/1.6.0: ./ apps/app_exec.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 6 12:35:03 CDT 2008


Author: tilghman
Date: Fri Jun  6 12:35:03 2008
New Revision: 120905

URL: http://svn.digium.com/view/asterisk?view=rev&rev=120905
Log:
Merged revisions 120904 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r120904 | tilghman | 2008-06-06 12:34:21 -0500 (Fri, 06 Jun 2008) | 3 lines

For the purpose of making the changed syntax to ExecIf easier to transition,
allow the deprecated syntax (fixed for jmls on -dev).

........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_exec.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_exec.c?view=diff&rev=120905&r1=120904&r2=120905
==============================================================================
--- branches/1.6.0/apps/app_exec.c (original)
+++ branches/1.6.0/apps/app_exec.c Fri Jun  6 12:35:03 2008
@@ -148,7 +148,7 @@
 static int execif_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	char *truedata = NULL, *falsedata = NULL, *end;
+	char *truedata = NULL, *falsedata = NULL, *end, *firstcomma, *firstquestion;
 	struct ast_app *app = NULL;
 	AST_DECLARE_APP_ARGS(expr,
 		AST_APP_ARG(expr);
@@ -160,24 +160,49 @@
 	);
 	char *parse = ast_strdupa(data);
 
-	AST_NONSTANDARD_APP_ARGS(expr, parse, '?');
-	if (ast_strlen_zero(expr.remainder)) {
-		ast_log(LOG_ERROR, "Usage: ExecIf(<expr>?<appiftrue>(<args>)[:<appiffalse>(<args)])\n");
-		return -1;
-	}
-
-	AST_NONSTANDARD_APP_ARGS(apps, expr.remainder, ':');
-
-	if (apps.t && (truedata = strchr(apps.t, '('))) {
-		*truedata++ = '\0';
-		if ((end = strrchr(truedata, ')')))
-			*end = '\0';
-	}
-
-	if (apps.f && (falsedata = strchr(apps.f, '('))) {
-		*falsedata++ = '\0';
-		if ((end = strrchr(falsedata, ')')))
-			*end = '\0';
+	firstcomma = strchr(parse, ',');
+	firstquestion = strchr(parse, '?');
+
+	if ((firstcomma != NULL && firstquestion != NULL && firstcomma < firstquestion) || (firstquestion == NULL)) {
+		/* Deprecated syntax */
+		AST_DECLARE_APP_ARGS(depr,
+			AST_APP_ARG(expr);
+			AST_APP_ARG(appname);
+			AST_APP_ARG(appargs);
+		);
+		AST_STANDARD_APP_ARGS(depr, parse);
+
+		ast_log(LOG_WARNING, "Deprecated syntax found.  Please upgrade to using ExecIf(<expr>?%s(%s))\n", depr.appname, depr.appargs);
+
+		/* Make the two syntaxes look the same */
+		expr.expr = depr.expr;
+		apps.t = depr.appname;
+		apps.f = NULL;
+		truedata = depr.appargs;
+	} else {
+		/* Preferred syntax */
+
+		AST_NONSTANDARD_APP_ARGS(expr, parse, '?');
+		if (ast_strlen_zero(expr.remainder)) {
+			ast_log(LOG_ERROR, "Usage: ExecIf(<expr>?<appiftrue>(<args>)[:<appiffalse>(<args)])\n");
+			return -1;
+		}
+
+		AST_NONSTANDARD_APP_ARGS(apps, expr.remainder, ':');
+
+		if (apps.t && (truedata = strchr(apps.t, '('))) {
+			*truedata++ = '\0';
+			if ((end = strrchr(truedata, ')'))) {
+				*end = '\0';
+			}
+		}
+
+		if (apps.f && (falsedata = strchr(apps.f, '('))) {
+			*falsedata++ = '\0';
+			if ((end = strrchr(falsedata, ')'))) {
+				*end = '\0';
+			}
+		}
 	}
 
 	if (pbx_checkcondition(expr.expr)) {




More information about the svn-commits mailing list