diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-11-06 23:36:06 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-11-06 23:36:06 -0500 |
commit | e2b782522773cda393358f83fd903564b53628e0 (patch) | |
tree | 2271854eb4516524e2a2106993441b7787c689d1 /fsbm.c | |
parent | 3f032ebdfc58608c2f02d379fd67a9ab79845e83 (diff) |
fix vims goto indent, use stats not statistics_string and increment after variable (stylistic in this case
Diffstat (limited to 'fsbm.c')
-rw-r--r-- | fsbm.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -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; |