handle $LANG and $LC_xx consistently (slash is forbidden).

This commit is contained in:
itojun 2000-12-21 17:16:20 +00:00
parent 2079f9d276
commit c2cb892f34
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: setlocale.c,v 1.24 2000/12/21 11:29:47 itojun Exp $ */
/* $NetBSD: setlocale.c,v 1.25 2000/12/21 17:16:20 itojun Exp $ */
/*
* Copyright (c) 1991, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
#else
__RCSID("$NetBSD: setlocale.c,v 1.24 2000/12/21 11:29:47 itojun Exp $");
__RCSID("$NetBSD: setlocale.c,v 1.25 2000/12/21 17:16:20 itojun Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -161,7 +161,8 @@ __setlocale(category, locale)
sizeof(new_categories[category]));
if (!category) {
for (i = 1; i < _LC_LAST; ++i) {
if (!(env = getenv(categories[i])) || !*env)
env = getenv(categories[i]);
if (!env || !*env || strchr(env, '/'))
env = new_categories[0];
(void)strlcpy(new_categories[i], env,
sizeof(new_categories[i]));