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