always keep x_cols and x_lins valid; check once at start including tty init

if we find any, but not later; do not check on every read

⇒ allows changing COLUMNS and LINES (independent of each other, or both)
  for script shells by passing them in an environment setting, even if
  we get a tty; interactive shells still check before each line is read…

reported by the PLD guys, thanks
This commit is contained in:
tg
2012-03-23 21:58:24 +00:00
parent 69e1312265
commit 24e8a6996b
4 changed files with 11 additions and 20 deletions

6
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.183 2012/03/23 20:07:11 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.184 2012/03/23 21:58:22 tg Exp $");
/* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1];
@ -1174,10 +1174,6 @@ print_columns(struct shf *shf, int n,
++max_oct;
str = alloc(max_oct, ATEMP);
/* ensure x_cols is valid first */
if (x_cols < MIN_COLS)
change_winsz();
/*
* We use (max_col + 1) to consider the space separator.
* Note that no space is printed after the last column