Fix for #147
This commit is contained in:
parent
de28cf483d
commit
08e16edcaa
1 changed files with 9 additions and 11 deletions
10
uwufetch.c
10
uwufetch.c
|
@ -497,8 +497,8 @@ int read_cache()
|
||||||
|
|
||||||
void print_cache()
|
void print_cache()
|
||||||
{
|
{
|
||||||
// ram
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
|
sysinfo(&sys); // to get uptime
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
FILE *meminfo;
|
FILE *meminfo;
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ void print_cache()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Used
|
// Used ram
|
||||||
FILE *mem_wired_fp, *mem_active_fp, *mem_compressed_fp;
|
FILE *mem_wired_fp, *mem_active_fp, *mem_compressed_fp;
|
||||||
mem_wired_fp = popen("vm_stat | awk '/wired/ { printf $4 }' | cut -d '.' -f 1", "r");
|
mem_wired_fp = popen("vm_stat | awk '/wired/ { printf $4 }' | cut -d '.' -f 1", "r");
|
||||||
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");
|
||||||
|
@ -552,13 +552,11 @@ void print_cache()
|
||||||
int mem_active = atoi(mem_active_ch);
|
int mem_active = atoi(mem_active_ch);
|
||||||
int mem_compressed = atoi(mem_compressed_ch);
|
int mem_compressed = atoi(mem_compressed_ch);
|
||||||
|
|
||||||
// Total
|
// Total ram
|
||||||
sysctlbyname("hw.memsize", &mem_buffer, &mem_buffer_len, NULL, 0);
|
sysctlbyname("hw.memsize", &mem_buffer, &mem_buffer_len, NULL, 0);
|
||||||
|
|
||||||
ram_used = ((mem_wired + mem_active + mem_compressed) * 4 / 1024);
|
ram_used = ((mem_wired + mem_active + mem_compressed) * 4 / 1024);
|
||||||
#endif
|
|
||||||
|
|
||||||
sysinfo(&sys); // to get uptime
|
#endif
|
||||||
|
|
||||||
print_ascii();
|
print_ascii();
|
||||||
print_info();
|
print_info();
|
||||||
|
|
Loading…
Reference in a new issue