Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2001 17:23:28 +0900
From:      "Akinori MUSHA" <knu@iDaemons.org>
To:        phantom@FreeBSD.org
Cc:        current@FreeBSD.org
Subject:   Re: setlocale() fails
Message-ID:  <86y9vbdm9r.wl@daemon.local.idaemons.org>
In-Reply-To: <86zofrmtk4.wl@archon.local.idaemons.org>
References:  <86zofrmtk4.wl@archon.local.idaemons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi again,

At Tue, 13 Feb 2001 07:21:15 +0900,
I wrote:
> I found that setlocale() always fails on -current.
> 
> #include <stdio.h>
> #include <locale.h>
> 
> int main()
> {
>   if (setlocale(LC_ALL, ""))
>     puts("ok");
>   else
>     puts("failed");
>   return 0;
> }
> 
> This program shows "failed" on -current regardless of the value of
> LANG unless it's other than "C", when it shows "ok" on -stable...
> 
> Any ideas?

I found the culprit.  Here is a patch which fixes the problem.

Index: lmessages.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/locale/lmessages.c,v
retrieving revision 1.4
diff -u -r1.4 lmessages.c
--- lmessages.c	2001/02/12 08:56:39	1.4
+++ lmessages.c	2001/02/13 08:19:04
@@ -55,7 +55,7 @@
 	ret = __part_load_locale(name, &_messages_using_locale,
 		messages_locale_buf, "LC_MESSAGES", LCMESSAGES_SIZE_FULL,
 		(const char **)&_messages_locale);
-	if (ret == 0) {
+	if (ret != 0) {
 		/* Assume that we have incomplete locale file (without
 		 * "yesstr" and "nostr" declared. Try it also.
 		 */


-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"We're only at home when we're on the run, on the wing, on the fly"


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86y9vbdm9r.wl>