From owner-freebsd-bugs Mon Nov 4 6:40:12 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3FCDA37B401 for ; Mon, 4 Nov 2002 06:40:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E99EA43E42 for ; Mon, 4 Nov 2002 06:40:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gA4Ee9x3009611 for ; Mon, 4 Nov 2002 06:40:09 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gA4Ee9Ka009610; Mon, 4 Nov 2002 06:40:09 -0800 (PST) Date: Mon, 4 Nov 2002 06:40:09 -0800 (PST) Message-Id: <200211041440.gA4Ee9Ka009610@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Chris Pepper Subject: Re: kern/44843: ipfw -t l doesn't align columns quite right Reply-To: Chris Pepper Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/44843; it has been noted by GNATS. From: Chris Pepper To: Giorgos Keramidas Cc: bug-followup@freebsd.org, Luigi Rizzo Subject: Re: kern/44843: ipfw -t l doesn't align columns quite right Date: Mon, 4 Nov 2002 09:26:48 -0500 Sorry, I'm using ipfw1 -- isn't this for v2? Chris At 11:19 AM +0200 2002/11/04, Giorgos Keramidas wrote: >On 2002-11-01 22:46, Chris Pepper wrote: >> "ipfw -t l" doesn't align columns very well. > >> [www:~] root# ipfw -t l >> 00100 Fri Nov 1 22:40:38 2002 allow ip from any to any via lo0 >> 00200 deny ip from any to 127.0.0.0/8 > >Can you try the following patch? It seems to fix the problem here. > >%%% >Index: ipfw2.c >=================================================================== >RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v >retrieving revision 1.14 >diff -u -r1.14 ipfw2.c >--- ipfw2.c 24 Oct 2002 18:04:44 -0000 1.14 >+++ ipfw2.c 4 Nov 2002 03:58:37 -0000 >@@ -810,6 +810,7 @@ > int flags = 0; /* prerequisites */ > ipfw_insn_log *logptr = NULL; /* set if we find an O_LOG */ > int or_block = 0; /* we are in an or block */ >+ int twidth = 0; /* timestamp column width */ > > u_int32_t set_disable = rule->set_disable; > >@@ -825,15 +826,23 @@ > printf("%10qu %10qu ", rule->pcnt, rule->bcnt); > > if (do_time) { >+ char timestr[30]; >+ >+ if (twidth == 0) { >+ time_t t = 0; >+ >+ strcpy(timestr, ctime(&t)); >+ *strchr(timestr, '\n') = '\0'; >+ twidth = strlen(timestr); >+ } > if (rule->timestamp) { >- char timestr[30]; > time_t t = _long_to_time(rule->timestamp); > > strcpy(timestr, ctime(&t)); > *strchr(timestr, '\n') = '\0'; > printf("%s ", timestr); > } else { >- printf(" "); >+ printf("%*s ", twidth, " "); > } > } > >%%% -- Chris Pepper: Rockefeller University: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message