]> granicus.if.org Git - vnstat/commitdiff
remove unused variables and functionality
authorTeemu Toivola <git@humdi.net>
Sat, 27 Jun 2015 20:10:30 +0000 (23:10 +0300)
committerTeemu Toivola <git@humdi.net>
Sat, 27 Jun 2015 20:10:30 +0000 (23:10 +0300)
src/traffic.c

index d78e51cea7faafac36fcade3536e829b8d2daea5..c42b7a24dbcb1291810c84bedf6e372a16fb6689 100644 (file)
@@ -9,7 +9,6 @@ void trafficmeter(char iface[], int sampletime)
        /* transmitted bytes packets errs drop fifo colls carrier compressed */
        uint64_t rx, tx, rxp, txp;
        IFINFO firstinfo;
-       int i, len;
        char buffer[256];
 
        /* less than 2 seconds doesn't produce good results */
@@ -77,14 +76,12 @@ void livetrafficmeter(char iface[32], int mode)
        uint64_t rxtotal, txtotal, rxptotal, txptotal;
        uint64_t rxpmin, txpmin, rxpmax, txpmax;
        uint64_t rxmin, txmin, rxmax, txmax;
-       int i, len=0;
        char buffer[256], buffer2[256];
        IFINFO previnfo;
 
        printf("Monitoring %s...    (press CTRL-C to stop)\n\n", iface);
        if (cfg.ostyle != 4) {
                printf("   getting traffic...");
-               len=21; /* length of previous print */
                fflush(stdout);
        }
 
@@ -180,13 +177,9 @@ void livetrafficmeter(char iface[32], int mode)
                }
                strncat(buffer, buffer2, 127);
 
-               if (len>1 && cfg.ostyle!=4) {
-                       if (debug) {
-                               printf("\nlinelen: %d\n", len);
-                       } else {
-                               cursortocolumn(1);
-                               eraseline();
-                       }
+               if (cfg.ostyle!=4 || !debug) {
+                       cursortocolumn(1);
+                       eraseline();
                }
                if (cfg.ostyle!=4) {
                        printf("%s", buffer);
@@ -194,8 +187,6 @@ void livetrafficmeter(char iface[32], int mode)
                } else {
                        printf("%s\n", buffer);
                }
-               len=strlen(buffer);
-
        }
 
        timespent = (uint64_t)time(NULL) - timespent - timeslept;