From owner-freebsd-hackers Thu Dec 4 17:43:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id RAA24801 for hackers-outgoing; Thu, 4 Dec 1997 17:43:14 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id RAA24796 for ; Thu, 4 Dec 1997 17:43:11 -0800 (PST) (envelope-from archie@whistle.com) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id RAA27368; Thu, 4 Dec 1997 17:42:40 -0800 (PST) Received: from bubba.whistle.com(207.76.205.7) by whistle.com via smap (V1.3) id sma027366; Thu Dec 4 17:42:19 1997 Received: (from archie@localhost) by bubba.whistle.com (8.8.5/8.6.12) id RAA11543; Thu, 4 Dec 1997 17:42:19 -0800 (PST) From: Archie Cobbs Message-Id: <199712050142.RAA11543@bubba.whistle.com> Subject: Re: Teeny-weeny /usr/src/sbin/ipfw/ipfw.c patch In-Reply-To: <19971205003643.2067.qmail@jos.mp-c.com> from Jos Backus at "Dec 5, 97 01:36:43 am" To: jbackus@plex.nl Date: Thu, 4 Dec 1997 17:42:18 -0800 (PST) Cc: freebsd-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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