aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer2array.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2006-10-06 02:25:58 +0000
committerWarren Dukes <warren.dukes@gmail.com>2006-10-06 02:25:58 +0000
commit1a51bfb84a9d3eb6c1ae891403ab237ee24a3b12 (patch)
treeb56334fc60d211804de71a63840593abba17d4b5 /src/buffer2array.c
parent00719544eb64bfb7d2aad119f571b4c4d4cad540 (diff)
downloadmpd-1a51bfb84a9d3eb6c1ae891403ab237ee24a3b12.tar.gz
mpd-1a51bfb84a9d3eb6c1ae891403ab237ee24a3b12.tar.xz
mpd-1a51bfb84a9d3eb6c1ae891403ab237ee24a3b12.zip
fix escaping in quotes. (Now phpMp works again!)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4872 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/buffer2array.c')
-rw-r--r--src/buffer2array.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/buffer2array.c b/src/buffer2array.c
index 5784ac931..29dfdbce8 100644
--- a/src/buffer2array.c
+++ b/src/buffer2array.c
@@ -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))