GetMem fixed, build fixed
This commit is contained in:
parent
8a789784cc
commit
e59cd1d2a0
4 changed files with 10 additions and 6 deletions
|
@ -180,15 +180,15 @@ int GetPkg(const char *title, const FETCH fetch) {
|
|||
}
|
||||
|
||||
int GetMem(const char *title, const FETCH fetch) {
|
||||
unsigned int free = 0, cache = 0, total = 0, unused;
|
||||
UNUSED(unused);
|
||||
|
||||
FILE *fp = fopen("/proc/meminfo", "r");
|
||||
if (fp == NULL)
|
||||
return 1;
|
||||
|
||||
fscanf(fp, "MemTotal: %u kB\nMemFree: %u kB\nMemAvailable: %u kB\nBuffers: %u kB\nCached: %u kB", &total, &free, &unused, &unused, &cache);
|
||||
unsigned int free = 0, cache = 0, total = 0, unused;
|
||||
if (fscanf(fp, "MemTotal: %u kB\nMemFree: %u kB\nMemAvailable: %u kB\nBuffers: %u kB\nCached: %u kB", &total, &free, &unused, &unused, &cache) < 0)
|
||||
return 1;
|
||||
|
||||
UNUSED(unused);
|
||||
printf("%s%s%s%umb / %umb", fetch.color, title, fetch.font_color, (free + cache) / 1024, total / 1024);
|
||||
fclose(fp);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#define _MAIN_H
|
||||
#include <stdio.h>
|
||||
#include "fetch.h"
|
||||
#include "config.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue