Signed-off-by: Ed Maste <ema...@adaranet.com>
---
 lib/localename.c |   30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/lib/localename.c b/lib/localename.c
index c6777de..7d04742 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -2616,8 +2616,34 @@ gl_locale_name_thread_unsafe (int category, const char 
*categoryname)
              nl_langinfo (_NL_LOCALE_NAME (category)).  */
           name = thread_locale->__names[category];
         return name;
-#  endif
-#  if defined __APPLE__ && defined __MACH__ /* Mac OS X */
+#  elif defined __FreeBSD__
+        int mask;
+
+        switch (category)
+          {
+          case LC_COLLATE:
+            mask = LC_COLLATE_MASK;
+            break;
+          case LC_CTYPE:
+            mask = LC_CTYPE_MASK;
+            break;
+          case LC_MESSAGES:
+            mask = LC_MESSAGES_MASK;
+            break;
+          case LC_MONETARY:
+            mask = LC_MONETARY_MASK;
+            break;
+          case LC_NUMERIC:
+            mask = LC_NUMERIC_MASK;
+            break;
+          case LC_TIME:
+            mask = LC_TIME_MASK;
+            break;
+          default: /* We shouldn't get here.  */
+            return "";
+          }
+        return querylocale (mask, thread_locale);
+#  elif defined __APPLE__ && defined __MACH__ /* Mac OS X */
         /* The locale name is found deep in an undocumented data structure.
            Since it's stored in a buffer of size 32 and newlocale() rejects
            locale names of length > 31, we can assume that it is NUL terminated
-- 
1.7.10.3

Reply via email to