slstatus

My fork of https://tools.suckless.org/slstatus/
git clone https://git.inz.fi/slstatus
Log | Files | Refs | README | LICENSE

commit f3178199848911c8fb51b30e3993ae47120fcc6c
parent f170028527bdccead9a99797b45011d5e76100f1
Author: Aaron Marcher <me@drkhsh.at>
Date:   Fri, 18 May 2018 19:58:51 +0200

Use %d instead of accidentally %i

Diffstat:
Mcomponents/battery.c | 6+++---
Mcomponents/cpu.c | 2+-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/battery.c b/components/battery.c @@ -16,7 +16,7 @@ snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/", bat, "/capacity"); - return (pscanf(path, "%i", &perc) == 1) ? bprintf("%d", perc) : NULL; + return (pscanf(path, "%d", &perc) == 1) ? bprintf("%d", perc) : NULL; } const char * @@ -62,12 +62,12 @@ if (!strcmp(state, "Discharging")) { snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/", bat, "/charge_now"); - if (pscanf(path, "%i", &charge_now) != 1) { + if (pscanf(path, "%d", &charge_now) != 1) { return NULL; } snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/", bat, "/current_now"); - if (pscanf(path, "%i", &current_now) != 1) { + if (pscanf(path, "%d", &current_now) != 1) { return NULL; } diff --git a/components/cpu.c b/components/cpu.c @@ -12,7 +12,7 @@ int freq; return (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", - "%i", &freq) == 1) ? + "%d", &freq) == 1) ? bprintf("%d", (freq + 500) / 1000) : NULL; }