diff -Nur bwmon-1.3/include/bwmon.h bwmon-1.3-2//include/bwmon.h --- bwmon-1.3/include/bwmon.h 2002-05-08 09:37:56.000000000 +0300 +++ bwmon-1.3-2//include/bwmon.h 2011-10-29 19:19:47.456916855 +0300 @@ -33,6 +33,9 @@ #include #endif +#undef ulong +#define ulong unsigned long long + /* * 2.2 kernel supports only 16 network cards, and since there are not * that many 2.4 linuxes running more than 16 interfaces.. @@ -67,7 +70,7 @@ void initialize_total(total_interface_t *); -bool_t do_total(total_interface_t *, interface_t *, int); +bool_t do_total(total_interface_t *, interface_t *); bool_t do_interface(char *, interface_t *, int); bool_t count_average(interface_t *, float *); diff -Nur bwmon-1.3/src/bwmon.c bwmon-1.3-2//src/bwmon.c --- bwmon-1.3/src/bwmon.c 2002-05-10 08:49:31.000000000 +0300 +++ bwmon-1.3-2//src/bwmon.c 2011-10-29 19:29:24.937121710 +0300 @@ -158,7 +158,7 @@ fclose(fp); for (j = 0; j < i; j++) - if (!do_total(&sum_if, &interface[j], first_pass)) + if (!do_total(&sum_if, &interface[j])) fatal("do_total failed in %s", __FUNCTION__); if (!first_pass) { @@ -195,7 +195,7 @@ { char * pbuffer = NULL; int field_number = 0; - unsigned long int conv_field = 0; + ulong conv_field = 0; pbuffer = buffer; pbuffer = strtok(pbuffer, " :"); @@ -215,7 +215,7 @@ field_number = 0; while ((pbuffer = strtok(NULL, " :") ) != NULL) { - conv_field = strtoul(pbuffer, NULL, 10); + conv_field = strtoull(pbuffer, NULL, 10); field_number++; switch (field_number) { @@ -287,7 +287,7 @@ bool_t print_interface(interface_t * interface) { - printw("%12s %7lu.%03u %7lu.%03u %7lu.%03u\n", (*interface)->name, + printw("%12s %7llu.%03u %7llu.%03u %7llu.%03u\n", (*interface)->name, (*interface)->rx_rate_whole, (*interface)->rx_rate_part, (*interface)->tx_rate_whole, (*interface)->tx_rate_part, (*interface)->tot_rate_whole, (*interface)->tot_rate_part ); @@ -304,7 +304,7 @@ max_whole++; max_part -= 1000; } - printw(" max: %7lu.%03u %7lu.%03u %7lu.%03u \n", + printw(" max: %7llu.%03u %7llu.%03u %7llu.%03u \n", (*interface)->rx_max_whole, (*interface)->rx_max_part, (*interface)->tx_max_whole, (*interface)->tx_max_part, max_whole, max_part); @@ -352,8 +352,8 @@ -unsigned long -bwm_calc_remainder(unsigned long num, unsigned long den) +ulong +bwm_calc_remainder(ulong num, ulong den) { unsigned long long n = num, d = den; return (((n - (n / d) * d) * 1000) / d); @@ -368,7 +368,7 @@ } bool_t -do_total(total_interface_t * total_if, interface_t * interface, int first_pass) +do_total(total_interface_t * total_if, interface_t * interface) { total_if->rx_bw_total_whole += (*interface)->rx_rate_whole; total_if->rx_bw_total_part += (*interface)->rx_rate_part; @@ -397,7 +397,7 @@ bool_t print_total(char * method, total_interface_t * total_if) { - printw("%12s %8lu.%03u %8lu.%03u %8lu.%03u\n", method, + printw("%12s %8llu.%03u %8llu.%03u %8llu.%03u\n", method, total_if->rx_bw_total_whole, total_if->rx_bw_total_part, total_if->tx_bw_total_whole, total_if->tx_bw_total_part, total_if->tot_bw_total_whole, total_if->tot_bw_total_part); @@ -418,7 +418,7 @@ hour = tmp % 24; tmp = (tmp - hour) / 24; - if (gethostname(hostname, strlen(hostname)) != 0) + if (gethostname(hostname, sizeof(hostname)/sizeof(char)) != 0) strcpy(hostname, "System"); printw("\n%s uptime: %u day%c %u hour%c %u minutes and %u seconds\n", diff -Nur bwmon-1.3/src/Makefile bwmon-1.3-2//src/Makefile --- bwmon-1.3/src/Makefile 2002-05-03 13:11:52.000000000 +0300 +++ bwmon-1.3-2//src/Makefile 2011-10-29 19:20:05.560152114 +0300 @@ -10,8 +10,8 @@ RM = /bin/rm INSTALL = install -CFLAGS = -I../include -Wall -D__THREADS -LDFLAGS = -lpthread -lncurses +CFLAGS += -I../include -Wall -D__THREADS -s -Wextra +LDFLAGS += -lpthread -lncurses SRC = bwmon.c OBJS = $(SRC:.c=.o)