Merge pull request #65 from dqnk/main
fixed issue with sys.uptime being printed as 0
This commit is contained in:
commit
098c55ebff
1 changed files with 27 additions and 19 deletions
24
uwufetch.c
24
uwufetch.c
|
@ -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);
|
||||
|
@ -151,17 +153,23 @@ 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]);
|
||||
while(gpu_model[gpu_iter][0] != '0') {
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue