diff options
Diffstat (limited to 'bin/ksh/var.c')
-rw-r--r-- | bin/ksh/var.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/bin/ksh/var.c b/bin/ksh/var.c index e3d8589aa96..846200a469c 100644 --- a/bin/ksh/var.c +++ b/bin/ksh/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.68 2018/04/13 18:18:36 cheloha Exp $ */ +/* $OpenBSD: var.c,v 1.69 2018/06/18 17:03:58 millert Exp $ */ #include <sys/stat.h> #include <sys/time.h> @@ -11,6 +11,10 @@ #include <string.h> #include <time.h> #include <unistd.h> +#ifndef SMALL +# include <term.h> +# include <curses.h> +#endif #include "sh.h" @@ -111,12 +115,13 @@ initvar(void) { "SECONDS", V_SECONDS }, { "TMOUT", V_TMOUT }, { "LINENO", V_LINENO }, + { "TERM", V_TERM }, { NULL, 0 } }; int i; struct tbl *tp; - ktinit(&specials, APERM, 32); /* must be 2^n (currently 17 specials) */ + ktinit(&specials, APERM, 32); /* must be 2^n (currently 19 specials) */ for (i = 0; names[i].name; i++) { tp = ktenter(&specials, names[i].name, hash(names[i].name)); tp->flag = DEFINED|ISSET; @@ -1057,6 +1062,18 @@ setspec(struct tbl *vp) user_lineno = (unsigned int) intval(vp) - current_lineno - 1; vp->flag |= SPECIAL; break; + case V_TERM: +#ifndef SMALL + { + int ret; + + vp->flag &= ~SPECIAL; + if (setupterm(str_val(vp), STDOUT_FILENO, &ret) == ERR) + del_curterm(cur_term); + vp->flag |= SPECIAL; + } +#endif + break; } } |