about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/C-ctype.c146
-rw-r--r--locale/C-monetary.c18
-rw-r--r--locale/C-numeric.c2
-rw-r--r--locale/loadlocale.c11
-rw-r--r--locale/setlocale.c4
5 files changed, 90 insertions, 91 deletions
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index 6a987209ed..7a5c0c7b7f 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -3,74 +3,74 @@
 #include "localeinfo.h"
 #include <endian.h>
 
-static const char _nl_C_LC_CTYPE_class[] = 
-  /* 0x80 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x86 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x8c */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x92 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x98 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x9e */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xa4 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xaa */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xb0 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xb6 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xbc */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xc2 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xc8 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xce */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xd4 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xda */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xe0 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xe6 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xec */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xf2 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xf8 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xfe */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x04 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\001\024"
-  /* 0x0a */ "\000\024" "\000\024" "\000\024" "\000\024" "\000\004" "\000\004"
-  /* 0x10 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x16 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x1c */ "\000\004" "\000\004" "\000\004" "\000\004" "\001\220" "\000\100"
-  /* 0x22 */ "\000\100" "\000\100" "\000\100" "\000\100" "\000\100" "\000\100"
-  /* 0x28 */ "\000\100" "\000\100" "\000\100" "\000\100" "\000\100" "\000\100"
-  /* 0x2e */ "\000\100" "\000\100" "\000\050" "\000\050" "\000\050" "\000\050"
-  /* 0x34 */ "\000\050" "\000\050" "\000\050" "\000\050" "\000\050" "\000\050"
-  /* 0x3a */ "\000\100" "\000\100" "\000\100" "\000\100" "\000\100" "\000\100"
-  /* 0x40 */ "\000\100" "\000\041" "\000\041" "\000\041" "\000\041" "\000\041"
-  /* 0x46 */ "\000\041" "\000\001" "\000\001" "\000\001" "\000\001" "\000\001"
-  /* 0x4c */ "\000\001" "\000\001" "\000\001" "\000\001" "\000\001" "\000\001"
-  /* 0x52 */ "\000\001" "\000\001" "\000\001" "\000\001" "\000\001" "\000\001"
-  /* 0x58 */ "\000\001" "\000\001" "\000\001" "\000\100" "\000\100" "\000\100"
-  /* 0x5e */ "\000\100" "\000\100" "\000\100" "\000\042" "\000\042" "\000\042"
-  /* 0x64 */ "\000\042" "\000\042" "\000\042" "\000\002" "\000\002" "\000\002"
-  /* 0x6a */ "\000\002" "\000\002" "\000\002" "\000\002" "\000\002" "\000\002"
-  /* 0x70 */ "\000\002" "\000\002" "\000\002" "\000\002" "\000\002" "\000\002"
-  /* 0x76 */ "\000\002" "\000\002" "\000\002" "\000\002" "\000\002" "\000\100"
-  /* 0x7c */ "\000\100" "\000\100" "\000\100" "\000\004" "\000\004" "\000\004"
-  /* 0x82 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x88 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x8e */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x94 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0x9a */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xa0 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xa6 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xac */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xb2 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xb8 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xbe */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xc4 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xca */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xd0 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xd6 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xdc */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xe2 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xe8 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xee */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xf4 */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
-  /* 0xfa */ "\000\004" "\000\004" "\000\004" "\000\004" "\000\004" "\000\004"
+const char _nl_C_LC_CTYPE_class[] = 
+  /* 0x80 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x86 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x8c */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x92 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x98 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x9e */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xa4 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xaa */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xb0 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xb6 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xbc */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xc2 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xc8 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xce */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xd4 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xda */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xe0 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xe6 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xec */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xf2 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xf8 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xfe */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x04 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\003\040"
+  /* 0x0a */ "\002\040" "\002\040" "\002\040" "\002\040" "\002\000" "\002\000"
+  /* 0x10 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x16 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x1c */ "\002\000" "\002\000" "\002\000" "\002\000" "\001\140" "\004\300"
+  /* 0x22 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
+  /* 0x28 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
+  /* 0x2e */ "\004\300" "\004\300" "\000\330" "\000\330" "\000\330" "\000\330"
+  /* 0x34 */ "\000\330" "\000\330" "\000\330" "\000\330" "\000\330" "\000\330"
+  /* 0x3a */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
+  /* 0x40 */ "\004\300" "\000\325" "\000\325" "\000\325" "\000\325" "\000\325"
+  /* 0x46 */ "\000\325" "\000\305" "\000\305" "\000\305" "\000\305" "\000\305"
+  /* 0x4c */ "\000\305" "\000\305" "\000\305" "\000\305" "\000\305" "\000\305"
+  /* 0x52 */ "\000\305" "\000\305" "\000\305" "\000\305" "\000\305" "\000\305"
+  /* 0x58 */ "\000\305" "\000\305" "\000\305" "\004\300" "\004\300" "\004\300"
+  /* 0x5e */ "\004\300" "\004\300" "\004\300" "\000\326" "\000\326" "\000\326"
+  /* 0x64 */ "\000\326" "\000\326" "\000\326" "\000\306" "\000\306" "\000\306"
+  /* 0x6a */ "\000\306" "\000\306" "\000\306" "\000\306" "\000\306" "\000\306"
+  /* 0x70 */ "\000\306" "\000\306" "\000\306" "\000\306" "\000\306" "\000\306"
+  /* 0x76 */ "\000\306" "\000\306" "\000\306" "\000\306" "\000\306" "\004\300"
+  /* 0x7c */ "\004\300" "\004\300" "\004\300" "\002\000" "\002\000" "\002\000"
+  /* 0x82 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x88 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x8e */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x94 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0x9a */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xa0 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xa6 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xac */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xb2 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xb8 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xbe */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xc4 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xca */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xd0 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xd6 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xdc */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xe2 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xe8 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xee */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xf4 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+  /* 0xfa */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
 ;
 #if BYTE_ORDER == LITTLE_ENDIAN
-static const char _nl_C_LC_CTYPE_toupper[] = 
+const char _nl_C_LC_CTYPE_toupper[] = 
   /* 0x80 */ "\200\000\000\000" "\201\000\000\000" "\202\000\000\000"
   /* 0x83 */ "\203\000\000\000" "\204\000\000\000" "\205\000\000\000"
   /* 0x86 */ "\206\000\000\000" "\207\000\000\000" "\210\000\000\000"
@@ -200,7 +200,7 @@ static const char _nl_C_LC_CTYPE_toupper[] =
   /* 0xfa */ "\372\000\000\000" "\373\000\000\000" "\374\000\000\000"
   /* 0xfd */ "\375\000\000\000" "\376\000\000\000" "\377\000\000\000"
 ;
-static const char _nl_C_LC_CTYPE_tolower[] = 
+const char _nl_C_LC_CTYPE_tolower[] = 
   /* 0x80 */ "\200\000\000\000" "\201\000\000\000" "\202\000\000\000"
   /* 0x83 */ "\203\000\000\000" "\204\000\000\000" "\205\000\000\000"
   /* 0x86 */ "\206\000\000\000" "\207\000\000\000" "\210\000\000\000"
@@ -331,7 +331,7 @@ static const char _nl_C_LC_CTYPE_tolower[] =
   /* 0xfd */ "\375\000\000\000" "\376\000\000\000" "\377\000\000\000"
 ;
 #elif BYTE_ORDER == BIG_ENDIAN
-static const char _nl_C_LC_CTYPE_toupper[] = 
+const char _nl_C_LC_CTYPE_toupper[] = 
   /* 0x80 */ "\000\000\000\200" "\000\000\000\201" "\000\000\000\202"
   /* 0x83 */ "\000\000\000\203" "\000\000\000\204" "\000\000\000\205"
   /* 0x86 */ "\000\000\000\206" "\000\000\000\207" "\000\000\000\210"
@@ -461,7 +461,7 @@ static const char _nl_C_LC_CTYPE_toupper[] =
   /* 0xfa */ "\000\000\000\372" "\000\000\000\373" "\000\000\000\374"
   /* 0xfd */ "\000\000\000\375" "\000\000\000\376" "\000\000\000\377"
 ;
-static const char _nl_C_LC_CTYPE_tolower[] = 
+const char _nl_C_LC_CTYPE_tolower[] = 
   /* 0x80 */ "\000\000\000\200" "\000\000\000\201" "\000\000\000\202"
   /* 0x83 */ "\000\000\000\203" "\000\000\000\204" "\000\000\000\205"
   /* 0x86 */ "\000\000\000\206" "\000\000\000\207" "\000\000\000\210"
@@ -601,12 +601,8 @@ const struct locale_data _nl_C_LC_CTYPE =
   5,
   {
     _nl_C_LC_CTYPE_class,
-#if BYTE_ORDER == BIG_ENDIAN
-    _nl_C_LC_CTYPE_toupper, _nl_C_LC_CTYPE_tolower,
-#endif
     NULL, NULL,
-#if BYTE_ORDER == LITTLE_ENDIAN
-    _nl_C_LC_CTYPE_toupper, _nl_C_LC_CTYPE_tolower,
-#endif
+    _nl_C_LC_CTYPE_toupper,
+    _nl_C_LC_CTYPE_tolower
   }
 };
diff --git a/locale/C-monetary.c b/locale/C-monetary.c
index 7e2b1bc3a7..bf2cede799 100644
--- a/locale/C-monetary.c
+++ b/locale/C-monetary.c
@@ -15,16 +15,16 @@ const struct locale_data _nl_C_LC_MONETARY =
     "",
     "",
     "",
-    "\377",
+    "\177",
     "",
     "",
-    "\377",
-    "\377",
-    "\377",
-    "\377",
-    "\377",
-    "\377",
-    "\377",
-    "\377"
+    "\177",
+    "\177",
+    "\177",
+    "\177",
+    "\177",
+    "\177",
+    "\177",
+    "\177"
   }
 };
diff --git a/locale/C-numeric.c b/locale/C-numeric.c
index 05cdad1265..248e2eb7bd 100644
--- a/locale/C-numeric.c
+++ b/locale/C-numeric.c
@@ -13,6 +13,6 @@ const struct locale_data _nl_C_LC_NUMERIC =
   {
     ".",
     "",
-    "\377"
+    "\177"
   }
 };
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 5c367ae4be..7ad7a21b53 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -30,7 +30,7 @@ Cambridge, MA 02139, USA.  */
 const size_t _nl_category_num_items[] =
   {
 #define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
-    [category] = _NL_NUM_##category,
+    [category] = _NL_ITEM_INDEX (_NL_NUM_##category),
 #include "categories.def"
 #undef	DEFINE_CATEGORY
   };
@@ -60,10 +60,12 @@ _nl_load_locale (int category, char **name)
 
   if ((*name)[0] == '\0')
     {
-      *name = getenv (_nl_category_names[category]);
-      if (! *name || (*name) == '\0')
+      *name = getenv ("LC_ALL");
+      if (! *name || (*name)[0] == '\0')
+	*name = getenv (_nl_category_names[category]);
+      if (! *name || (*name)[0] == '\0')
 	*name = getenv ("LANG");
-      if (! *name || (*name) == '\0')
+      if (! *name || (*name)[0] == '\0')
 	*name = (char *) "local";
     }
 
@@ -172,6 +174,7 @@ _nl_load_locale (int category, char **name)
       newdata->strings[i] = newdata->filedata + idx;
     }
 
+  __close (fd);
   return newdata;
 }
 
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 79d22ab98d..500d8627eb 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -255,7 +255,7 @@ setlocale (int category, const char *name)
 	  char *n = alloca (len);
 	  memcpy (n, name, len);
 
-	  while (p = strchr (n, '='))
+	  while ((p = strchr (n, '=')) != NULL)
 	    {
 	      for (i = 0; i < LC_ALL; ++i)
 		if (_nl_category_name_sizes[i] == p - n &&
@@ -353,7 +353,7 @@ setlocale (int category, const char *name)
 	}
 
       /* Now we have loaded all the new data.  Put it in place.  */
-      for (; category < LC_ALL; ++category)
+      for (category = 0; category < LC_ALL; ++category)
 	{
 	  setdata (category, newdata[category]);
 	  setname (category, newnames[category]);