allow double escape in parser for \

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16440 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2010-01-21 19:59:28 +00:00
parent bb19f24a40
commit 14f0ebf3b5
1 changed files with 8 additions and 1 deletions

View File

@ -1571,6 +1571,9 @@ static char unescape_char(char escaped)
case 's': case 's':
unescaped = ' '; unescaped = ' ';
break; break;
case '\\':
unescaped = 1; /* 1 means double esc */
break;
default: default:
unescaped = escaped; unescaped = escaped;
} }
@ -1644,7 +1647,11 @@ static char *cleanup_separated_string(char *str, char delim)
e = *(ptr + 1); e = *(ptr + 1);
if (e == '\'' || e == '"' || (delim && e == delim) || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) { if (e == '\'' || e == '"' || (delim && e == delim) || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) {
++ptr; ++ptr;
*dest++ = e; if (e == 1) {
*dest++ = '\\';
} else {
*dest++ = e;
}
end = dest; end = dest;
esc++; esc++;
} }