Not having Safe shouldn't result in test failing TEST harness.
[p5sagit/p5-mst-13.2.git] / miniperlmain.c
1 /*
2  * "The Road goes ever on and on, down from the door where it began."
3  */
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #include "EXTERN.h"
10 #include "perl.h"
11
12 #ifdef __cplusplus
13 }
14 #  define EXTERN_C extern "C"
15 #else
16 #  define EXTERN_C extern
17 #endif
18
19 static void xs_init _((void));
20 static PerlInterpreter *my_perl;
21
22 void
23 i18nl14n()
24 {
25   char * lang = getenv("LANG");
26 #if defined(HAS_SETLOCALE) && defined(LC_CTYPE)
27   {
28     char * lc_all   = getenv("LC_ALL");
29     char * lc_ctype = getenv("LC_CTYPE");
30     int i;
31
32     if (setlocale(LC_CTYPE, "") == NULL && (lc_all || lc_ctype || lang)) {
33       fprintf(stderr, "warning: setlocale(LC_CTYPE, \"\") failed.\n");
34       fprintf(stderr,
35               "warning: LC_ALL = \"%s\", LC_CTYPE = \"%s\", LANG = \"%s\",\n",
36               lc_all   ? lc_all   : "(null)",
37               lc_ctype ? lc_ctype : "(null)",
38               lang     ? lang     : "(null)"
39               );
40       fprintf(stderr, "warning: falling back to the \"C\" locale.\n");
41       setlocale(LC_CTYPE, "C");
42     }
43
44     for (i = 0; i < 256; i++) {
45       if (isUPPER(i)) fold[i] = toLOWER(i);
46       else if (isLOWER(i)) fold[i] = toUPPER(i);
47       else fold[i] = i;
48     }
49
50   }
51 #endif
52 }
53
54 int
55 #ifndef CAN_PROTOTYPE
56 main(argc, argv, env)
57 int argc;
58 char **argv;
59 char **env;
60 #else  /* def(CAN_PROTOTYPE) */
61 main(int argc, char **argv, char **env)
62 #endif  /* def(CAN_PROTOTYPE) */
63 {
64     int exitstatus;
65
66 #ifdef OS2
67     _response(&argc, &argv);
68     _wildcard(&argc, &argv);
69 #endif
70
71 #ifdef VMS
72     getredirection(&argc,&argv);
73 #endif
74
75 /* here a union of the cpp #if:s inside i18nl14n() */
76 #if (defined(HAS_SETLOCALE) && defined(LC_CTYPE))
77     i18nl14n();
78 #endif
79
80     if (!do_undump) {
81         my_perl = perl_alloc();
82         if (!my_perl)
83             exit(1);
84         perl_construct( my_perl );
85     }
86
87     exitstatus = perl_parse( my_perl, xs_init, argc, argv, (char **) NULL );
88     if (exitstatus)
89         exit( exitstatus );
90
91     exitstatus = perl_run( my_perl );
92
93     perl_destruct( my_perl );
94     perl_free( my_perl );
95
96     exit( exitstatus );
97 }
98
99 /* Register any extra external extensions */
100
101 /* Do not delete this line--writemain depends on it */
102
103 static void
104 xs_init()
105 {
106 }