Package: bwm
Version: 1.1.0-8.1
Severity: normal
Tags: patch

Hi,

Attached is the diff for my bwm 1.1.0-8.2 NMU.

-- 
| Lucas Nussbaum
| [EMAIL PROTECTED]   http://www.lucas-nussbaum.net/ |
| jabber: [EMAIL PROTECTED]             GPG: 1024D/023B3F4F |
diff -u bwm-1.1.0/bwm.c bwm-1.1.0/bwm.c
--- bwm-1.1.0/bwm.c
+++ bwm-1.1.0/bwm.c
@@ -20,12 +20,21 @@
 #include <unistd.h>
 
 #include <sys/time.h>
+#include <net/if.h>
+
+/* Indirect stringification.  Doing two levels allows the parameter to be a
+ * macro itself.  For example, compile with -DFOO=bar, __stringify(FOO)
+ * converts to "bar".
+ */
+
+#define __stringify_1(x)        #x
+#define __stringify(x)          __stringify_1(x)
 
 #define MAX_INTERFACES 16
 
 struct interface_info
 {
-  char name[12];
+  char name[IF_NAMESIZE + 1];
 
   unsigned long tx_bytes_old;
   unsigned long rx_bytes_old;
@@ -99,7 +108,7 @@
       oldinum = inum;
     }
     printf("Bandwidth Monitor 1.1.0\n\n");
-    printf("       Iface        RX(KB/sec)   TX(KB/sec)   Total(KB/sec)\n\n");
+    printf("%" __stringify(IF_NAMESIZE) "s        RX(KB/sec)   TX(KB/sec)   Total(KB/sec)\n\n", "Interface");
 
     inum = -1;
 
@@ -126,7 +135,8 @@
       {
         buffer_pointer = buffer;
         buffer_pointer = strtok(buffer_pointer, " :");
-        strncpy(interface[inum].name, buffer_pointer, 11);
+	memset(interface[inum].name, 0, sizeof(interface[inum].name));
+        strncpy(interface[inum].name, buffer_pointer, IF_NAMESIZE);
 
         field_number = 0;
 
@@ -182,7 +192,7 @@
                interface[inum].rx_rate_part +
                 interface[inum].tx_rate_part;
 
-              if(interface[inum].tot_rate_part > 1000)
+              if(interface[inum].tot_rate_part >= 1000)
               {
                 interface[inum].tot_rate_whole++;
                 interface[inum].tot_rate_part -= 1000;
@@ -194,7 +204,7 @@
    
         if(!first_pass)
         {
-          printf("%12s     %8lu.%03u %8lu.%03u    %8lu.%03u\n", 
+          printf("%" __stringify(IF_NAMESIZE) "s     %8lu.%03u %8lu.%03u    %8lu.%03u\n", 
             interface[inum].name,
              interface[inum].rx_rate_whole, interface[inum].rx_rate_part, 
               interface[inum].tx_rate_whole, interface[inum].tx_rate_part, 
@@ -216,7 +226,7 @@
       rx_bw_total_whole += interface[total_counter].rx_rate_whole;
       rx_bw_total_part += interface[total_counter].rx_rate_part;
 
-      if(rx_bw_total_part > 1000)
+      if(rx_bw_total_part >= 1000)
       {
         rx_bw_total_whole++;
         rx_bw_total_part -= 1000;
@@ -225,7 +235,7 @@
       tx_bw_total_whole += interface[total_counter].tx_rate_whole;
       tx_bw_total_part += interface[total_counter].tx_rate_part;
 
-      if(tx_bw_total_part > 1000)
+      if(tx_bw_total_part >= 1000)
       {
         tx_bw_total_whole++;
         tx_bw_total_part -= 1000;
@@ -234,7 +244,7 @@
       tot_bw_total_whole = rx_bw_total_whole + tx_bw_total_whole;
       tot_bw_total_part = rx_bw_total_part + tx_bw_total_part;
     
-      if(tot_bw_total_part > 1000)
+      if(tot_bw_total_part >= 1000)
       {
         tot_bw_total_whole++;
         tot_bw_total_part -= 1000;
@@ -245,7 +255,8 @@
 
     if(!first_pass)
     {
-      printf("\n       Total     %8lu.%03u %8lu.%03u    %8lu.%03u\n\n",
+      printf("\n%" __stringify(IF_NAMESIZE) "s     %8lu.%03u %8lu.%03u    %8lu.%03u\n\n",
+       "Total",
        rx_bw_total_whole, rx_bw_total_part,
         tx_bw_total_whole, tx_bw_total_part,
          tot_bw_total_whole, tot_bw_total_part);
diff -u bwm-1.1.0/debian/control bwm-1.1.0/debian/control
--- bwm-1.1.0/debian/control
+++ bwm-1.1.0/debian/control
@@ -12 +12 @@
- interfaces in the in the same time, and shows totals too.
+ interfaces at the same time, and shows totals too.
diff -u bwm-1.1.0/debian/local/bwm.1 bwm-1.1.0/debian/local/bwm.1
--- bwm-1.1.0/debian/local/bwm.1
+++ bwm-1.1.0/debian/local/bwm.1
@@ -15,7 +15,7 @@
 Specifies the update frequency in seconds. Defaults to 2.
 .TP
 .B file
-Determinates the special file to gether interface info from. Defaults to
+Determines the special file to gather interface info from. Defaults to
 /proc/net/dev.
 .SH AUTHOR
 This manual page was written by Lenart Janos <[EMAIL PROTECTED]>,
diff -u bwm-1.1.0/debian/rules bwm-1.1.0/debian/rules
--- bwm-1.1.0/debian/rules
+++ bwm-1.1.0/debian/rules
@@ -23,8 +23,13 @@
 	$(checkdir)
 	$(checkroot)
 	rm -Rf debian/tmp
-	install -d debian/tmp/{DEBIAN,usr/{bin,lib/menu,share/{doc/$(pkg),man/man1}}}
-	install -m 0755 debian/{post{inst,rm}} debian/tmp/DEBIAN
+	install -d debian/tmp/DEBIAN
+	install -d debian/tmp/usr/bin
+	install -d debian/tmp/usr/lib/menu
+	install -d debian/tmp/usr/share/doc/$(pkg)
+	install -d debian/tmp/usr/share/man/man1
+	install -m 0755 debian/postinst debian/tmp/DEBIAN
+	install -m 0755 debian/postrm debian/tmp/DEBIAN
 	install -m 0644 debian/copyright debian/tmp/usr/share/doc/$(pkg)
 	install -m 0644 debian/menu debian/tmp/usr/lib/menu/$(pkg)
 	install -sm 0755 $(pkg) debian/tmp/usr/bin
diff -u bwm-1.1.0/debian/changelog bwm-1.1.0/debian/changelog
--- bwm-1.1.0/debian/changelog
+++ bwm-1.1.0/debian/changelog
@@ -1,3 +1,18 @@
+bwm (1.1.0-8.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/rules: fix bashisms (use of {,}). Ubuntu's patch was used as
+    a basis. Closes: 375394.
+  * Interface names over 11 characters displayed with corruption. Applied
+    patch from Matthew William Solloway Bell (Closes: #404374, #294788)
+  * Sometimes displayed too many digits. Applied patch from Mario Holbe.
+    (Closes: #175826)
+  * Fixed typos in bwm.1. Applied patch from A Costa. (Closes: #362080)
+  * Fixed typo in description. Applied patch from Eric Cooper
+    (Closes: #384634)
+
+ -- Lucas Nussbaum <[EMAIL PROTECTED]>  Mon, 14 Jan 2008 14:23:59 +0100
+
 bwm (1.1.0-8.1) unstable; urgency=low
 
   * The "Never trust your tools, or risk loosing hours of your life" NMU.

Reply via email to