diff --git a/Source/DOH/string.c b/Source/DOH/string.c index c56da26bb..f0c73213a 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -460,11 +460,27 @@ String_ungetc(DOH *so, int ch) static char * end_quote(char *s) { + char *qs; char qc; char *q; + char *nl; qc = *s; + qs = s; while (1) { q = strpbrk(s+1,"\"\'"); + nl = strchr(s+1,'\n'); + if (nl && (nl < q)) { + /* A new line appears before the end of the string */ + if (*(nl-1) == '\\') { + s = nl+1; + continue; + } + /* String was terminated by a newline. Wing it */ + return qs; + } + if (!q && nl) { + return qs; + } if (!q) return 0; if ((*q == qc) && (*(q-1) != '\\')) return q; s = q;