Date: Mon, 29 Apr 2013 21:04:37 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250066 - stable/9/usr.sbin/config Message-ID: <201304292104.r3TL4bu6085351@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Mon Apr 29 21:04:37 2013 New Revision: 250066 URL: http://svnweb.freebsd.org/changeset/base/250066 Log: MFC: r248777 Loosen restrictions for quoted strings. Now we can use more complex strings and "escaped" quote characters. Modified: stable/9/usr.sbin/config/main.c Directory Properties: stable/9/usr.sbin/config/ (props changed) Modified: stable/9/usr.sbin/config/main.c ============================================================================== --- stable/9/usr.sbin/config/main.c Mon Apr 29 20:32:09 2013 (r250065) +++ stable/9/usr.sbin/config/main.c Mon Apr 29 21:04:37 2013 (r250066) @@ -350,16 +350,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304292104.r3TL4bu6085351>