less/backport-makecheck-0037-Don-t-set-LESS_TERMCAP_xx-environment-vars-from-term.patch

36 lines
1.2 KiB
Diff
Raw Normal View History

From 9573d422f602823d78d04151633420e5a6b10aac Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
Date: Fri, 21 Oct 2022 20:32:55 -0700
Subject: [PATCH 33/48] Don't set LESS_TERMCAP_xx environment vars from
terminfo in non-interactive mode. The terminfo struct is not initialized and
the vars will be set from the logged environment.
---
lesstest/env.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lesstest/env.c b/lesstest/env.c
index 56685f8..edfdf87 100644
--- a/lesstest/env.c
+++ b/lesstest/env.c
@@ -88,10 +88,12 @@ static void env_setup(EnvBuf* env, char* const* prog_env, int interactive) {
{ "LESS_TERMCAP_kh", terminfo.key_home },
{ "LESS_TERMCAP_@7", terminfo.key_end },
};
- for (int i = 0; i < countof(tcvars); ++i) {
- struct tcvar* tc = &tcvars[i];
- env_addpair(env, tc->name, tc->value);
- log_env(tc->name, strlen(tc->name), tc->value);
+ if (interactive) {
+ for (int i = 0; i < countof(tcvars); ++i) {
+ struct tcvar* tc = &tcvars[i];
+ env_addpair(env, tc->name, tc->value);
+ log_env(tc->name, strlen(tc->name), tc->value);
+ }
}
for (char* const* envp = prog_env; *envp != NULL; ++envp) {
const char* ename = *envp;
--
2.27.0