Fixed build errors on linux (line 356)

This commit is contained in:
TheDarkBug 2021-04-16 10:48:39 +02:00
parent d3822b5c54
commit 4b2f69c166

View file

@ -352,10 +352,12 @@ void get_info()
else if (library) // macOS else if (library) // macOS
{ {
closedir(library); closedir(library);
#ifdef __APPLE__
sysctlbyname("machdep.cpu.brand_string", &cpu_buffer, &cpu_buffer_len, NULL, 0); sysctlbyname("machdep.cpu.brand_string", &cpu_buffer, &cpu_buffer_len, NULL, 0);
sprintf(version_name, "macos"); sprintf(version_name, "macos");
sprintf(cpu_model, "%s", cpu_buffer); sprintf(cpu_model, "%s", cpu_buffer);
#endif
} }
else else
sprintf(version_name, "unknown"); sprintf(version_name, "unknown");
@ -405,13 +407,19 @@ void get_info()
mem_active_fp = popen("vm_stat | awk '/active/ { printf $3 }' | cut -d '.' -f 1", "r"); mem_active_fp = popen("vm_stat | awk '/active/ { printf $3 }' | cut -d '.' -f 1", "r");
mem_compressed_fp = popen("vm_stat | awk '/occupied/ { printf $5 }' | cut -d '.' -f 1", "r"); mem_compressed_fp = popen("vm_stat | awk '/occupied/ { printf $5 }' | cut -d '.' -f 1", "r");
char mem_wired_ch[2137], mem_active_ch[2137], mem_compressed_ch[2137]; char mem_wired_ch[2137], mem_active_ch[2137], mem_compressed_ch[2137];
while(fgets(mem_wired_ch, sizeof(mem_wired_ch), mem_wired_fp) != NULL) { while (fgets(mem_wired_ch, sizeof(mem_wired_ch), mem_wired_fp) != NULL)
while(fgets(mem_active_ch, sizeof(mem_active_ch), mem_active_fp) != NULL) { {
while(fgets(mem_compressed_ch, sizeof(mem_compressed_ch), mem_compressed_fp) != NULL) {} while (fgets(mem_active_ch, sizeof(mem_active_ch), mem_active_fp) != NULL)
{
while (fgets(mem_compressed_ch, sizeof(mem_compressed_ch), mem_compressed_fp) != NULL)
{
}
} }
} }
pclose(mem_wired_fp); pclose(mem_active_fp); pclose(mem_compressed_fp); pclose(mem_wired_fp);
pclose(mem_active_fp);
pclose(mem_compressed_fp);
int mem_wired = atoi(mem_wired_ch); int mem_wired = atoi(mem_wired_ch);
int mem_active = atoi(mem_active_ch); int mem_active = atoi(mem_active_ch);
@ -697,7 +705,8 @@ void print_ascii()
"%s w w\n" "%s w w\n"
"%s w w\n" "%s w w\n"
"%s w w\n" "%s w w\n"
" www_-_www\n\n", GREEN, YELLOW, RED, PINK, BLUE); " www_-_www\n\n",
GREEN, YELLOW, RED, PINK, BLUE);
} }
// everything else // everything else