aboutsummaryrefslogblamecommitdiffstats
path: root/debian/patches/230_cygwin-lang.patch
blob: c8c72c8a4636c757c3bbbd992ccc32a432d0721d (plain) (tree)





























                                                                       
Subject: Do not fail when LANG is not set on Cygwin
From: Tatsuya Kinoshita <tats@debian.org>
Bug: https://sourceforge.net/p/w3m/patches/66/
    
    Check whether the value of LC_ALL, LC_CTYPE or LANG is not NULL in
    check_cygwin_console().

diff --git a/terms.c b/terms.c
index 7a3c987..4bb46c0 100644
--- a/terms.c
+++ b/terms.c
@@ -222,6 +222,7 @@ static void
 check_cygwin_console(void)
 {
     char *term = getenv("TERM");
+    char *ctype;
     HANDLE hWnd;
 
     if (term == NULL)
@@ -236,7 +237,9 @@ check_cygwin_console(void)
 		isLocalConsole = 1;
 	    }
 	}
-	if (strncmp(getenv("LANG"), "ja", 2) == 0) {
+	if ((ctype = getenv("LC_ALL") ||
+	     ctype = getenv("LC_CTYPE") ||
+	     ctype = getenv("LANG")) && strncmp(ctype, "ja", 2) == 0) {
 	    isWinConsole = TERM_CYGWIN_RESERVE_IME;
 	}
 #ifdef SUPPORT_WIN9X_CONSOLE_MBCS