From: joeyh Date: Sat, 23 Dec 2006 20:58:47 +0000 (+0000) Subject: releasing version 0.20 X-Git-Tag: 0.20 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6547b684543ce4dca051366714065d6482e7bd5;p=moreutils releasing version 0.20 --- diff --git a/debian/changelog b/debian/changelog index 712cb0e..c245223 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ -moreutils (0.20) UNRELEASED; urgency=low +moreutils (0.20) unstable; urgency=low * Typo fixes from Ralf Wildenhues. + * ifdata: Add -bips and -bops options contributed by André Appel, + to print the number of bytes of incoming/outgoing traffic per second. - -- Joey Hess Sun, 26 Nov 2006 14:48:57 -0500 + -- Joey Hess Sat, 23 Dec 2006 15:55:45 -0500 moreutils (0.19) unstable; urgency=low diff --git a/ifdata.c b/ifdata.c index c0ee4ae..2fd4b51 100644 --- a/ifdata.c +++ b/ifdata.c @@ -42,6 +42,8 @@ enum { DO_SOUTMULTICAST, DO_PNETWORK, DO_PHWADDRESS, + DO_BIPS, + DO_BOPS }; struct if_stat { @@ -309,6 +311,8 @@ const struct { { "-sox", DO_SOUTCOLLS, 1, "Print # of out collisions" }, { "-soc", DO_SOUTCARRIER, 1, "Print # of out carrier loss" }, { "-som", DO_SOUTMULTICAST, 1, "Print # of out multicast" }, + { "-bips",DO_BIPS, 1, "Print # of incoming bytes per second" }, + { "-bops",DO_BOPS, 1, "Print # of outgoing bytes per second" }, }; void usage(const char *name) { @@ -335,7 +339,7 @@ static void print_addr(struct sockaddr *sadr) { print_quad(sadr); } -struct if_stat *ifstats; +struct if_stat *ifstats, *ifstats2 = NULL; void please_do(int ndo, int *todo, const char *ifname) { int i; @@ -435,6 +439,20 @@ void please_do(int ndo, int *todo, const char *ifname) { case DO_SOUTMULTICAST: printf("%llu",ifstats->out_multicast); break; + case DO_BIPS: + if (ifstats2 == NULL) { + sleep(1); + ifstats2 = get_stats(ifname); + } + printf("%llu", ifstats2->in_bytes-ifstats->in_bytes); + break; + case DO_BOPS: + if (ifstats2 == NULL) { + sleep(1); + ifstats2 = get_stats(ifname); + } + printf("%llu", ifstats2->out_bytes-ifstats->out_bytes); + break; case DO_SOUTALL: printf("%llu %llu %llu %llu %llu %llu %llu %llu", ifstats->out_bytes, ifstats->out_packets, diff --git a/ifdata.docbook b/ifdata.docbook index 60ce90d..5f2837f 100644 --- a/ifdata.docbook +++ b/ifdata.docbook @@ -285,6 +285,22 @@ with this program; if not, write to the Free Software Foundation, Inc., packets. + + + + + Prints the number of bytes of + incoming traffic measured in one second. + + + + + + + Prints the number of bytes of + outgoing traffic measured in one second. + +