packages/net/bwm/patches/001-debian.patch
florian 5be33d9886 [package] use debian's patch to some display issues (#5182)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@16080 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-05-26 14:21:59 +00:00

46 lines
1.3 KiB
Diff

--- a/bwm.c
+++ b/bwm.c
@@ -57,7 +57,8 @@ int main(int argc, char *argv[])
char buffer[256];
char *buffer_pointer;
- int inum;
+ int inum = -1;
+ int oldinum = -1;
int field_number;
int total_counter;
int sleep_time = 2;
@@ -90,7 +91,13 @@ int main(int argc, char *argv[])
while(1)
{
- printf("%c[H",27);
+ if (inum==oldinum)
+ {
+ printf("%c[H",27);
+ } else {
+ printf("%c[H%c[J",27,27);
+ oldinum = inum;
+ }
printf("Bandwidth Monitor 1.1.0\n\n");
printf(" Iface RX(KB/sec) TX(KB/sec) Total(KB/sec)\n\n");
@@ -138,7 +145,7 @@ int main(int argc, char *argv[])
interface[inum].rx_kbytes_dif =
(interface[inum].rx_bytes_new -
- interface[inum].rx_bytes_old) * 1000 / 1024;
+ interface[inum].rx_bytes_old) / 1024 * 1000;
interface[inum].rx_rate_whole =
interface[inum].rx_kbytes_dif /
@@ -157,7 +164,7 @@ int main(int argc, char *argv[])
interface[inum].tx_kbytes_dif =
(interface[inum].tx_bytes_new -
- interface[inum].tx_bytes_old) * 1000 / 1024;
+ interface[inum].tx_bytes_old) / 1024 * 1000;
interface[inum].tx_rate_whole =
interface[inum].tx_kbytes_dif /