On Tue, Aug 13, 2002 at 07:04:16PM -0700, Paul B. Henson wrote:

> If so, I might go ahead and kludge the in line comments into 3.1 (as I
> think that would be easier than backporting string concatenation) and then
> convert to this syntax for 3.2.

The diff below (against 3.1-release src/sbin/pfctl/parse.y) adds support
for # comments after \ backslashes and inside string literals, you can
use either of the two chunks separately, too.

The opposition, especially to the latter, was quite violent, so this
won't go into the tree (again).

Daniel


--- parse.y.orig        Wed Aug 14 08:04:14 2002
+++ parse.y     Wed Aug 14 08:07:42 2002
@@ -1438,7 +1438,12 @@
 
        c = getc(fin);
        if (c == '\\') {
-               next = getc(fin);
+               while ((next = getc(fin)) == ' ')
+                       ;
+               if (next == '#')
+                       do
+                               next = getc(fin);
+                       while (next != '\n' && next != EOF);
                if (next != '\n') {
                        ungetc(next, fin);
                        return (c);
@@ -1539,6 +1544,10 @@
                                *p = '\0';
                                break;
                        }
+                       if (c == '#')
+                               do
+                                       c = lgetc(fin);
+                               while (c != '\n' && c != EOF);
                        if (c == '\n')
                                continue;
                        if (p + 1 >= buf + sizeof(buf) - 1) {

Reply via email to