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 *
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;
}