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) {
|
||||
if (*c == '\"') {
|
||||
int escape = 0;
|
||||
array[i++] = ++c;
|
||||
while (*c != '\0') {
|
||||
if (*c == '\"') {
|
||||
if (escape) {
|
||||
memmove(c - 1, c,
|
||||
strlen(c) + 1);
|
||||
if (*c == '"')
|
||||
break;
|
||||
} else {
|
||||
*(c++) = '\0';
|
||||
break;
|
||||
}
|
||||
} else if (*c == '\\' && escape)
|
||||
*(c++) = '\0';
|
||||
break;
|
||||
}
|
||||
else if (*(c++) == '\\') {
|
||||
memmove(c - 1, c, strlen(c) + 1);
|
||||
escape = (*(c++) != '\\') ? 0 : !escape;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (isWhiteSpace(*c))
|
||||
|
Loading…
Reference in New Issue
Block a user