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,6 +143,8 @@ int pkgman() { // this is just a function that returns the total of installed pa
}
void print_info() {
// store sys info in the sys again
sysinfo(&sys);
// print collected info - from host to cpu info
printf("\033[9A\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host);
printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name);
@ -152,16 +154,22 @@ void print_info() {
// print the gpus
int gpu_iter = 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",
NORMAL, BOLD, NORMAL, gpu_model[gpu_iter]);
gpu_iter++;
}
// 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%sSHELL %s%s\n", NORMAL, BOLD, NORMAL, shell);
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);
printf("\033[18C%s%sWAM %s%i MB/%i MB\n",
NORMAL, BOLD, NORMAL, (ram_used), ram_total);
printf("\033[18C%s%sSHELL %s%s\n",
NORMAL, BOLD, NORMAL, shell);
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
@ -209,7 +217,7 @@ void get_info() { // get all necessary info
// system resources
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.machine);