From e434f4878b7eb28e5b853f621ed9db40f4229be2 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 5 Dec 1997 02:43:26 +0000 Subject: Allow ipfw to accept comments and blank lines. This makes ipfw config files a LOT more readable. --- sbin/ipfw/ipfw.8 | 2 ++ sbin/ipfw/ipfw.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'sbin/ipfw') diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 355676f..c4535c5 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -84,6 +84,8 @@ The zero operation zeroes the counters associated with rule number .Pp The flush operation removes all rules. .Pp +Any command beginning with a '#', or being all blank, is ignored. +.Pp One rule is always present: .Bd -literal -offset center 65535 deny all from any to any diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c index fb4f577..8213a74 100644 --- a/sbin/ipfw/ipfw.c +++ b/sbin/ipfw/ipfw.c @@ -16,7 +16,7 @@ * * NEW command line interface for IP firewall facility * - * $Id: ipfw.c,v 1.46 1997/07/25 03:13:46 brian Exp $ + * $Id: ipfw.c,v 1.47 1997/08/08 14:36:28 alex Exp $ * */ @@ -1200,9 +1200,13 @@ main(ac, av) 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; -- cgit v1.1