From e5f96a4e051e13725fc9c904fa4b2d2214e48eb7 Mon Sep 17 00:00:00 2001 From: jilles Date: Wed, 2 Jun 2010 19:16:58 +0000 Subject: sh: Pass TERM changes to libedit. I have changed the patch slightly to ignore TERM changes in subshells. PR: bin/146916 Submitted by: Guy Yur Obtained from: NetBSD --- bin/sh/histedit.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bin/sh/histedit.c') diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index cdde09a..521c6f7 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -98,6 +98,8 @@ histedit(void) /* * turn editing on */ + char *term; + INTOFF; if (el_in == NULL) el_in = fdopen(0, "r"); @@ -107,6 +109,11 @@ histedit(void) el_out = fdopen(2, "w"); if (el_in == NULL || el_err == NULL || el_out == NULL) goto bad; + term = lookupvar("TERM"); + if (term) + setenv("TERM", term, 1); + else + unsetenv("TERM"); el = el_init(arg0, el_in, el_out, el_err); if (el != NULL) { if (hist) @@ -160,6 +167,13 @@ sethistsize(hs) } } +void +setterm(const char *term) +{ + if (rootshell && el != NULL && term != NULL) + el_set(el, EL_TERMINAL, term); +} + int histcmd(int argc, char **argv) { -- cgit v1.1