From eb06f27ff2c306bd57f5e56e7e1425cde170ab79 Mon Sep 17 00:00:00 2001 From: TheDarkBug <41623496+TheDarkBug@users.noreply.github.com> Date: Mon, 1 Nov 2021 15:03:45 +0100 Subject: [PATCH] Revert "feat: responsively print width" --- uwufetch.c | 72 ++++++++++++++++++------------------------------------ 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/uwufetch.c b/uwufetch.c index 3e95891..56085b0 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -355,65 +355,44 @@ int uptime_freebsd() void print_info() { -#define responsively_printf(buf, format, ...) { \ - sprintf(buf, format, __VA_ARGS__); \ - printf("%.*s\n", win.ws_col-1, buf); \ -} - char print_buf[255]; // for responsively print - // print collected info - from host to cpu info printf("\033[9A"); // to align info text - if (show_user_info) { - responsively_printf(print_buf, "\033[18C%s%s%s@%s", NORMAL, BOLD, user, host); - } + if (show_user_info) + printf("\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host); uwu_name(); - if (show_os) { - responsively_printf(print_buf, "\033[18C%s%sOWOS %s%s", NORMAL, BOLD, NORMAL, version_name); - } - if (show_host) { - responsively_printf(print_buf, "\033[18C%s%sHOWOST %s%s", NORMAL, BOLD, NORMAL, host_model); - } - if (show_kernel) { - responsively_printf(print_buf, "\033[18C%s%sKEWNEL %s%s", NORMAL, BOLD, NORMAL, kernel); - } - if (show_cpu) { - responsively_printf(print_buf, "\033[18C%s%sCPUWU %s%s", NORMAL, BOLD, NORMAL, cpu_model); - } + if (show_os) + printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name); + if (show_host) + printf("\033[18C%s%sHOWOST %s%s\n", NORMAL, BOLD, NORMAL, host_model); + 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); // print the gpus - if (show_gpu) { + if (show_gpu) for (int i = 0; gpu_model[i][0]; i++) - responsively_printf(print_buf, - "\033[18C%s%sGPUWU %s%s", - NORMAL, BOLD, NORMAL, gpu_model[i]); - } + printf("\033[18C%s%sGPUWU %s%s\n", + NORMAL, BOLD, NORMAL, gpu_model[i]); // print ram to uptime and colors - if (show_ram) { - responsively_printf(print_buf, - "\033[18C%s%sWAM %s%i MiB/%i MiB", + if (show_ram) + printf("\033[18C%s%sWAM %s%i MiB/%i MiB\n", NORMAL, BOLD, NORMAL, (ram_used), ram_total); - } if (show_resolution) - if (screen_width != 0 || screen_height != 0) { - responsively_printf(print_buf, - "\033[18C%s%sRESOWUTION%s %dx%d", + if (screen_width != 0 || screen_height != 0) + printf("\033[18C%s%sRESOWUTION%s %dx%d\n", NORMAL, BOLD, NORMAL, screen_width, screen_height); - } - if (show_shell) { - responsively_printf(print_buf, - "\033[18C%s%sSHEWW %s%s", + if (show_shell) + printf("\033[18C%s%sSHEWW %s%s\n", NORMAL, BOLD, NORMAL, shell); - } #ifdef __APPLE__ if (show_pkgs) system("ls $(brew --cellar) | wc -l | awk -F' ' '{print \" \x1b[34mw w \x1b[0m\x1b[1mPKGS\x1b[0m \"$1 \" (brew)\"}'"); #else - if (show_pkgs) { - responsively_printf(print_buf, - "\033[18C%s%sPKGS %s%s%d: %s", + if (show_pkgs) + printf("\033[18C%s%sPKGS %s%s%d: %s\n", NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name); - } #endif if (show_uptime) { @@ -433,18 +412,15 @@ void print_info() switch (uptime) { case 0 ... 3599: - responsively_printf(print_buf, - "\033[18C%s%sUWUPTIME %s%lim", + printf("\033[18C%s%sUWUPTIME %s%lim\n", NORMAL, BOLD, NORMAL, uptime / 60 % 60); break; case 3600 ... 86399: - responsively_printf(print_buf, - "\033[18C%s%sUWUPTIME %s%lih, %lim", + printf("\033[18C%s%sUWUPTIME %s%lih, %lim\n", NORMAL, BOLD, NORMAL, uptime / 3600, uptime / 60 % 60); break; default: - responsively_printf(print_buf, - "\033[18C%s%sUWUPTIME %s%lid, %lih, %lim", + printf("\033[18C%s%sUWUPTIME %s%lid, %lih, %lim\n", NORMAL, BOLD, NORMAL, uptime / 86400, uptime / 3600 % 24, uptime / 60 % 60); } }