]> err.no Git - moreutils/commitdiff
releasing version 0.20 0.20
authorjoeyh <joeyh>
Sat, 23 Dec 2006 20:58:47 +0000 (20:58 +0000)
committerjoeyh <joeyh>
Sat, 23 Dec 2006 20:58:47 +0000 (20:58 +0000)
debian/changelog
ifdata.c
ifdata.docbook

index 712cb0e8556f2b9f0efe7d0ee4aa2fe01ffe0336..c245223ad797418872eb4984acd2d399ec19785d 100644 (file)
@@ -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 <joeyh@debian.org>  Sun, 26 Nov 2006 14:48:57 -0500
+ -- Joey Hess <joeyh@debian.org>  Sat, 23 Dec 2006 15:55:45 -0500
 
 moreutils (0.19) unstable; urgency=low
 
index c0ee4ae4f9d874ee4ec65bc818d8725684678ba1..2fd4b5160c235cf18fbe7ce7708fcbb55484dac2 100644 (file)
--- 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,
index 60ce90d74cc4ff50d0c342d69a361198079ce661..5f2837f71cb7ea8e1aa8481d854d975174e19ab9 100644 (file)
@@ -285,6 +285,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
                                        packets.</para>
                        </listitem>
                </varlistentry>
+               
+               <varlistentry>
+                       <term><option>-bips</option></term>
+                       <listitem>
+                               <para>Prints the number of bytes of
+                               incoming traffic measured in one second.</para>
+                       </listitem>
+               </varlistentry>
+               
+               <varlistentry>
+                       <term><option>-bops</option></term>
+                       <listitem>
+                               <para>Prints the number of bytes of
+                                outgoing traffic measured in one second.</para>
+                       </listitem>
+               </varlistentry>
 
        </variablelist>
        </refsect1>