MSYS2-packages/msys2-runtime/0008-Automatically-rewrite-TERM-msys-to-TERM-cygwin.patch
Johannes Schindelin 128ca25678 msys2-runtime: upgrade to v3.4.10
This commit corresponds to
https://github.com/msys2/msys2-runtime/pull/180.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2023-11-29 22:52:02 +01:00

37 lines
1.4 KiB
Diff

From 21dce32652b4f05908405fdd938af6c0734af91d 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 02b47ad..7a4a6ea 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -906,7 +906,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);