From 0bb146470467fb0e42d61efd09fb6b28bcbceeb6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 3 Jan 2024 18:46:17 +0300 Subject: [PATCH] fixed --- build.sh | 2 +- kfetch | Bin 0 -> 18440 bytes src/fetch.c | 5 +++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100755 kfetch 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 0000000000000000000000000000000000000000..42bda444cf7e6e3b178e8e22afd87f49fc6d0037 GIT binary patch literal 18440 zcmeHPe{|GWm4A~-U_zk{mKKDTe1X;^n9NKP2mxBjFECatDWzRnz{zB0!i>x>XC@^G zUDKv#m({9#_pp_%)dtkvq{pstPtP$Ne}GVrSha_;7Fkz4fl|+)tedLq$+*z$=e{44 zmq$i8uKu;YcIJNX=iPVjefQn>*C*}u zNqdT(mVr=I#dGtUnIOgGdVUU*augNM4%u#j#bIXB9}1W$s$%~D+DTPX;>HNIr_XUY z?j}7X)hMd$dD45*nNZBr6^VPIk@&7qs)1)H_5Ue+s6Wl|U@8#_A}bk7)ird1{L!V> zyV|?Dwr=Ggt)M_d^79?j)Xgb?FD!sp7r^U*&&9_qYXD4Vx48g*Ujh7q0{CA6pU&-4KUDz#bOHQx1@JExz`s-g|4IRTqyYZS0{FKJ;6EsU zpDlo2EP(&A0REc-c&-5cb^&|_CdPF6Ii~QN0A5i5XRPQ?_#dr94(5g}x$UsP z9NKk?SOYLBL@Feuxjm)$e9=f(z!!-}GR)@-^!k1NOsJPLsnE^{7Qhsc?nG)A+ZoCv zk{O1NKedx3Q;~S4o2BFOA{L4Tl6zQB+#d_EbS4-|rJxYs@dVfuE)pr$Erq!Sv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)JcM5L``ocj-Dvsf&h`o^F zqRCW;!Cs^X1egpM+zifV?<>-j5icB{;vOf z&eC>EAGN>ZxhpSa2+NY(zhyioK|UQ%4(8N!r8=O8*8sP^i-py;4H zKadTwtqo`*W0DtXiY!>GV37y0(;{M)%&w76dT7a?|w)?S^DlQ-D@ zDB4o&l>dE?fI(6Jj*0sBO5}9R=a2I11Y{|Gs=fMscE?)Mg7;7a$$y*u{|;*O_UeA5 zPquHQO0AgfPoqw6uYSL+{{5CF<(SlAwm%D;FeNrF?jqRuI?=$CH~Ig77}+=bsoI|x eYVzNzJBnUJjk28=!o|Ng3GP=qh-=kO!T$?P$hr*x literal 0 HcmV?d00001 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; } -