Subject: bin/19352: Call setlocale() in /bin/sh (patch)
To: None <gnats-bugs@gnats.netbsd.org>
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
>Closed-Date:
>Last-Modified:
>Originator: Christopher Richards
>Release: NetBSD 1.6_STABLE
>Organization:
>Environment:
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
>Description:
Without a call to setlocale(), it's impossible to type accented
characters on the command line (from an xterm, at least).
>How-To-Repeat:
$ /bin/sh
$ <try to type latin-1 characters>
>Fix:
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, "");
#if PROFILE
monitor(4, etext, profile_buf, sizeof profile_buf, 50);
>Release-Note:
>Audit-Trail:
>Unformatted: