Fixed #71, added prettier kernel info.

This commit is contained in:
TheDarkBug 2021-04-14 18:19:17 +02:00
parent 879c56ef7a
commit 119504feb4
2 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,6 @@
NAME = uwufetch NAME = uwufetch
FILES = uwufetch.c FILES = uwufetch.c
CFLAGS = CFLAGS = -O3
CFLAGS_DEBUG = -Wall -Wextra CFLAGS_DEBUG = -Wall -Wextra
PREFIX = /usr/bin PREFIX = /usr/bin
CC = cc CC = cc

View file

@ -60,8 +60,8 @@ int ascii_image_flag = 0,
show_pkgs = 1, show_pkgs = 1,
show_uptime = 1, show_uptime = 1,
show_colors = 1; show_colors = 1;
char user[32], host[256], shell[64], version_name[64], cpu_model[256], char user[32], host[256], shell[64], kernel[256], version_name[64], cpu_model[256],
gpu_model[8][256] = { { '0' }, { '0' }, { '0' }, { '0' }, { '0' }, { '0' }, { '0' }, { '0' } }, gpu_model[8][256] = {{'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}},
pkgman_name[64], image_name[32]; pkgman_name[64], image_name[32];
// functions definitions, to use them in main() // functions definitions, to use them in main()
@ -182,12 +182,11 @@ int pkgman() { // this is just a function that returns the total of installed pa
void print_info() { void print_info() {
// store sys info in the sys again // store sys info in the sys again
sysinfo(&sys);
// print collected info - from host to cpu info // print collected info - from host to cpu info
printf("\033[9A"); // to align info text printf("\033[9A"); // to align info text
if (show_user_info) printf("\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host); if (show_user_info) printf("\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host);
if (show_os) printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name); if (show_os) printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name);
if (show_kernel) printf("\033[18C%s%sKEWNEL %s%s %s\n", NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine); if (show_kernel) printf("\033[18C%s%sKEWNEL %s%s\n", NORMAL, BOLD, NORMAL, kernel);
if (show_cpu) printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model); if (show_cpu) printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model);
// print the gpus // print the gpus
@ -256,10 +255,11 @@ void get_info() { // get all necessary info
// system resources // system resources
uname(&sys_var); uname(&sys_var);
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()
truncate_name(sys_var.release); truncate_name(sys_var.release);
truncate_name(sys_var.machine); sprintf(kernel, "%s %s %s", sys_var.sysname, sys_var.release, sys_var.machine);
truncate_name(kernel);
// ram // ram
FILE *meminfo; FILE *meminfo;