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:
parent
7da3873056
commit
d73dc724ef
|
@ -1225,6 +1225,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
|
||||||
char *data, *indup;
|
char *data, *indup;
|
||||||
size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
|
size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
|
||||||
char *sub_val = NULL, *func_val = NULL;
|
char *sub_val = NULL, *func_val = NULL;
|
||||||
|
int nv = 0;
|
||||||
|
|
||||||
if (!in || !strchr(in, '$')) {
|
if (!in || !strchr(in, '$')) {
|
||||||
return in;
|
return in;
|
||||||
|
@ -1239,13 +1240,27 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
|
||||||
for (p = indup; *p; p++) {
|
for (p = indup; *p; p++) {
|
||||||
vtype = 0;
|
vtype = 0;
|
||||||
|
|
||||||
if (*p == '$') {
|
if (*p == '\\') {
|
||||||
|
if (*(p + 1) == '$') {
|
||||||
|
nv = 1;
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*p == '$' && !nv) {
|
||||||
vtype = 1;
|
vtype = 1;
|
||||||
if (*(p + 1) != '{') {
|
if (*(p + 1) != '{') {
|
||||||
vtype = 2;
|
vtype = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nv) {
|
||||||
|
*c++ = *p;
|
||||||
|
len++;
|
||||||
|
nv = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (vtype) {
|
if (vtype) {
|
||||||
char *s = p, *e, *vname, *vval = NULL;
|
char *s = p, *e, *vname, *vval = NULL;
|
||||||
size_t nlen;
|
size_t nlen;
|
||||||
|
|
Loading…
Reference in New Issue