MSYS2-packages/msys2-runtime-3.6/0008-Automatically-rewrite-TERM-msys-to-TERM-cygwin.patch
2025-03-31 07:42:01 +02:00

37 lines
1.4 KiB
Diff

From b7e7e107a5c443d11ac51e9a15f40f6a4305feb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:48:54 +0300
Subject: [PATCH 08/N] Automatically rewrite TERM=msys to TERM=cygwin
With MSys1, it was necessary to set the TERM variable to "msys". To
allow for a smooth transition from MSys1 to MSys2, let's simply handle
TERM=msys as if the user had not specified TERM at all and wanted us to
use our preferred TERM value.
---
winsup/cygwin/environ.cc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 5fb3f53..1175313 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -908,7 +908,16 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
char *eq = strchrnul (newp, '=');
ucenv (newp, eq); /* uppercase env vars which need it */
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
- sawTERM = 1;
+ {
+ /* backwards compatibility: override TERM=msys by TERM=cygwin */
+ if (strcmp (newp + 5, "msys") == 0)
+ {
+ free(newp);
+ i--;
+ continue;
+ }
+ sawTERM = 1;
+ }
#ifdef __MSYS__
else if (*newp == 'M' && strncmp (newp, "MSYS=", 5) == 0)
parse_options (newp + 5);