From 8147b0a528a461a2ebef9b03597a9e4c056d134e Mon Sep 17 00:00:00 2001 From: elegantShock2258 Date: Thu, 14 Oct 2021 16:53:54 +0530 Subject: [PATCH] L:222 reduced home_dir's scope. L:318 changed to appropiate format specifier L:500 changed line's location. --- uwufetch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uwufetch.c b/uwufetch.c index 791d5d7..4014b3b 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -207,7 +207,6 @@ int main(int argc, char *argv[]) void parse_config() { char line[256]; - char homedir[512]; // opening and reading the config file FILE *config=NULL; @@ -215,6 +214,7 @@ void parse_config() { if (getenv("HOME") != NULL) { + char homedir[512]; sprintf(homedir, "%s/.config/uwufetch/config", getenv("HOME")); config = fopen(homedir, "r"); } @@ -315,7 +315,7 @@ int pkgman() comma_separator++; char spkg_count[16]; - sprintf(spkg_count, "%d", pkg_count); + sprintf(spkg_count, "%u", pkg_count); strcat(pkgman_name, spkg_count); strcat(pkgman_name, " "); strcat(pkgman_name, current->pkgman_name); // this is the line that breaks mac os, but something strange happens before @@ -497,7 +497,6 @@ int read_cache() void print_cache() { - char line[256]; // ram #ifndef __APPLE__ #ifndef __CYGWIN__ @@ -508,6 +507,7 @@ void print_cache() #else meminfo = popen("LANG=EN_us free -m 2> /dev/null", "r"); #endif + char line[256]; while (fgets(line, sizeof(line), meminfo)) // free command prints like this: "Mem:" total used free shared buff/cache available sscanf(line, "Mem: %d %d", &ram_total, &ram_used);