Subject: bin/19352: Call setlocale() in /bin/sh (patch)
To: None <>
From: Christopher Richards <richards+netbsd@CS.Princeton.EDU>
List: netbsd-bugs
Date: 12/11/2002 14:04:12
>Number:         19352
>Category:       bin
>Synopsis:       Call setlocale() in /bin/sh (patch)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 11 11:05:00 PST 2002
>Originator:     Christopher Richards
>Release:        NetBSD 1.6_STABLE
System: NetBSD zembla.Princeton.EDU 1.6_STABLE NetBSD 1.6_STABLE (ZEMBLA) #16: Mon Dec 2 21:44:56 EST 2002 richards@zembla.Princeton.EDU:/home/richards/x/src/kern i386
Architecture: i386
Machine: i386
	Without a call to setlocale(), it's impossible to type accented
	characters on the command line (from an xterm, at least).

	$ /bin/sh
	$ <try to type latin-1 characters>
	Patch against -current follows:

Index: main.c
RCS file: /cvsroot/basesrc/bin/sh/main.c,v
retrieving revision 1.45
diff -u -r1.45 main.c
--- main.c	2002/11/24 22:35:40	1.45
+++ main.c	2002/12/11 18:58:30
@@ -51,6 +51,7 @@
 #endif /* not lint */
 #include <errno.h>
+#include <locale.h>
 #include <stdio.h>
 #include <signal.h>
 #include <sys/stat.h>
@@ -109,6 +110,8 @@
 	struct stackmark smark;
 	volatile int state;
 	char *shinit;
+	setlocale(LC_ALL, "");
 	monitor(4, etext, profile_buf, sizeof profile_buf, 50);