top(1): fixed the empty output problem in non-interactive mode (-n, -b) regressed in r336028

PR:		229842
Reported by:	Ali Abdallah <aliovx@gmail.com>
Reviewed by:	eadler, cy
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16455
This commit is contained in:
Daichi GOTO 2018-07-27 01:20:34 +00:00
parent 62c94a0551
commit 324976739f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336753

View File

@ -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;
}