diff -u old/gettext-0.18.1.1/gettext-runtime/intl/localename.c new/gettext-0.18.1.1/gettext-runtime/intl/localename.c --- old/gettext-0.18.1.1/gettext-runtime/intl/localename.c 2011-10-15 00:21:37.853133600 -0400 +++ new/gettext-0.18.1.1/gettext-runtime/intl/localename.c 2011-10-15 00:29:27.601133600 -0400 @@ -59,7 +59,7 @@ # define WIN32_NATIVE #endif -#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */ +#if defined WIN32_NATIVE /* WIN32 */ # define WIN32_LEAN_AND_MEAN # include /* List of language codes, sorted by value: @@ -1407,7 +1407,7 @@ #endif -#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */ +#if defined WIN32_NATIVE /* WIN32 */ /* Canonicalize a Win32 native locale name to a Unix locale name. NAME is a sufficiently large buffer. @@ -2770,8 +2770,8 @@ setting of 'local'." However it does not specify the exact format. Neither do SUSV2 and ISO C 99. So we can use this feature only on selected systems (e.g. - those using GNU C Library). */ -#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2) + those using GNU C Library, or cygwin [1.5 and 1.7+]). */ +#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2) || defined __CYGWIN__ # define HAVE_LOCALE_NULL #endif @@ -2826,11 +2826,6 @@ Ignore invalid LANG value set by the Terminal application. */ if (strcmp (retval, "UTF-8") != 0) #endif -#if defined __CYGWIN__ - /* Cygwin. - Ignore dummy LANG value set by ~/.profile. */ - if (strcmp (retval, "C.UTF-8") != 0) -#endif return retval; } @@ -2923,7 +2918,7 @@ # endif -# if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */ +# if defined WIN32_NATIVE /* WIN32 */ { LCID lcid; @@ -2933,6 +2928,23 @@ return gl_locale_name_from_win32_LCID (lcid); } # endif +# if defined __CYGWIN__ + { + /* Rarely arrive here. This function is called only when an earlier + * call to gl_locale_name_posix() or gl_locale_name_environ() + * returned NULL. That first function now simply delegates to + * setlocale (LC_*, NULL), which never fails on cygwin. But...for + * completeness, or when called after gl_locale_name_environ() and + * none are set, go ahead and specify the cygwin default. Cheat a bit + * to distinguish old cygwin (1.5 and below) from new cygwin (1.7+). + */ +# if PATH_MAX < 261 /* cygwin 1.5 or below */ + return "C"; +# else /* PATH_MAX = 4096, cygwin 1.7 or above */ + return "C.UTF-8"; +# endif + } +# endif #endif }