about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--include/langinfo.h6
-rw-r--r--src/locale/langinfo.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/include/langinfo.h b/include/langinfo.h
index 2153c42e..519c0612 100644
--- a/include/langinfo.h
+++ b/include/langinfo.h
@@ -77,6 +77,12 @@ extern "C" {
 #define YESEXPR 0x50000
 #define NOEXPR 0x50001
 
+#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff)
+
+#if defined(_GNU_SOURCE)
+#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat)
+#endif
+
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #define YESSTR 0x50002
 #define NOSTR 0x50003
diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c
index b2c8569e..b16caf44 100644
--- a/src/locale/langinfo.c
+++ b/src/locale/langinfo.c
@@ -34,6 +34,10 @@ char *__nl_langinfo_l(nl_item item, locale_t loc)
 	const char *str;
 
 	if (item == CODESET) return MB_CUR_MAX==1 ? "ASCII" : "UTF-8";
+
+	/* _NL_LOCALE_NAME extension */
+	if (idx == 65535 && cat < LC_ALL)
+		return loc->cat[cat] ? (char *)loc->cat[cat]->name : "C";
 	
 	switch (cat) {
 	case LC_NUMERIC: