Subject: Re: strange setlocale() issue
To: Markus Illenseer <markus@core.de>
From: Greywolf <greywolf@starwolf.com>
List: tech-userlevel
Date: 10/13/2003 14:03:34
Thus spake Markus Illenseer ("MI> ") sometime Today...
MI> #include <stdio.h>
MI> #include <locale.h>
MI>
MI> int main(void)
MI> {
MI> const char *foo = "bar";
MI> printf("Start\n");
MI> if( NULL == setlocale(LC_ALL, "zh_TW.eucTW") )
MI> {
MI> printf("Start1\n");
MI> /* yes, I know, the 2nd argument should not be NULL */
MI> printf("error! locale is: %s\n", setlocale(LC_ALL, NULL));
MI> }
MI> else
MI> {
MI> printf("Start2\n");
MI> printf("OK %s\n", foo);
MI> }
MI> printf("End\n");
MI> }
MI>
MI> It does print "Start" and then exits (!) with no error, coredump or
MI> whatsoever. The other printf() commands are completely ignored, which
MI> makes me believe, that the setlocale() in the if-clause crashes. A ktrace,
MI> ktruss and gdb trace did not reveal anything, though.
Hmmm, I get a SIGSEGV on this one.
A gdb trace gets nothing? What if you single-step through, where's it
get lost?
--*greywolf;
--
NetBSD: Are you old enough to run it?