summaryrefslogtreecommitdiff
path: root/lib/localename.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-02 12:05:34 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-02 12:05:34 +0100
commit7c78c92a28ef43d68b172adf97fbd8a27be3baec (patch)
tree3a98b0d01865f5e00912521c58386eb008a70d07 /lib/localename.c
parent4d76768442551c97a85e6f133cb818d223012746 (diff)
parent3ee36dc9787cee6ab5314af8f9c01b05a50e7d9d (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'lib/localename.c')
-rw-r--r--lib/localename.c39
1 files changed, 26 insertions, 13 deletions
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 <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Ulrich Drepper <drepper@gnu.org>, 1995. */
/* Native Windows code written by Tor Lillqvist <tml@iki.fi>. */
@@ -49,7 +49,7 @@
# if defined __APPLE__ && defined __MACH__
# include <xlocale.h>
# endif
-# if __GLIBC__ >= 2 && !defined __UCLIBC__
+# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__
# include <langinfo.h>
# 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 <goldsmit@apple.com> 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:
- /* <http://www.microsoft.com/globaldev/reference/lcid-all.mspx> calls
- it "Sepedi"; according to
- <http://www.ethnologue.com/show_language.asp?code=nso>
- <http://www.ethnologue.com/show_language.asp?code=sot>
+ /* <https://msdn.microsoft.com/en-us/library/dd318693.aspx> calls
+ it "Sesotho sa Leboa"; according to
+ <https://www.ethnologue.com/show_language.asp?code=nso>
+ <https://www.ethnologue.com/show_language.asp?code=sot>
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 <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
+ See <https://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
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