Merge pull request #65 from dqnk/main

fixed issue with sys.uptime being printed as 0
This commit is contained in:
TheDarkBug 2021-04-07 13:49:54 +02:00 committed by GitHub
commit 098c55ebff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,25 +143,33 @@ int pkgman() { // this is just a function that returns the total of installed pa
} }
void print_info() { void print_info() {
// print collected info - from host to cpu info // store sys info in the sys again
printf("\033[9A\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host); sysinfo(&sys);
printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name); // print collected info - from host to cpu info
printf("\033[18C%s%sKEWNEL %s%s %s\n", NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine); printf("\033[9A\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host);
printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model); printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name);
printf("\033[18C%s%sKEWNEL %s%s %s\n", NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine);
printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model);
// print the gpus // print the gpus
int gpu_iter = 0; int gpu_iter = 0;
while (gpu_model[gpu_iter][0] != '0') { while(gpu_model[gpu_iter][0] != '0') {
printf("\033[18C%s%sGPUWU %s%s\n", NORMAL, BOLD, NORMAL, gpu_model[gpu_iter]); printf( "\033[18C%s%sGPUWU %s%s\n",
gpu_iter++; NORMAL, BOLD, NORMAL, gpu_model[gpu_iter]);
} gpu_iter++;
}
// print ram to uptime and colors // print ram to uptime and colors
printf("\033[18C%s%sWAM %s%i MB/%i MB\n", NORMAL, BOLD, NORMAL, (ram_used), ram_total); printf("\033[18C%s%sWAM %s%i MB/%i MB\n",
printf("\033[18C%s%sSHELL %s%s\n", NORMAL, BOLD, NORMAL, shell); NORMAL, BOLD, NORMAL, (ram_used), ram_total);
printf("\033[18C%s%sPKGS %s%s%d %s\n", NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name); printf("\033[18C%s%sSHELL %s%s\n",
printf("\033[18C%s%sUWUPTIME %s" /*"%lid, " */ "%lih, %lim\n", NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24, */ sys.uptime / 60 / 60, sys.uptime / 60 % 60); NORMAL, BOLD, NORMAL, shell);
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); printf("\033[18C%s%sPKGS %s%s%d %s\n",
NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name);
printf("\033[18C%s%sUWUPTIME %s"/*"%lid, "*/"%lih, %lim\n",
NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24,*/ sys.uptime/60/60, sys.uptime/60%60);
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);
} }
void get_info() { // get all necessary info void get_info() { // get all necessary info
@ -209,7 +217,7 @@ void get_info() { // get all necessary info
// system resources // system resources
uname(&sys_var); uname(&sys_var);
sysinfo(&sys); sysinfo(&sys); // somehow this function has to be called again in print_info()
truncate_name(sys_var.release); truncate_name(sys_var.release);
truncate_name(sys_var.machine); truncate_name(sys_var.machine);