summaryrefslogtreecommitdiff
path: root/gnulib-tests/localename.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-tests/localename.c')
-rw-r--r--gnulib-tests/localename.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gnulib-tests/localename.c b/gnulib-tests/localename.c
index 849e2d9..2c2d22b 100644
--- a/gnulib-tests/localename.c
+++ b/gnulib-tests/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 the GNU General Public License as published by
@@ -2734,6 +2734,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