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:
Warren Dukes 2006-10-06 02:25:58 +00:00
parent 00719544eb
commit 1a51bfb84a

View File

@ -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))