summaryrefslogtreecommitdiff
path: root/miniperlmain.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters.nicoh.com>1996-01-08 09:00:19 +0000
committerAndy Dougherty <doughera.lafayette.edu>1996-01-08 09:00:19 +0000
commit37b42002e388d000fa8e50e1bd4503f5c47c393f (patch)
tree2ca00ba3a7f1537a129211f9f066fd7a350e34e0 /miniperlmain.c
parentd338d6fe1dfdfdbc07c2d6d7a2a4ae7db5887d93 (diff)
downloadperl-37b42002e388d000fa8e50e1bd4503f5c47c393f.tar.gz
More robust i18nl14n() function from jhi.
Diffstat (limited to 'miniperlmain.c')
-rw-r--r--miniperlmain.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/miniperlmain.c b/miniperlmain.c
index 95e9c49973..9f3e1d6155 100644
--- a/miniperlmain.c
+++ b/miniperlmain.c
@@ -19,23 +19,25 @@ extern "C" {
static void xs_init _((void));
static PerlInterpreter *my_perl;
-int
+void
i18nl14n()
{
char * lang = getenv("LANG");
#if defined(HAS_SETLOCALE) && defined(LC_CTYPE)
{
+ char * lc_all = getenv("LC_ALL");
char * lc_ctype = getenv("LC_CTYPE");
int i;
- if (setlocale(LC_CTYPE, "") == NULL && (lc_ctype || lang)) {
+ if (setlocale(LC_CTYPE, "") == NULL && (lc_all || lc_ctype || lang)) {
+ fprintf(stderr, "warning: setlocale(LC_CTYPE, \"\") failed.\n");
fprintf(stderr,
- "warning: setlocale(LC_CTYPE, \"\") failed, LC_CTYPE = \"%s\", LANG = \"%s\",\n",
+ "warning: LC_ALL = \"%s\", LC_CTYPE = \"%s\", LANG = \"%s\",\n",
+ lc_all ? lc_all : "(null)",
lc_ctype ? lc_ctype : "(null)",
lang ? lang : "(null)"
);
- fprintf(stderr,
- "warning: falling back to the \"C\" locale.\n");
+ fprintf(stderr, "warning: falling back to the \"C\" locale.\n");
setlocale(LC_CTYPE, "C");
}