Parse arg to INCLUDECMD as a character string, not a sequence of tokens.

This commit is contained in:
Dianne Skoll
2021-09-05 10:02:59 -04:00
parent a467cc1b84
commit 0ca368c8d9

View File

@@ -553,32 +553,28 @@ int DoInclude(ParsePtr p)
int DoIncludeCmd(ParsePtr p) int DoIncludeCmd(ParsePtr p)
{ {
DynamicBuffer buf; DynamicBuffer buf;
DynamicBuffer token;
int r; int r;
int ch;
char append_buf[2];
append_buf[1] = 0;
int done = 0;
DBufInit(&buf); DBufInit(&buf);
DBufInit(&token);
while(1) { while(1) {
if ( (r=ParseToken(p, &token)) ) { ch = ParseChar(p, &r, 0);
if (r) {
DBufFree(&buf); DBufFree(&buf);
return r; return r;
} }
if (!*DBufValue(&token)) break; if (!ch) {
if (done) { break;
if (DBufPuts(&buf, " ") != OK) { }
DBufFree(&buf); append_buf[0] = (char) ch;
return E_NO_MEM; if (DBufPuts(&buf, append_buf) != OK) {
}
}
done = 1;
if (DBufPuts(&buf, DBufValue(&token)) != OK) {
DBufFree(&buf); DBufFree(&buf);
return E_NO_MEM; return E_NO_MEM;
} }
DBufFree(&token);
DBufInit(&token);
} }
if ( (r=IncludeCmd(DBufValue(&buf))) ) { if ( (r=IncludeCmd(DBufValue(&buf))) ) {