remove format characters from stat functions
This commit is contained in:
parent
832b21ca4b
commit
abbaa7af44
@ -41,8 +41,8 @@
|
|||||||
- wifi_perc (wifi signal in percent) [argument: wifi card interface name]
|
- wifi_perc (wifi signal in percent) [argument: wifi card interface name]
|
||||||
- wifi_essid (wifi essid) [argument: wifi card interface name] */
|
- wifi_essid (wifi essid) [argument: wifi card interface name] */
|
||||||
static const struct arg args[] = {
|
static const struct arg args[] = {
|
||||||
/* function format argument */
|
/* function format argument */
|
||||||
{ cpu_perc, "[CPU %4s] ", NULL },
|
{ cpu_perc, "[CPU %3s%%] ", NULL },
|
||||||
{ ram_perc, "[RAM %3s] ", NULL },
|
{ ram_perc, "[RAM %2s%%] ", NULL },
|
||||||
{ datetime, "[ %s ]", "%F %T" },
|
{ datetime, "[ %s ]", "%F %T" },
|
||||||
};
|
};
|
||||||
|
16
slstatus.c
16
slstatus.c
@ -117,7 +117,7 @@ battery_perc(const char *bat)
|
|||||||
fscanf(fp, "%i", &perc);
|
fscanf(fp, "%i", &perc);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return smprintf("%d%%", perc);
|
return smprintf("%d", perc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -212,7 +212,7 @@ cpu_perc(void)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
perc = 100 * ((b[0]+b[1]+b[2]) - (a[0]+a[1]+a[2])) / ((b[0]+b[1]+b[2]+b[3]) - (a[0]+a[1]+a[2]+a[3]));
|
perc = 100 * ((b[0]+b[1]+b[2]) - (a[0]+a[1]+a[2])) / ((b[0]+b[1]+b[2]+b[3]) - (a[0]+a[1]+a[2]+a[3]));
|
||||||
return smprintf("%d%%", perc);
|
return smprintf("%d", perc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -255,7 +255,7 @@ disk_perc(const char *mnt)
|
|||||||
|
|
||||||
perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
|
perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
|
||||||
|
|
||||||
return smprintf("%d%%", perc);
|
return smprintf("%d", perc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -433,7 +433,7 @@ ram_perc(void)
|
|||||||
fscanf(fp, "Cached: %ld kB\n", &cached);
|
fscanf(fp, "Cached: %ld kB\n", &cached);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return smprintf("%d%%", 100 * ((total - free) - (buffers + cached)) / total);
|
return smprintf("%d", 100 * ((total - free) - (buffers + cached)) / total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -572,7 +572,7 @@ swap_perc(void)
|
|||||||
}
|
}
|
||||||
sscanf(match, "SwapFree: %ld kB\n", &free);
|
sscanf(match, "SwapFree: %ld kB\n", &free);
|
||||||
|
|
||||||
return smprintf("%d%%", 100 * (total - free - cached) / total);
|
return smprintf("%d", 100 * (total - free - cached) / total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -661,7 +661,7 @@ temp(const char *file)
|
|||||||
fscanf(fp, "%d", &temp);
|
fscanf(fp, "%d", &temp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return smprintf("%d°C", temp / 1000);
|
return smprintf("%d", temp / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -728,7 +728,7 @@ vol_perc(const char *card)
|
|||||||
|
|
||||||
close(afd);
|
close(afd);
|
||||||
|
|
||||||
return smprintf("%d%%", v & 0xff);
|
return smprintf("%d", v & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -770,7 +770,7 @@ wifi_perc(const char *iface)
|
|||||||
datastart = (datastart+(strlen(iface)+1));
|
datastart = (datastart+(strlen(iface)+1));
|
||||||
sscanf(datastart + 1, " %*d %d %*d %*d %*d %*d %*d %*d %*d %*d", &perc);
|
sscanf(datastart + 1, " %*d %d %*d %*d %*d %*d %*d %*d %*d %*d", &perc);
|
||||||
|
|
||||||
return smprintf("%d%%", perc);
|
return smprintf("%d", perc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
Loading…
Reference in New Issue
Block a user