summaryrefslogtreecommitdiff
path: root/miniperlmain.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-02-02 18:52:27 -0800
committerLarry Wall <lwall@sems.com>1996-02-02 18:52:27 -0800
commitc07a80fdfe3926b5eb0585b674aa5d1f57b32ade (patch)
tree6d56135571eb9ea6635748469bdaf72ad481247a /miniperlmain.c
parent91b7def858c29dac014df40946a128c06b3aa2ed (diff)
downloadperl-c07a80fdfe3926b5eb0585b674aa5d1f57b32ade.tar.gz
perl5.002beta3
[editor's note: no patch file was found for this release, so no fine-grained changes] I can't find the password for our ftp server, so I had to drop it into ftp://ftp.sems.com/pub/incoming/perl5.002b3.tar.gz, which is a drop directory you can't ls. The current plan is that Andy is gonna whack on this a little more, and then release a gamma in a few days when he's happy with it. So don't get carried away. This is now *late* beta. In other words, have less than the appropriate amount of fun. :-) Larry
Diffstat (limited to 'miniperlmain.c')
-rw-r--r--miniperlmain.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/miniperlmain.c b/miniperlmain.c
index 9f3e1d6155..1179a5f668 100644
--- a/miniperlmain.c
+++ b/miniperlmain.c
@@ -19,38 +19,48 @@ extern "C" {
static void xs_init _((void));
static PerlInterpreter *my_perl;
-void
-i18nl14n()
+int
+perl_init_i18nl14n(printwarn) /* XXX move to perl.c */
+ int printwarn;
{
- char * lang = getenv("LANG");
+ int ok = 1;
+ /* returns
+ * 1 = set ok or not applicable,
+ * 0 = fallback to C locale,
+ * -1 = fallback to C locale failed
+ */
#if defined(HAS_SETLOCALE) && defined(LC_CTYPE)
- {
+ char * lang = getenv("LANG");
char * lc_all = getenv("LC_ALL");
char * lc_ctype = getenv("LC_CTYPE");
int i;
if (setlocale(LC_CTYPE, "") == NULL && (lc_all || lc_ctype || lang)) {
- fprintf(stderr, "warning: setlocale(LC_CTYPE, \"\") failed.\n");
- fprintf(stderr,
+ if (printwarn) {
+ fprintf(stderr, "warning: setlocale(LC_CTYPE, \"\") failed.\n");
+ fprintf(stderr,
"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");
- setlocale(LC_CTYPE, "C");
+ fprintf(stderr, "warning: falling back to the \"C\" locale.\n");
+ }
+ ok = 0;
+ if (setlocale(LC_CTYPE, "C") == NULL)
+ ok = -1;
}
for (i = 0; i < 256; i++) {
- if (isUPPER(i)) fold[i] = toLOWER(i);
- else if (isLOWER(i)) fold[i] = toUPPER(i);
- else fold[i] = i;
+ if (isUPPER(i)) fold[i] = toLOWER(i);
+ else if (isLOWER(i)) fold[i] = toUPPER(i);
+ else fold[i] = i;
}
-
- }
#endif
+ return ok;
}
+
int
#ifndef CAN_PROTOTYPE
main(argc, argv, env)
@@ -63,19 +73,9 @@ main(int argc, char **argv, char **env)
{
int exitstatus;
-#ifdef OS2
- _response(&argc, &argv);
- _wildcard(&argc, &argv);
-#endif
+ PERL_SYS_INIT(&argc,&argv);
-#ifdef VMS
- getredirection(&argc,&argv);
-#endif
-
-/* here a union of the cpp #if:s inside i18nl14n() */
-#if (defined(HAS_SETLOCALE) && defined(LC_CTYPE))
- i18nl14n();
-#endif
+ perl_init_i18nl14n(1);
if (!do_undump) {
my_perl = perl_alloc();