[Freeswitch-svn] [commit] r4995 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Sat Apr 21 10:17:44 EDT 2007


Author: anthm
Date: Sat Apr 21 10:17:43 2007
New Revision: 4995

Modified:
   freeswitch/trunk/src/switch_channel.c

Log:
add backslash escape char in channel variable expansion

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Sat Apr 21 10:17:43 2007
@@ -1225,6 +1225,7 @@
 	char *data, *indup;
 	size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
 	char *sub_val = NULL, *func_val = NULL;
+	int nv = 0;
 
 	if (!in || !strchr(in, '$')) {
 		return in;
@@ -1239,13 +1240,27 @@
 		for (p = indup; *p; p++) {
 			vtype = 0;
 
-			if (*p == '$') {
+			if (*p == '\\') {
+				if (*(p + 1) == '$') {
+					nv = 1;
+				}
+				p++;
+			}
+
+			if (*p == '$' && !nv) {
 				vtype = 1;
 				if (*(p + 1) != '{') {
 					vtype = 2;
 				}
 			}
 
+			if (nv) {
+				*c++ = *p;
+				len++;
+				nv = 0;
+				continue;
+			}
+
 			if (vtype) {
 				char *s = p, *e, *vname, *vval = NULL;
 				size_t nlen;



More information about the Freeswitch-svn mailing list