19 stfile = open("/sys/class/net/" IFNAME "/carrier", 0);
22 stlen = read(stfile, stline, sizeof(stline) - 1);
25 fputs("^fg(yellow)", stdout);
27 fputs("^fg(red)", stdout);
30 stfile = open("/sys/class/net/" IFNAME "/statistics/rx_bytes", 0);
33 stlen = read(stfile, stline, sizeof(stline) - 1);
39 stfile = open("/sys/class/net/" IFNAME "/statistics/tx_bytes", 0);
42 stlen = read(stfile, stline, sizeof(stline) - 1);
45 ifsum += atof(stline);
48 for(ifsumpower = 0; ifsum >= 1024.0; ifsumpower++)
51 printf(" %s: %.*f %c ", IFNAME, ifsumpower ? ifsumpower - 1 : ifsumpower, ifsum, powertochar(ifsumpower));