summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Marcher <me@drkhsh.at>2018-07-07 14:05:53 +0200
committerAaron Marcher <me@drkhsh.at>2018-07-07 14:05:53 +0200
commitc93971748cb4771aec25aee6e8ff5b7bbb1aacf3 (patch)
tree52532ceeea45d8ff894ab83246ea8eaf19b91238
parentacfa1f50c24add6b9a78d94af21f9350150fb9c2 (diff)
wifi_perc: Simplify on Linux
Remove unnecessary variable
-rw-r--r--components/wifi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/wifi.c b/components/wifi.c
index 9de543b..da00cb3 100644
--- a/components/wifi.c
+++ b/components/wifi.c
@@ -15,8 +15,8 @@
const char *
wifi_perc(const char *interface)
{
- int i, cur;
- int total = 70; /* the max of /proc/net/wireless */
+ int cur;
+ size_t i;
char *p, *datastart;
char path[PATH_MAX];
char status[5];
@@ -59,7 +59,8 @@
sscanf(datastart + 1, " %*d %d %*d %*d\t\t %*d\t "
"%*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 *