Date: Thu, 4 Dec 1997 17:42:18 -0800 (PST) From: Archie Cobbs <archie@whistle.com> To: jbackus@plex.nl Cc: freebsd-hackers@freebsd.org Subject: Re: Teeny-weeny /usr/src/sbin/ipfw/ipfw.c patch Message-ID: <199712050142.RAA11543@bubba.whistle.com> In-Reply-To: <19971205003643.2067.qmail@jos.mp-c.com> from Jos Backus at "Dec 5, 97 01:36:43 am"
index | next in thread | previous in thread | raw e-mail
Jos Backus writes:
> *** ipfw.c.dist Fri Dec 5 01:29:49 1997
> --- ipfw.c Fri Dec 5 01:30:20 1997
> ***************
> *** 1197,1202 ****
> --- 1197,1203 ----
> while (fgets(buf, BUFSIZ, f)) {
>
> lineno++;
> + if (buf[0]=='#'||buf[0]=='\n') continue;
> sprintf(linename, "Line %d", lineno);
> args[0] = linename;
>
> This allows comments/empty lines in a firewall rule file (when using the
> ``ipfw rulefile'' syntax), which seems pretty handy (at least to me --
> documenting rules and all that).
Good idea! But may I suggest this tweak? So a blank line with extra
white space is OK too...
*** ipfw.c.orig Fri Dec 5 01:39:35 1997
--- ipfw.c Fri Dec 5 01:40:33 1997
***************
*** 1200,1208 ****
--- 1200,1212 ----
sprintf(linename, "Line %d", lineno);
args[0] = linename;
+ if (*buf == '#')
+ continue;
for (i = 1, a = strtok(buf, WHITESP);
a && i < MAX_ARGS; a = strtok(NULL, WHITESP), i++)
args[i] = a;
+ if (i == 1)
+ continue;
if (i == MAX_ARGS)
errx(1, "%s: too many arguments", linename);
args[i] = NULL;
Thanks,
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712050142.RAA11543>
