summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw/ipfw.c
diff options
context:
space:
mode:
authorkbyanc <kbyanc@FreeBSD.org>2002-12-23 20:08:21 +0000
committerkbyanc <kbyanc@FreeBSD.org>2002-12-23 20:08:21 +0000
commit9ac9c4ac0c352bd7527c4e2d11ce5b069ea22436 (patch)
treebe88533dbd66cd557c578274f229db7be09dda73 /sbin/ipfw/ipfw.c
parentfccac156927434c5a1874f5b3dad773e7b73a744 (diff)
downloadFreeBSD-src-9ac9c4ac0c352bd7527c4e2d11ce5b069ea22436.zip
FreeBSD-src-9ac9c4ac0c352bd7527c4e2d11ce5b069ea22436.tar.gz
Make preprocessor support more generic by passing all command-line options
after -p except for the last (the ruleset file to process) to the preprocessor for interpretation. This allows command-line options besides -U and -D to be passed to cpp(1) and m4(1) as well as making it easier to use other preprocessors. Sponsored By: NTT Multimedia Communications Labs MFC after: 1 week
Diffstat (limited to 'sbin/ipfw/ipfw.c')
-rw-r--r--sbin/ipfw/ipfw.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c
index c4f00fd..740aba8 100644
--- a/sbin/ipfw/ipfw.c
+++ b/sbin/ipfw/ipfw.c
@@ -2529,28 +2529,8 @@ ipfw_readfile(int ac, char *av[])
pid_t preproc = 0;
int c;
- while ((c = getopt(ac, av, "D:U:p:q")) != -1)
+ while ((c = getopt(ac, av, "p:q")) != -1) {
switch(c) {
- case 'D':
- if (!pflag)
- errx(EX_USAGE, "-D requires -p");
- if (i > MAX_ARGS - 2)
- errx(EX_USAGE,
- "too many -D or -U options");
- args[i++] = "-D";
- args[i++] = optarg;
- break;
-
- case 'U':
- if (!pflag)
- errx(EX_USAGE, "-U requires -p");
- if (i > MAX_ARGS - 2)
- errx(EX_USAGE,
- "too many -D or -U options");
- args[i++] = "-U";
- args[i++] = optarg;
- break;
-
case 'p':
pflag = 1;
cmd = optarg;
@@ -2567,6 +2547,19 @@ ipfw_readfile(int ac, char *av[])
" summary ``ipfw''");
}
+ if (pflag)
+ break;
+ }
+
+ if (pflag) {
+ /* Pass all but the last argument to the preprocessor. */
+ while (optind < ac - 1) {
+ if (i >= MAX_ARGS)
+ errx(EX_USAGE, "too many preprocessor options");
+ args[i++] = av[optind++];
+ }
+ }
+
av += optind;
ac -= optind;
if (ac != 1)
OpenPOWER on IntegriCloud