Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/locale handle $LANG and $LC_xx consistently (slash ...



details:   https://anonhg.NetBSD.org/src/rev/ef4de9f89dc2
branches:  trunk
changeset: 500978:ef4de9f89dc2
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Dec 21 17:16:20 2000 +0000

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

diffstat:

 lib/libc/locale/setlocale.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 8169db99d6d2 -r ef4de9f89dc2 lib/libc/locale/setlocale.c
--- a/lib/libc/locale/setlocale.c       Thu Dec 21 15:37:18 2000 +0000
+++ b/lib/libc/locale/setlocale.c       Thu Dec 21 17:16:20 2000 +0000
@@ -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 @@
                    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]));



Home | Main Index | Thread Index | Old Index