wifi_perc: Simplify on Linux
Remove unnecessary variable
This commit is contained in:
parent
acfa1f50c2
commit
c93971748c
@ -15,8 +15,8 @@
|
|||||||
const char *
|
const char *
|
||||||
wifi_perc(const char *interface)
|
wifi_perc(const char *interface)
|
||||||
{
|
{
|
||||||
int i, cur;
|
int cur;
|
||||||
int total = 70; /* the max of /proc/net/wireless */
|
size_t i;
|
||||||
char *p, *datastart;
|
char *p, *datastart;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char status[5];
|
char status[5];
|
||||||
@ -59,7 +59,8 @@
|
|||||||
sscanf(datastart + 1, " %*d %d %*d %*d\t\t %*d\t "
|
sscanf(datastart + 1, " %*d %d %*d %*d\t\t %*d\t "
|
||||||
"%*d\t\t%*d\t\t %*d\t %*d\t\t %*d", &cur);
|
"%*d\t\t%*d\t\t %*d\t %*d\t\t %*d", &cur);
|
||||||
|
|
||||||
return bprintf("%d", (int)((float)cur / total * 100));
|
/* 70 is the max of /proc/net/wireless */
|
||||||
|
return bprintf("%d", (int)((float)cur / 70 * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user