Index: usr.bin/top/screen.c =================================================================== --- usr.bin/top/screen.c +++ usr.bin/top/screen.c @@ -55,7 +55,8 @@ static char is_a_terminal = false; #define NON_INTERACTIVE_MODE_VIRTUAL_SCREEN_WIDTH 1024 +#define DUMB_TERMINAL_SCREEN_WIDTH 80 void init_termcap(bool interactive) { @@ -86,9 +87,10 @@ if (term_name == NULL) { smart_terminal = false; + screen_width = DUMB_TERMINAL_SCREEN_WIDTH - 1; return; } /* now get the termcap entry */ if ((status = tgetent(termcap_buf, term_name)) != 1) { @@ -124,25 +126,25 @@ /* screen_width is a little different */ if ((screen_width = tgetnum("co")) == -1) { - screen_width = 79; + screen_width = DUMB_TERMINAL_SCREEN_WIDTH - 1; } else { screen_width -= 1; } /* terminals that overstrike need special attention */ overstrike = tgetflag("os"); /* initialize the pointer into the termcap string buffer */ bufptr = string_buffer; /* get "ce", clear to end */ if (!overstrike) { clear_line = tgetstr("ce", &bufptr); } /* get necessary capabilities */ if ((clear_screen = tgetstr("cl", &bufptr)) == NULL || (cursor_motion = tgetstr("cm", &bufptr)) == NULL)