]> git.armaanb.net Git - opendoas.git/blobdiff - parse.y
In the config file allow line continuations with backslashes.
[opendoas.git] / parse.y
diff --git a/parse.y b/parse.y
index 4e158783ac85e7ab7210791cc1d14e53f8120955..55613238b3a37fdf252cb90426793ae0fd0111ef 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.3 2015/07/16 22:33:01 zhuk Exp $ */
+/* $OpenBSD: parse.y,v 1.4 2015/07/16 23:02:56 nicm Exp $ */
 /*
  * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
  *
@@ -166,13 +166,22 @@ int
 yylex(void)
 {
        char buf[1024], *ebuf, *p, *str;
-       int i, c;
+       int i, c, next;
 
        p = buf;
        ebuf = buf + sizeof(buf);
-       while ((c = getc(yyfp)) == ' ' || c == '\t')
-               ; /* skip spaces */
+repeat:
+       c = getc(yyfp);
        switch (c) {
+               case ' ':
+               case '\t':
+                       goto repeat; /* skip spaces */
+               case '\\':
+                       next = getc(yyfp);
+                       if (next == '\n')
+                               goto repeat;
+                       else 
+                               c = next;
                case '\n':
                case '{':
                case '}':