From e2b782522773cda393358f83fd903564b53628e0 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Thu, 6 Nov 2014 23:36:06 -0500 Subject: fix vims goto indent, use stats not statistics_string and increment after variable (stylistic in this case --- fsbm.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'fsbm.c') diff --git a/fsbm.c b/fsbm.c index d099640..8fd2408 100644 --- a/fsbm.c +++ b/fsbm.c @@ -50,7 +50,7 @@ void print_bps(double bytesPerSecond) { // Choose the prefix while (prefix < (sizeof(prefixes) / sizeof(const char*)) && value > 1000.) { value /= 1000.; - ++prefix; + prefix++; } // Format the string @@ -69,7 +69,7 @@ void print_stats() { // Read /proc/dev/net while (!feof(dev)) { char buf[512]; - char *name, *statistics_string; + char *name, *stats; long long unsigned rx_bytes, tx_bytes; struct timezone unused_timezone; struct timeval timestamp; @@ -82,22 +82,23 @@ void print_stats() { gettimeofday(×tamp, &unused_timezone); // Find the colon separating the name from the statistics - statistics_string = strchr(buf, ':'); - if (!statistics_string) continue; + stats = strchr(buf, ':'); + if (!stats) + continue; // Get a pointer to the statistics - *statistics_string = 0; - ++statistics_string; + *stats = 0; + stats++; // Remove leading whitespace from the name name = buf; while (*name == ' ' || *name == '\t') { - ++name; + name++; } len = name - buf; // Parse the statistics, alls well, then get this shit going, otherwise f it. - if (sscanf(statistics_string, "%Lu %*Lu %*Lu %*Lu %*Lu %*Lu %*Lu %*Lu %Lu", + if (sscanf(stats, "%Lu %*Lu %*Lu %*Lu %*Lu %*Lu %*Lu %*Lu %Lu", &rx_bytes, &tx_bytes) == 2) { size_t i = 0; @@ -112,7 +113,7 @@ void print_stats() { break; } } -skip: + skip: if(found) { double timeDelta, rx_speed, tx_speed = 0; -- cgit v1.2.3