diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/config/main.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 14061c2..3ed5495 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -351,16 +351,24 @@ begin: 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; |