Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jan 2003 21:53:35 +0200
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        Maxim Konovalov <maxim@freebsd.org>
Cc:        freebsd-audit@freebsd.org, des@freebsd.org, luigi@freebsd.org
Subject:   Re: (fwd) bin/47196: ipfw won't format correctly output from 'ipfw show' command
Message-ID:  <20030123195335.GC678@gothmog.gr>
In-Reply-To: <20030123184329.T77556@news1.macomnet.ru>
References:  <20030123034022.GA587@gothmog.gr> <20030123184329.T77556@news1.macomnet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2003-01-23 19:10, Maxim Konovalov <maxim@FreeBSD.org> wrote:
> On 05:40+0200, Jan 23, 2003, Giorgos Keramidas wrote:
> > I've sent the following 2 days ago to ipfw@ but received no reply.
> > Does anyone feel like testing/reviewing or committing this?  This
> > change should be all we need to fix & close PR bin/47196 :-)
>
> Formatting was broken in rev. 1.103 ipfw.c in -CURRENT and ipfw2
> in -CURRENT and -STABLE inherited the bug later.
>
> I think we should rever this part of rev. 1.103 of ipfw.c in ipfw2.c:

Not quite.  See inline comments.

> Index: ipfw/ipfw2.c
> ===================================================================
> RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v
> retrieving revision 1.21
> diff -u -r1.21 ipfw2.c
> --- ipfw/ipfw2.c	12 Jan 2003 03:31:10 -0000	1.21
> +++ ipfw/ipfw2.c	23 Jan 2003 16:07:09 -0000
> @@ -823,7 +823,7 @@
>  	printf("%05u ", rule->rulenum);
> 
>  	if (do_acct)
> -		printf("%10qu %10qu ", rule->pcnt, rule->bcnt);
> +		printf("%*qu %*qu ", rule->pcnt, rule->bcnt);

The %*qu specifier needs two arguments.  The first is the length, and
the second should be rule->pcnt.  The same for the second one.  You'd
have to use something like:

		printf("%*qu %*qu ", rule_width, rule->pcnt,
		    byte_width, rule->bcnt);

> -	printf("%05d %10qu %10qu (%ds)",
> +	printf("%05d %*qu %*qu (%ds)",
>  	    d->rulenum, d->pcnt, d->bcnt, d->expire);

Ditto.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030123195335.GC678>