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

8
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.207 2012/03/23 19:38:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.208 2012/03/23 21:58:21 tg Exp $");
extern char **environ;
@ -258,6 +258,12 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
init_histvec();
#ifdef TIOCGWINSZ
/* try to initialise tty size before importing environment */
tty_init(false, false);
change_winsz();
#endif
#ifdef _PATH_DEFPATH
def_path = _PATH_DEFPATH;
#else