projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a28761
)
wifi_perc: Simplify
author
Aaron Marcher
<me@drkhsh.at>
Mon, 7 May 2018 10:25:34 +0000
(12:25 +0200)
committer
Aaron Marcher
<me@drkhsh.at>
Mon, 7 May 2018 10:25:34 +0000
(12:25 +0200)
components/wifi.c
patch
|
blob
|
history
diff --git
a/components/wifi.c
b/components/wifi.c
index 139ec8ca95846094dc1898534120a0efbb9ca1c6..24dca362fd5348af2c81dea11cf3af5597c13ff9 100644
(file)
--- a/
components/wifi.c
+++ b/
components/wifi.c
@@
-16,7
+16,6
@@
wifi_perc(const char *iface)
{
int i, cur;
- float perc;
int total = 70; /* the max of /proc/net/wireless */
char *p, *datastart;
char path[PATH_MAX];
@@
-59,9
+58,7
@@
sscanf(datastart + 1, " %*d %d %*d %*d\t\t %*d\t "
"%*d\t\t%*d\t\t %*d\t %*d\t\t %*d", &cur);
- perc = (float)cur / total * 100.0;
-
- return bprintf("%.0f", perc);
+ return bprintf("%d", (int)((float)cur / total * 100));
}
const char *