Fix a nesting bug
Before, strings such as @n@!_filename@@m wouldn't be parsed correctly because of that '@@' in there.
This commit is contained in:
19
src/parse.c
19
src/parse.c
@@ -181,7 +181,7 @@ autoescapeend:
|
|||||||
/* read nest data into a string */
|
/* read nest data into a string */
|
||||||
while (i < data->len) {
|
while (i < data->len) {
|
||||||
int c;
|
int c;
|
||||||
c = data->data[i++];
|
c = data->data[i++];
|
||||||
if (c != ESCAPE_CHAR) {
|
if (c != ESCAPE_CHAR) {
|
||||||
appendchar(buff, c);
|
appendchar(buff, c);
|
||||||
continue;
|
continue;
|
||||||
@@ -334,16 +334,17 @@ static int expandfile(struct expandfile *ret, char *filename, int level) {
|
|||||||
appendchar(ret->data, c);
|
appendchar(ret->data, c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
c = fgetc(file);
|
|
||||||
if (c == EOF) {
|
|
||||||
goto no_nest_end;
|
|
||||||
}
|
|
||||||
appendchar(ret->data, ESCAPE_CHAR);
|
|
||||||
appendchar(ret->data, c);
|
appendchar(ret->data, c);
|
||||||
if (c != NEST_END) {
|
c = fgetc(file);
|
||||||
continue;
|
if (c == NEST_END) {
|
||||||
|
appendchar(ret->data, c);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
ungetc(c, file);
|
||||||
|
do {
|
||||||
|
c = fgetc(file);
|
||||||
|
appendchar(ret->data, c);
|
||||||
|
} while (c != ESCAPE_CHAR);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
no_nest_end:
|
no_nest_end:
|
||||||
|
|||||||
Reference in New Issue
Block a user