From 324976739f3c03838bf53eb4edbbac736b9d87d8 Mon Sep 17 00:00:00 2001 From: Daichi GOTO Date: Fri, 27 Jul 2018 01:20:34 +0000 Subject: [PATCH] top(1): fixed the empty output problem in non-interactive mode (-n, -b) regressed in r336028 PR: 229842 Reported by: Ali Abdallah Reviewed by: eadler, cy Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D16455 --- usr.bin/top/screen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/top/screen.c b/usr.bin/top/screen.c index 9a5eb5347fce..11807216adfc 100644 --- a/usr.bin/top/screen.c +++ b/usr.bin/top/screen.c @@ -54,6 +54,8 @@ static struct termios old_settings; static struct termios new_settings; static char is_a_terminal = false; +#define NON_INTERACTIVE_MODE_VIRTUAL_SCREEN_WIDTH 1024 + void init_termcap(bool interactive) { @@ -68,6 +70,7 @@ init_termcap(bool interactive) if (!interactive) { /* pretend we have a dumb terminal */ + screen_width = NON_INTERACTIVE_MODE_VIRTUAL_SCREEN_WIDTH; smart_terminal = false; return; }