diff --git a/build.sh b/build.sh index 3108dc0..f5bf681 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh CC=cc -FLAGS="-Os -s" +FLAGS="-Os -s -pedantic -Wall -Wextra" $CC -Iinclude -I. src/main.c -c -o main.o && $CC -Iinclude -I. src/fetch.c -c -o fetch.o && diff --git a/kfetch b/kfetch new file mode 100755 index 0000000..42bda44 Binary files /dev/null and b/kfetch differ diff --git a/src/fetch.c b/src/fetch.c index 07b95b5..13665cc 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -190,6 +190,7 @@ int GetMem(const char *title, const FETCH fetch) { if (fscanf(fp, "MemTotal: %lu kB\nMemFree: %lu kB", &total, &free) < 0) return 1; + fclose(fp); #ifdef PRINT_USED_AND_TOTAL_MEM printf("%s%s%s%lumb / %lumb", fetch.color, title, fetch.font_color, (uintmax_t)(total - free) / 1024, (uintmax_t)total / 1024); @@ -201,7 +202,6 @@ int GetMem(const char *title, const FETCH fetch) { #endif - fclose(fp); return 0; } @@ -305,8 +305,9 @@ int GetBattery(const char *title, const FETCH fetch) { if (fscanf(fp, "%d", &capacity) < 0) return 1; + fclose(fp); + printf("%s%s%s", fetch.color, title, fetch.font_color); DrawBar(capacity, 100); return 0; } -