L:222 reduced home_dir's scope.

L:318 changed to appropiate format specifier
L:500 changed line's location.
This commit is contained in:
elegantShock2258 2021-10-14 16:53:54 +05:30
parent aa4a14998f
commit 8147b0a528
No known key found for this signature in database
GPG key ID: CABDDF7DC0C18BFA

View file

@ -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);