fix uwufetch mac code

This commit is contained in:
sech1p 2021-04-16 14:10:33 +02:00
parent 5ac94df5bf
commit 3016198062

View file

@ -71,6 +71,7 @@ struct winsize win;
int ram_total, ram_used = 0; int ram_total, ram_used = 0;
// initialise the variables to store data, gpu array can hold up to 8 gpus // initialise the variables to store data, gpu array can hold up to 8 gpus
int pkgs, target_width = 0; int pkgs, target_width = 0;
long uptime = 0;
// all flags available // all flags available
int ascii_image_flag = 0, int ascii_image_flag = 0,
screen_width = 0, screen_width = 0,
@ -293,17 +294,17 @@ void print_info()
printf("\033[18C%s%sPKGS %s%s%d %s\n", printf("\033[18C%s%sPKGS %s%s%d %s\n",
NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name); NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name);
if (show_uptime) if (show_uptime)
#ifndef __APPLE__ #ifdef __APPLE__
printf("\033[18C%s%sUWUPTIME %s" /*"%lid, "*/ "%lih, %lim\n", uptime = uptime_mac();
NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24,*/ sys.uptime / 60 / 60, sys.uptime / 60 % 60); #else
#else uptime = sys.uptime;
if (sys.uptime / 3600 < 24) #endif
if (uptime / 3600 < 24)
printf("\033[18C%s%sUWUPTIME %s%lih, %lim\n", printf("\033[18C%s%sUWUPTIME %s%lih, %lim\n",
NORMAL, BOLD, NORMAL, sys.uptime / 3600, sys.uptime / 60 % 60); NORMAL, BOLD, NORMAL, uptime / 3600, uptime / 60 % 60);
else else
printf("\033[18C%s%sUWUPTIME %s%lid, %lih, %lim\n", printf("\033[18C%s%sUWUPTIME %s%lid, %lih, %lim\n",
NORMAL, BOLD, NORMAL, sys.uptime / 86400, sys.uptime / 3600 % 24, sys.uptime / 60 % 60); NORMAL, BOLD, NORMAL, uptime / 86400, uptime / 3600 % 24, uptime / 60 % 60);
#endif
if (show_colors) if (show_colors)
printf("\033[18C%s%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\n", printf("\033[18C%s%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\n",
BOLD, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, NORMAL); BOLD, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, NORMAL);
@ -374,7 +375,9 @@ void get_info()
// system resources // system resources
uname(&sys_var); uname(&sys_var);
#ifndef __APPLE__
sysinfo(&sys); // somehow this function has to be called again in print_info() sysinfo(&sys); // somehow this function has to be called again in print_info()
#endif
truncate_name(sys_var.release); truncate_name(sys_var.release);
sprintf(kernel, "%s %s %s", sys_var.sysname, sys_var.release, sys_var.machine); sprintf(kernel, "%s %s %s", sys_var.sysname, sys_var.release, sys_var.machine);