[hackers] [slstatus] Use %d instead of accidentally %i || Aaron Marcher
commit f3178199848911c8fb51b30e3993ae47120fcc6c
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Fri May 18 19:58:51 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Fri May 18 19:58:51 2018 +0200
Use %d instead of accidentally %i
diff --git a/components/battery.c b/components/battery.c
index c7c402a..3965e8f 100644
--- a/components/battery.c
+++ b/components/battery.c
_AT_@ -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 *
_AT_@ -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", ¤t_now) != 1) {
+ if (pscanf(path, "%d", ¤t_now) != 1) {
return NULL;
}
diff --git a/components/cpu.c b/components/cpu.c
index b9b3924..60a7991 100644
--- a/components/cpu.c
+++ b/components/cpu.c
_AT_@ -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;
}
Received on Fri May 18 2018 - 19:59:47 CEST
This archive was generated by hypermail 2.3.0
: Fri May 18 2018 - 20:00:27 CEST