svn commit: r250067 - stable/8/usr.sbin/config

Jung-uk Kim jkim at FreeBSD.org
Mon Apr 29 21:05:13 UTC 2013


Author: jkim
Date: Mon Apr 29 21:05:12 2013
New Revision: 250067
URL: http://svnweb.freebsd.org/changeset/base/250067

Log:
  MFC:	r248777
  
  Loosen restrictions for quoted strings.  Now we can use more complex strings
  and "escaped" quote characters.

Modified:
  stable/8/usr.sbin/config/main.c
Directory Properties:
  stable/8/usr.sbin/config/   (props changed)

Modified: stable/8/usr.sbin/config/main.c
==============================================================================
--- stable/8/usr.sbin/config/main.c	Mon Apr 29 21:04:37 2013	(r250066)
+++ stable/8/usr.sbin/config/main.c	Mon Apr 29 21:05:12 2013	(r250067)
@@ -377,16 +377,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;


More information about the svn-src-stable-8 mailing list