main.c (220802) | main.c (222744) |
---|---|
1/* 2 * Copyright (c) 2002-2003,2010 Luigi Rizzo 3 * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp 4 * Copyright (c) 1994 Ugen J.S.Antsilevich 5 * 6 * Idea and grammar partially left from: 7 * Copyright (c) 1993 Daniel Boulet 8 * 9 * Redistribution and use in source forms, with and without modification, 10 * are permitted provided that this entire comment appears intact. 11 * 12 * Redistribution in binary form may occur without any restrictions. 13 * Obviously, it would be nice if you gave credit where credit is due 14 * but requiring it would be too onerous. 15 * 16 * This software is provided ``AS IS'' without any warranties of any kind. 17 * 18 * Command line interface for IP firewall facility 19 * | 1/* 2 * Copyright (c) 2002-2003,2010 Luigi Rizzo 3 * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp 4 * Copyright (c) 1994 Ugen J.S.Antsilevich 5 * 6 * Idea and grammar partially left from: 7 * Copyright (c) 1993 Daniel Boulet 8 * 9 * Redistribution and use in source forms, with and without modification, 10 * are permitted provided that this entire comment appears intact. 11 * 12 * Redistribution in binary form may occur without any restrictions. 13 * Obviously, it would be nice if you gave credit where credit is due 14 * but requiring it would be too onerous. 15 * 16 * This software is provided ``AS IS'' without any warranties of any kind. 17 * 18 * Command line interface for IP firewall facility 19 * |
20 * $FreeBSD: head/sbin/ipfw/main.c 220802 2011-04-18 21:18:22Z glebius $ | 20 * $FreeBSD: head/sbin/ipfw/main.c 222744 2011-06-06 10:52:26Z ae $ |
21 */ 22 23#include <sys/wait.h> 24#include <ctype.h> 25#include <err.h> 26#include <errno.h> 27#include <signal.h> 28#include <stdio.h> --- 410 unchanged lines hidden (view full) --- 439 return 0; 440} 441 442 443static void 444ipfw_readfile(int ac, char *av[]) 445{ 446#define MAX_ARGS 32 | 21 */ 22 23#include <sys/wait.h> 24#include <ctype.h> 25#include <err.h> 26#include <errno.h> 27#include <signal.h> 28#include <stdio.h> --- 410 unchanged lines hidden (view full) --- 439 return 0; 440} 441 442 443static void 444ipfw_readfile(int ac, char *av[]) 445{ 446#define MAX_ARGS 32 |
447 char buf[BUFSIZ]; | 447 char buf[4096]; |
448 char *progname = av[0]; /* original program name */ 449 const char *cmd = NULL; /* preprocessor name, if any */ 450 const char *filename = av[ac-1]; /* file to read */ 451 int c, lineno=0; 452 FILE *f = NULL; 453 pid_t preproc = 0; 454 455 while ((c = getopt(ac, av, "cfNnp:qS")) != -1) { --- 91 unchanged lines hidden (view full) --- 547 548 (void)kill(preproc, SIGTERM); 549 errno = savederrno; 550 err(EX_OSERR, "fdopen()"); 551 } 552 } 553 } 554 | 448 char *progname = av[0]; /* original program name */ 449 const char *cmd = NULL; /* preprocessor name, if any */ 450 const char *filename = av[ac-1]; /* file to read */ 451 int c, lineno=0; 452 FILE *f = NULL; 453 pid_t preproc = 0; 454 455 while ((c = getopt(ac, av, "cfNnp:qS")) != -1) { --- 91 unchanged lines hidden (view full) --- 547 548 (void)kill(preproc, SIGTERM); 549 errno = savederrno; 550 err(EX_OSERR, "fdopen()"); 551 } 552 } 553 } 554 |
555 while (fgets(buf, BUFSIZ, f)) { /* read commands */ | 555 while (fgets(buf, sizeof(buf), f)) { /* read commands */ |
556 char linename[20]; 557 char *args[2]; 558 559 lineno++; 560 snprintf(linename, sizeof(linename), "Line %d", lineno); 561 setprogname(linename); /* XXX */ 562 args[0] = progname; 563 args[1] = buf; --- 52 unchanged lines hidden --- | 556 char linename[20]; 557 char *args[2]; 558 559 lineno++; 560 snprintf(linename, sizeof(linename), "Line %d", lineno); 561 setprogname(linename); /* XXX */ 562 args[0] = progname; 563 args[1] = buf; --- 52 unchanged lines hidden --- |