Loosen restrictions for quoted strings. Now we can use more complex strings

and "escaped" quote characters.

MFC after:	1 month
This commit is contained in:
Jung-uk Kim 2013-03-26 23:58:13 +00:00
parent 91ba008fc5
commit 52569792bd

View File

@ -351,16 +351,24 @@ get_quoted_word(FILE *fp)
if (ch == '"' || ch == '\'') {
int quote = ch;
escaped_nl = 0;
while ((ch = getc(fp)) != EOF) {
if (ch == quote)
if (ch == quote && !escaped_nl)
break;
if (ch == '\n') {
if (ch == '\n' && !escaped_nl) {
*cp = 0;
printf("config: missing quote reading `%s'\n",
line);
exit(2);
}
if (ch == '\\' && !escaped_nl) {
escaped_nl = 1;
continue;
}
if (ch != quote && escaped_nl)
*cp++ = '\\';
*cp++ = ch;
escaped_nl = 0;
}
} else {
*cp++ = ch;