add backslash escape char in channel variable expansion

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4995 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-04-21 14:17:43 +00:00
parent 7da3873056
commit d73dc724ef
1 changed files with 16 additions and 1 deletions

View File

@ -1225,6 +1225,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
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 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
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;