From: Phil Blundell Date: Tue, 17 Jul 2001 07:21:57 +0000 (+0000) Subject: Fix confusion between bits and bytes X-Git-Tag: upstream/1.99_20121209git~227 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb7fb72db67545af770b12841084ba3dcc0742d6;p=platform%2Fupstream%2Fnet-tools.git Fix confusion between bits and bytes --- diff --git a/lib/interface.c b/lib/interface.c index f4d2a9a..e77552a 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -7,7 +7,7 @@ 8/2000 Andi Kleen make the list operations a bit more efficient. People are crazy enough to use thousands of aliases now. - $Id: interface.c,v 1.14 2001/02/10 19:31:15 pb Exp $ + $Id: interface.c,v 1.15 2001/07/17 07:21:57 pb Exp $ */ #include "config.h" @@ -636,8 +636,8 @@ void ife_print_long(struct interface *ptr) int hf; int can_compress = 0; unsigned long long rx, tx, short_rx, short_tx; - char Rext[5]="b"; - char Text[5]="b"; + const char *Rext = "b"; + const char *Text = "b"; #if HAVE_AFIPX static struct aftype *ipxtype = NULL; @@ -843,10 +843,21 @@ void ife_print_long(struct interface *ptr) tx = ptr->stats.tx_bytes; short_rx = rx * 10; short_tx = tx * 10; - if (rx > 1048576) { short_rx /= 1048576; strcpy(Rext, "Mb"); } - else if (rx > 1024) { short_rx /= 1024; strcpy(Rext, "Kb"); } - if (tx > 1048576) { short_tx /= 1048576; strcpy(Text, "Mb"); } - else if (tx > 1024) { short_tx /= 1024; strcpy(Text, "Kb"); } + if (rx > 1048576) { + short_rx /= 1048576; + Rext = "MB"; + } else if (rx > 1024) { + short_rx /= 1024; + Rext = "KB"; + } + if (tx > 1048576) { + short_tx /= 1048576; + Text = "MB"; + } + else if (tx > 1024) { + short_tx /= 1024; + Text = "KB"; + } printf(" "); printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),