Applied patch from Vladimir N. Oleynik to add locale support to the shell per

bug report from Ralph Jones.
This commit is contained in:
Mark Whitley 2001-03-27 16:35:16 +00:00
parent af633757d3
commit 1c6581a865
3 changed files with 18 additions and 0 deletions

6
lash.c
View File

@ -64,6 +64,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
#include <locale.h>
//#define BB_FEATURE_SH_WORDEXP //#define BB_FEATURE_SH_WORDEXP
@ -446,6 +447,11 @@ static int builtin_export(struct child_prog *child)
else if (strncmp(v, "PS2=", 4)==0) else if (strncmp(v, "PS2=", 4)==0)
PS2 = getenv("PS2"); PS2 = getenv("PS2");
#endif #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); return (res);
} }

6
sh.c
View File

@ -64,6 +64,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
#include <locale.h>
//#define BB_FEATURE_SH_WORDEXP //#define BB_FEATURE_SH_WORDEXP
@ -446,6 +447,11 @@ static int builtin_export(struct child_prog *child)
else if (strncmp(v, "PS2=", 4)==0) else if (strncmp(v, "PS2=", 4)==0)
PS2 = getenv("PS2"); PS2 = getenv("PS2");
#endif #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); return (res);
} }

View File

@ -64,6 +64,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
#include <locale.h>
//#define BB_FEATURE_SH_WORDEXP //#define BB_FEATURE_SH_WORDEXP
@ -446,6 +447,11 @@ static int builtin_export(struct child_prog *child)
else if (strncmp(v, "PS2=", 4)==0) else if (strncmp(v, "PS2=", 4)==0)
PS2 = getenv("PS2"); PS2 = getenv("PS2");
#endif #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); return (res);
} }