aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-03-16 05:32:45 +0000
committerRoland McGrath <roland@gnu.org>1995-03-16 05:32:45 +0000
commitf0bf9cb92c28c9ec0ac3376d87055e9d14610082 (patch)
treec058250695dd90b4eb5b870620826727d559f925 /locale
parent67a3a8ac7fef11753205c69da9df9c4ef30f6076 (diff)
downloadglibc-f0bf9cb92c28c9ec0ac3376d87055e9d14610082.tar
glibc-f0bf9cb92c28c9ec0ac3376d87055e9d14610082.tar.gz
glibc-f0bf9cb92c28c9ec0ac3376d87055e9d14610082.tar.bz2
glibc-f0bf9cb92c28c9ec0ac3376d87055e9d14610082.zip
Thu Mar 16 00:04:41 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/C-ctype.c: New correct data generated by drepper. * Rules: Don't use $(libc.a). Parsing of grouped numbers contributed by Ulrich Drepper. * stdlib/strtol.c (__strtol_internal): Renamed from strtol. Take new flag arg; if nonzero, parse locale-dependent thousands grouping and interpret only the prefix that is correctly grouped. (strtol): Define this to call _strtol_internal with zero for the flag. Use a weak symbol for the definition. * stdlib/strtod.c (strtod, __strtod_internal): Likewise. Check for the exponent of the number overflowing the float format. * stdlib/stdlib.h (__strtof, __strtold): Declarations removed. (__strto{f,d,ld,l,ul,q,uq}_internal): Declare these functions. [__OPTIMIZE__]: Define inline functions calling those. * stdlib/grouping.h: New file, written by drepper. * stdlib/Makefile (distribute): Add grouping.h. * stdio/vfscanf.c: Grok %' modifier to numeric conversions. Call __strtoX_internal with the grouping flag set iff the modifier is present. Wed Mar 15 00:40:54 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> * sysdeps/generic/memchr.c: Fix typos: limit.h -> limits.h. * mach/Machrules: Produce static deps for all object flavors. [interface-library]: Remove all these variables and rules. ($(interface-library)-routines): Define this variable. (extra-libs): Append $(interface-library) to this. * mach/Makefile (interface-library): Omit .a suffix. * hurd/Makefile: Likewise. Tue Mar 14 23:40:31 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> * stdio/internals.c (flushbuf): If !FLUSH_ONLY, don't skip out early if no new data in buffer after priming. * Makerules (object-suffixes, libtypes): Move all these variables to Makeconfig. * Makeconfig (object-suffixes, libtypes): Moved here from Makerules. * Makerules (build-extra-lib): New canned sequence. * sysdeps/mach/hurd/euidaccess.c: Include fcntl.h. Declare ERR; fix uses of FILE and PORT. Remove bogus weak alias for `access'. * sysdeps/mach/hurd/dirfd.c: Include hurd/fd.h and errno.h. Add missing semicolon. * sysdeps/mach/hurd/opendir.c: Include hurd/fd.h. Use a `struct hurd_fd *' temp var, since DIRP->__fd is a `void *'. * sysdeps/mach/hurd/readdir.c: Include hurd/fd.h. * stdlib/wcstombs.c: #if 0 out code for non-ASCII chars until the locale data format is implemented. * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Pass &__sigreturn on the stack to the trampoline code, so it is not position-dependent. * stdio/printf_fp.c (NDEBUG): Define this to disable assert. Don't include <stdarg.h>. (__printf_fp): Last arg ARGS is now `const void **const'; dereference ARGS[0] instead of using va_arg. * locale/setlocale.c: In LC_ALL case, initialize CATEGORY before loop to install data. * locale/loadlocale.c (_nl_category_num_items): Use _NL_ITEM_INDEX to extract number from item code. (_nl_load_locale): Close the descriptor when finished. * malloc/realloc.c (_realloc_internal): Call _malloc_internal in place of malloc. * time/tzfile.c (__tzfile_default): Initialize RULE_STDOFF to zero.
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]);