all repos — slstatus @ 6c6c144be62d6b2da564f0875ba5f202dbaa3183

my build of slstatus (tools.suckless.org/slstatus/)

wifi_perc: Simplify
Aaron Marcher me@drkhsh.at
Mon, 07 May 2018 12:25:34 +0200
commit

6c6c144be62d6b2da564f0875ba5f202dbaa3183

parent

0a287616b2e3122a1b149e28d63560819bcdf7c9

1 files changed, 1 insertions(+), 4 deletions(-)

jump to
M components/wifi.ccomponents/wifi.c

@@ -16,7 +16,6 @@ const char *

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 @@ datastart = (datastart+(strlen(iface)+1));

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 *