fix escaping in quotes. (Now phpMp works again!)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4872 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
00719544eb
commit
1a51bfb84a
@ -38,22 +38,16 @@ int buffer2array(char *buffer, char *array[], const int max)
|
|||||||
|
|
||||||
while (*c != '\0' && i < max) {
|
while (*c != '\0' && i < max) {
|
||||||
if (*c == '\"') {
|
if (*c == '\"') {
|
||||||
int escape = 0;
|
|
||||||
array[i++] = ++c;
|
array[i++] = ++c;
|
||||||
while (*c != '\0') {
|
while (*c != '\0') {
|
||||||
if (*c == '\"') {
|
if (*c == '\"') {
|
||||||
if (escape) {
|
*(c++) = '\0';
|
||||||
memmove(c - 1, c,
|
break;
|
||||||
strlen(c) + 1);
|
}
|
||||||
if (*c == '"')
|
else if (*(c++) == '\\') {
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
*(c++) = '\0';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (*c == '\\' && escape)
|
|
||||||
memmove(c - 1, c, strlen(c) + 1);
|
memmove(c - 1, c, strlen(c) + 1);
|
||||||
escape = (*(c++) != '\\') ? 0 : !escape;
|
++c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (isWhiteSpace(*c))
|
while (isWhiteSpace(*c))
|
||||||
|
Loading…
Reference in New Issue
Block a user