GetMem fixed, build fixed
This commit is contained in:
parent
8a789784cc
commit
e59cd1d2a0
2
Makefile
2
Makefile
@ -5,4 +5,4 @@ all:
|
||||
$(CC) src/*.c -Iinclude -I. $(CFLAGS) -okfetch
|
||||
|
||||
clean:
|
||||
rm kfetch
|
||||
rm obj/* bin/*
|
||||
|
5
config.h
5
config.h
@ -12,7 +12,8 @@ typedef struct {
|
||||
#define FONT_COLOR "\033[37m"
|
||||
#define PC_CHAR "%"
|
||||
|
||||
static PARAMETR CONFIG[] = {
|
||||
#ifdef _MAIN_H
|
||||
PARAMETR CONFIG[] = {
|
||||
{" OS ", PrintOs},
|
||||
{" KERNEL ", GetKernel},
|
||||
{" USER ", GetUser},
|
||||
@ -26,3 +27,5 @@ static PARAMETR CONFIG[] = {
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -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…
Reference in New Issue
Block a user