From 84919edbaa31cff13de67559d435dd62323a49b4 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 27 Sep 2023 12:35:18 +0200 Subject: [PATCH] canbusload: redraw mode: use less screen estate Use less screen estate by not printing unneeded newlines in redraw mode. --- canbusload.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/canbusload.c b/canbusload.c index 56d9be7..b4861ce 100644 --- a/canbusload.c +++ b/canbusload.c @@ -223,7 +223,8 @@ void printstats(int signo) if (color) printf("%s", ATTRESET); - printf("\n"); + if (!redraw || (i < currmax - 1)) + printf("\n"); stat[i].recv_frames = 0; stat[i].recv_bits_total = 0; @@ -231,7 +232,9 @@ void printstats(int signo) stat[i].recv_bits_payload = 0; } - printf("\n"); + if (!redraw) + printf("\n"); + fflush(stdout); alarm(1);