From 44a3eaeba04ef78835ca741592c376428ada5f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 2 Dec 2017 10:30:25 +0100 Subject: New upstream version 0.9.8 --- lib/localename.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'lib/localename.c') diff --git a/lib/localename.c b/lib/localename.c index a0752ed..59732fa 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -1,5 +1,5 @@ /* Determine name of the currently selected locale. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of either: @@ -21,7 +21,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* Written by Ulrich Drepper , 1995. */ /* Native Windows code written by Tor Lillqvist . */ @@ -49,7 +49,7 @@ # if defined __APPLE__ && defined __MACH__ # include # endif -# if __GLIBC__ >= 2 && !defined __UCLIBC__ +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__ # include # endif # if !defined IN_LIBINTL @@ -70,7 +70,7 @@ extern char * getlocalename_l(int, locale_t); # endif #endif -#if defined _WIN32 || defined __WIN32__ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ # define WINDOWS_NATIVE # if !defined IN_LIBINTL # include "glthread/lock.h" @@ -1166,7 +1166,7 @@ gl_locale_name_canonicalize (char *name) { /* This conversion is based on a posting by Deborah GoldSmith on 2005-03-08, - http://lists.apple.com/archives/carbon-dev/2005/Mar/msg00293.html */ + https://lists.apple.com/archives/carbon-dev/2005/Mar/msg00293.html */ /* Convert legacy (NeXTstep inherited) English names to Unix (ISO 639 and ISO 3166) names. Prior to Mac OS X 10.3, there is no API for doing this. @@ -1502,7 +1502,7 @@ gl_locale_name_from_win32_LANGID (LANGID langid) /* Dispatch on language. See also http://www.unicode.org/unicode/onlinedat/languages.html . - For details about languages, see http://www.ethnologue.com/ . */ + For details about languages, see https://www.ethnologue.com/ . */ switch (primary) { case LANG_AFRIKAANS: @@ -2268,10 +2268,10 @@ gl_locale_name_from_win32_LANGID (LANGID langid) } return "wen"; case LANG_SOTHO: - /* calls - it "Sepedi"; according to - - + /* calls + it "Sesotho sa Leboa"; according to + + it's the same as Northern Sotho. */ switch (sub) { @@ -2610,7 +2610,7 @@ get_lcid (const char *locale_name) /* A hash function for NUL-terminated char* strings using the method described by Bruno Haible. - See http://www.haible.de/bruno/hashfunc.html. */ + See https://www.haible.de/bruno/hashfunc.html. */ static size_t _GL_ATTRIBUTE_PURE string_hash (const void *x) { @@ -2704,7 +2704,7 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname) # if __GLIBC__ >= 2 && !defined __UCLIBC__ /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in glibc < 2.12. - See . */ + See . */ const char *name = nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1))); if (name[0] == '\0') @@ -2712,7 +2712,7 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname) nl_langinfo (_NL_LOCALE_NAME (category)). */ name = thread_locale->__names[category]; return name; -# elif defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__) +# elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __APPLE__ && defined __MACH__) /* FreeBSD, Mac OS X */ int mask; @@ -2743,6 +2743,19 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname) # elif defined __sun && HAVE_GETLOCALENAME_L /* Solaris >= 12. */ return getlocalename_l (category, thread_locale); +# elif defined __CYGWIN__ + /* Cygwin < 2.6 lacks uselocale and thread-local locales altogether. + Cygwin <= 2.6.1 lacks NL_LOCALE_NAME, requiring peeking inside + an opaque struct. */ +# ifdef NL_LOCALE_NAME + return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale); +# else + /* FIXME: Remove when we can assume new-enough Cygwin. */ + struct __locale_t { + char categories[7][32]; + }; + return ((struct __locale_t *) thread_locale)->categories[category]; +# endif # elif defined __ANDROID__ return MB_CUR_MAX == 4 ? "C.UTF-8" : "C"; # endif -- cgit v1.2.3