--- origsrc/gettext-runtime/gnulib-lib/localcharset.c 2024-02-21 03:43:51.000000000 -0700 +++ src/gettext-runtime/gnulib-lib/localcharset.c 2024-02-26 07:33:50.105393100 -0700 @@ -51,10 +51,6 @@ # include # endif # endif -# ifdef __CYGWIN__ -# define WIN32_LEAN_AND_MEAN -# include -# endif #elif defined WINDOWS_NATIVE # define WIN32_LEAN_AND_MEAN # include @@ -351,7 +347,7 @@ static const struct table_entry alias_ta { "646", "ASCII" } # define alias_table_defined # endif -# if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Windows */ +# if defined WINDOWS_NATIVE /* Windows */ { "CP1361", "JOHAB" }, { "CP20127", "ASCII" }, { "CP20866", "KOI8-R" }, @@ -846,68 +842,6 @@ locale_charset (void) /* Most systems support nl_langinfo (CODESET) nowadays. */ codeset = nl_langinfo (CODESET); -# ifdef __CYGWIN__ - /* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always - returns "US-ASCII". Return the suffix of the locale name from the - environment variables (if present) or the codepage as a number. */ - if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0) - { - const char *locale; - static char resultbuf[2 + 10 + 1]; - - locale = getenv ("LC_ALL"); - if (locale == NULL || locale[0] == '\0') - { - locale = getenv ("LC_CTYPE"); - if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); - } - if (locale != NULL && locale[0] != '\0') - { - /* If the locale name contains an encoding after the dot, return - it. */ - const char *dot = strchr (locale, '.'); - - if (dot != NULL) - { - const char *modifier; - - dot++; - /* Look for the possible @... trailer and remove it, if any. */ - modifier = strchr (dot, '@'); - if (modifier == NULL) - return dot; - if (modifier - dot < sizeof (resultbuf)) - { - /* This way of filling resultbuf is multithread-safe. */ - memcpy (resultbuf, dot, modifier - dot); - resultbuf [modifier - dot] = '\0'; - return resultbuf; - } - } - } - - /* The Windows API has a function returning the locale's codepage as a - number: GetACP(). This encoding is used by Cygwin, unless the user - has set the environment variable CYGWIN=codepage:oem (which very few - people do). - Output directed to console windows needs to be converted (to - GetOEMCP() if the console is using a raster font, or to - GetConsoleOutputCP() if it is using a TrueType font). Cygwin does - this conversion transparently (see winsup/cygwin/fhandler_console.cc), - converting to GetConsoleOutputCP(). This leads to correct results, - except when SetConsoleOutputCP has been called and a raster font is - in use. */ - { - char buf[2 + 10 + 1]; - - sprintf (buf, "CP%u", GetACP ()); - strcpy (resultbuf, buf); - codeset = resultbuf; - } - } -# endif - if (codeset == NULL) /* The canonical name cannot be determined. */ codeset = "";