[asterisk-commits] trunk - r8079 /trunk/app.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Jan 15 11:02:47 MST 2006


Author: tilghman
Date: Sun Jan 15 12:02:46 2006
New Revision: 8079

URL: http://svn.digium.com/view/asterisk?rev=8079&view=rev
Log:
Allow application arguments to be quoted, allowing '|' characters inside arguments

Modified:
    trunk/app.c

Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=8079&r1=8078&r2=8079&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Sun Jan 15 12:02:46 2006
@@ -1109,7 +1109,7 @@
 {
 	int argc;
 	char *scan;
-	int paren = 0;
+	int paren = 0, quote = 0;
 
 	if (!buf || !array || !arraylen)
 		return 0;
@@ -1126,7 +1126,15 @@
 			else if (*scan == ')') {
 				if (paren)
 					paren--;
-			} else if ((*scan == delim) && !paren) {
+			} else if (*scan == '"') {
+				quote = quote ? 0 : 1;
+				/* Remove quote character from argument */
+				memmove(scan, scan + 1, strlen(scan));
+				scan--;
+			} else if (*scan == '\\') {
+				/* Literal character, don't parse */
+				memmove(scan, scan + 1, strlen(scan));
+			} else if ((*scan == delim) && !paren && !quote) {
 				*scan++ = '\0';
 				break;
 			}



More information about the asterisk-commits mailing list