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

4
sh.h
View File

@@ -152,7 +152,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.524 2012/03/23 20:07:11 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.525 2012/03/23 21:58:22 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/03/03"
@@ -858,7 +858,7 @@ EXTERN char *current_wd;
#define MIN_COLS (2 + MIN_EDIT_SPACE + 3)
#define MIN_LINS 3
EXTERN mksh_ari_t x_cols E_INIT(80); /* tty columns */
EXTERN mksh_ari_t x_lins E_INIT(-1); /* tty lines */
EXTERN mksh_ari_t x_lins E_INIT(24); /* tty lines */
/* These to avoid bracket matching problems */
#define OPAREN '('