| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:from:to:cc:subject:date:message-id | |
| :mime-version:content-type:content-transfer-encoding; q=dns; s= | |
| default; b=I8ADqFNxejzpcGeSplgdKn/zzGVAUVZAbyWnhzOks389vKTNIzLuP | |
| pmGtuKZzNIJY9IGDqAEDJ0+Ev3AFX3H+jv0+IWn7JAIP2ap7S/sLySpyFCgTqgoN | |
| GvBP52hO4wapcxgRrFqW/bu57UA73a6Ik6JtaIU3vLKasdz4qIN0R8= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:from:to:cc:subject:date:message-id | |
| :mime-version:content-type:content-transfer-encoding; s=default; | |
| bh=E7r4qQ2qpPLaImf65WBrXyt9P04=; b=vbhRmXthhEZ+ZeCPbK1+8yFmmEWr | |
| 77blppKKKR3Jp49RKFuk/TVYCn9mQnvHl/6jzHQhhVE5AWM2KYGChvmgQozQiuPU | |
| N32j5nNa9cwZK2lbiQrch8LTVnrvQ2TaR3IebLL1HN/exaqebddus/CpKHE8kcBl | |
| N4nvYGvPQBIJbEo= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-5.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=U*eblake, sk:eblake, sk:eblake@, eblakeredhatcom |
| X-HELO: | mx1.redhat.com |
| From: | Eric Blake <eblake AT redhat DOT com> |
| To: | bug-gnulib AT gnu DOT org |
| Cc: | cygwin AT cygwin DOT com |
| Subject: | [PATCH] localename: Port to cygwin 2.6. |
| Date: | Thu, 19 Jan 2017 14:30:57 -0600 |
| Message-Id: | <20170119203057.13986-1-eblake@redhat.com> |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
Cygwin 2.6 introduced uselocale() and thread-local locales in general,
but lacks any way to get at the name of each portion of a locale_t
object short of peeking behind an opaque object. I'm proposing a
patch to add NL_LOCALE_NAME() to Cygwin patterned after glibc's
extension of the same name, but we might as well work around it
in the meantime.
* lib/localename.c (gl_locale_name_thread_unsafe): Add clause for
Cygwin.
Signed-off-by: Eric Blake <eblake AT redhat DOT com>
---
I won't actually push this to gnulib until I've sent the corresponding
newlib/Cygwin patch to add NL_LOCALE_NAME, and tweaked the commit
messages of both patches to refer to the appropriate mailing list
threads. But this was enough to get test-localename passing on
Cygwin again.
ChangeLog | 6 ++++++
lib/localename.c | 13 +++++++++++++
2 files changed, 19 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e4339fc..f0e23a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-19 Eric Blake <eblake AT redhat DOT com>
+
+ localename: Port to cygwin 2.6.
+ * lib/localename.c (gl_locale_name_thread_unsafe): Add clause for
+ Cygwin.
+
2017-01-17 Pádraig Brady <P AT draigBrady DOT com>
parse-datetime: fix dependence on AC_PROG_SED
diff --git a/lib/localename.c b/lib/localename.c
index 33879e9..89ce889 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -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
--
2.9.3
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |