Applied patch from Vladimir N. Oleynik to add locale support to the shell per
authorMark Whitley <markw@lineo.com>
Tue, 27 Mar 2001 16:35:16 +0000 (16:35 -0000)
committerMark Whitley <markw@lineo.com>
Tue, 27 Mar 2001 16:35:16 +0000 (16:35 -0000)
bug report from Ralph Jones.

lash.c
sh.c
shell/lash.c

diff --git a/lash.c b/lash.c
index e33fd369c189d0ab8f9da7cf4615fac9b34d2a2f..ca0d4bb43e59c1ffda3231cfcff6d46eb25a3662 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -64,6 +64,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <locale.h>
 
 //#define BB_FEATURE_SH_WORDEXP
 
@@ -446,6 +447,11 @@ static int builtin_export(struct child_prog *child)
        else if (strncmp(v, "PS2=", 4)==0)
                PS2 = getenv("PS2");
 #endif
+       if(strncmp(v, "LC_ALL=", 7)==0)
+               setlocale(LC_ALL, getenv("LC_ALL"));
+       if(strncmp(v, "LC_CTYPE=", 7)==0)
+               setlocale(LC_CTYPE, getenv("LC_CTYPE"));
+
        return (res);
 }
 
diff --git a/sh.c b/sh.c
index e33fd369c189d0ab8f9da7cf4615fac9b34d2a2f..ca0d4bb43e59c1ffda3231cfcff6d46eb25a3662 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -64,6 +64,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <locale.h>
 
 //#define BB_FEATURE_SH_WORDEXP
 
@@ -446,6 +447,11 @@ static int builtin_export(struct child_prog *child)
        else if (strncmp(v, "PS2=", 4)==0)
                PS2 = getenv("PS2");
 #endif
+       if(strncmp(v, "LC_ALL=", 7)==0)
+               setlocale(LC_ALL, getenv("LC_ALL"));
+       if(strncmp(v, "LC_CTYPE=", 7)==0)
+               setlocale(LC_CTYPE, getenv("LC_CTYPE"));
+
        return (res);
 }
 
index e33fd369c189d0ab8f9da7cf4615fac9b34d2a2f..ca0d4bb43e59c1ffda3231cfcff6d46eb25a3662 100644 (file)
@@ -64,6 +64,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <locale.h>
 
 //#define BB_FEATURE_SH_WORDEXP
 
@@ -446,6 +447,11 @@ static int builtin_export(struct child_prog *child)
        else if (strncmp(v, "PS2=", 4)==0)
                PS2 = getenv("PS2");
 #endif
+       if(strncmp(v, "LC_ALL=", 7)==0)
+               setlocale(LC_ALL, getenv("LC_ALL"));
+       if(strncmp(v, "LC_CTYPE=", 7)==0)
+               setlocale(LC_CTYPE, getenv("LC_CTYPE"));
+
        return (res);
 }