diff options
author | norly <ny-git@enpas.org> | 2012-02-14 00:13:28 +0000 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2012-02-14 00:13:28 +0000 |
commit | 38a130597b1f52028f7df79ab5f348dc306afa85 (patch) | |
tree | b90b668a0e25d10be79b4029815c69f23b41b137 /statuses/netif.c | |
parent | 5a9cc1b0d20efa65d10adaaf06d0ef0aa089663c (diff) |
Some build system cleanup.
Diffstat (limited to 'statuses/netif.c')
-rw-r--r-- | statuses/netif.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/statuses/netif.c b/statuses/netif.c deleted file mode 100644 index 944fe2c..0000000 --- a/statuses/netif.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <fcntl.h> -#include <unistd.h> -#include "netif.h" -#include "tools.h" -#include "../config.h" - -void status_netif() -{ - char stline[16]; - int stfile; - size_t stlen; - - double ifsum; - int ifsumpower; - - - stfile = open("/sys/class/net/" IFNAME "/carrier", 0); - if (stfile != -1) - { - stlen = read(stfile, stline, sizeof(stline) - 1); - close(stfile); - if (stline[0] == '1') - fputs("^fg(yellow)", stdout); - else - fputs("^fg(red)", stdout); - } - - stfile = open("/sys/class/net/" IFNAME "/statistics/rx_bytes", 0); - if (stfile != -1) - { - stlen = read(stfile, stline, sizeof(stline) - 1); - close(stfile); - stline[stlen] = '\0'; - ifsum = atof(stline); - } - - stfile = open("/sys/class/net/" IFNAME "/statistics/tx_bytes", 0); - if (stfile != -1) - { - stlen = read(stfile, stline, sizeof(stline) - 1); - close(stfile); - stline[stlen] = '\0'; - ifsum += atof(stline); - } - - for(ifsumpower = 0; ifsum >= 1024.0; ifsumpower++) - ifsum = ifsum / 1024; - - printf(" %s: %.*f %c ", IFNAME, ifsumpower ? ifsumpower - 1 : ifsumpower, ifsum, powertochar(ifsumpower)); -} |