Perhaps a little more involved, but I think it would also be good to bring if_hw_addr into compatibility with the sources from which is drawn such as:
ether.h:        u_int8_t        ether_dhost[ETHER_ADDR_LEN];
ether.h:        u_int8_t        ether_shost[ETHER_ADDR_LEN];
token.h:        u_int8_t  token_dhost[TOKEN_RING_MAC_LEN];
token.h:        u_int8_t  token_shost[TOKEN_RING_MAC_LEN];

so change all declarations from "char" to "u_int8_t".

Attached.


On Fri, Feb 7, 2014 at 3:39 PM, Zev Weiss <zev@bewilderbeest.net> wrote:
Hi,

Running iftop-1.0pre4 I noticed my MAC address getting printed with some bytes (the "negative" ones) sign-extended into 32 bits (i.e. with "ffffff" prefixed).  The below patch restores more a conventional-looking format.

Thanks,
Zev Weiss

diff -Naur iftop-1.0pre4.orig/iftop.c iftop-1.0pre4/iftop.c
--- iftop-1.0pre4.orig/iftop.c  2014-01-19 12:21:19.000000000 -0800
+++ iftop-1.0pre4/iftop.c       2014-02-07 13:26:15.669698968 -0800
@@ -713,7 +713,7 @@
     if(have_hw_addr) {
       fprintf(stderr, "MAC address is:");
       for (i = 0; i < 6; ++i)
-       fprintf(stderr, "%c%02x", i ? ':' : ' ', (unsigned int)if_hw_addr[i]);
+       fprintf(stderr, "%c%02hhx", i ? ':' : ' ', if_hw_addr[i]);
       fprintf(stderr, "\n");
     }



_______________________________________________
iftop-users mailing list
iftop-users@lists.beasts.org
http://lists.beasts.org/mailman/listinfo/iftop-users