PR: 7475
Added support for -q (suppress output) when firewall rules are taken from a file. Solves PR 7475
This commit is contained in:
parent
b69602f3bb
commit
62cf03cd85
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38092
@ -5,8 +5,11 @@
|
||||
.Nm ipfw
|
||||
.Nd controlling utility for IP firewall
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ar file
|
||||
.Nm ipfw
|
||||
.Oo
|
||||
.Fl q
|
||||
.Oc
|
||||
file
|
||||
.Nm ipfw
|
||||
.Oo
|
||||
.Fl f
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* NEW command line interface for IP firewall facility
|
||||
*
|
||||
* $Id: ipfw.c,v 1.57 1998/05/15 12:38:07 danny Exp $
|
||||
* $Id: ipfw.c,v 1.58 1998/07/06 03:20:10 julian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -1291,7 +1291,7 @@ main(ac, av)
|
||||
char buf[BUFSIZ];
|
||||
char *a, *args[MAX_ARGS];
|
||||
char linename[10];
|
||||
int i;
|
||||
int i, qflag=0;
|
||||
FILE *f;
|
||||
|
||||
s = socket( AF_INET, SOCK_RAW, IPPROTO_RAW );
|
||||
@ -1300,10 +1300,11 @@ main(ac, av)
|
||||
|
||||
setbuf(stdout,0);
|
||||
|
||||
if (av[1] && !access(av[1], R_OK)) {
|
||||
if (av[1] && (!access(av[1], R_OK) ||
|
||||
(av[2] && (qflag=!strcmp(av[1],"-q")) && !access(av[2], R_OK)))){
|
||||
lineno = 0;
|
||||
if ((f = fopen(av[1], "r")) == NULL)
|
||||
err(EX_UNAVAILABLE, "fopen: %s", av[1]);
|
||||
if ((f = fopen(av[ac-1], "r")) == NULL)
|
||||
err(EX_UNAVAILABLE, "fopen: %s", av[ac-1]);
|
||||
while (fgets(buf, BUFSIZ, f)) {
|
||||
char *p;
|
||||
|
||||
@ -1315,7 +1316,9 @@ main(ac, av)
|
||||
continue;
|
||||
if ((p = strchr(buf, '#')) != NULL)
|
||||
*p = '\0';
|
||||
for (i = 1, a = strtok(buf, WHITESP);
|
||||
i=1;
|
||||
if (qflag) args[i++]="-q";
|
||||
for (a = strtok(buf, WHITESP);
|
||||
a && i < MAX_ARGS; a = strtok(NULL, WHITESP), i++)
|
||||
args[i] = a;
|
||||
if (i == 1)
|
||||
|
Loading…
Reference in New Issue
Block a user