Upgrade to Encode 1.11, from Dan Kogai.
[p5sagit/p5-mst-13.2.git] / perl.c
diff --git a/perl.c b/perl.c
index 4138e1b..84ef3af 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -258,6 +258,9 @@ perl_construct(pTHXx)
     PL_fdpid = newAV();                        /* for remembering popen pids by fd */
     PL_modglobal = newHV();            /* pointers to per-interpreter module globals */
     PL_errors = newSVpvn("",0);
+    sv_setpvn(PERL_DEBUG_PAD(0), "", 0);       /* For regex debugging. */
+    sv_setpvn(PERL_DEBUG_PAD(1), "", 0);       /* ext/re needs these */
+    sv_setpvn(PERL_DEBUG_PAD(2), "", 0);       /* even without DEBUGGING. */
 #ifdef USE_ITHREADS
     PL_regex_padav = newAV();
     av_push(PL_regex_padav,(SV*)newAV());    /* First entry is an array of empty elements */
@@ -835,8 +838,7 @@ perl_destruct(pTHXx)
 #endif /* USE_5005THREADS */
 
 #ifdef USE_REENTRANT_API
-    Safefree(PL_reentrant_buffer->tmbuf);
-    Safefree(PL_reentrant_buffer);
+    Perl_reentrant_free(aTHX);
 #endif
 
     sv_free_arenas();
@@ -1424,6 +1426,22 @@ print \"  \\@INC:\\n    @INC\\n\";");
     if (!PL_do_undump)
        init_postdump_symbols(argc,argv,env);
 
+    if (PL_wantutf8) { /* Requires init_predump_symbols(). */
+        IO* io;
+        PerlIO* fp;
+        SV* sv;
+        if (PL_stdingv  && (io = GvIO(PL_stdingv))  && (fp = IoIFP(io)))
+             PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
+        if (PL_defoutgv && (io = GvIO(PL_defoutgv)) && (fp = IoOFP(io)))
+             PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
+        if (PL_stderrgv && (io = GvIO(PL_stderrgv)) && (fp = IoOFP(io)))
+             PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
+        if ((sv = GvSV(gv_fetchpv("\017PEN", TRUE, SVt_PV)))) {
+            sv_setpvn(sv, ":utf8\0:utf8", 11);
+            SvSETMAGIC(sv);
+        }
+    }
+
     init_lexer();
 
     /* now parse the script */
@@ -2161,6 +2179,7 @@ S_usage(pTHX_ char *name)         /* XXX move this out into a module ? */
 "-s              enable rudimentary parsing for switches after programfile",
 "-S              look for programfile using PATH environment variable",
 "-T              enable tainting checks",
+"-t              enable tainting warnings",
 "-u              dump core after parsing program",
 "-U              allow unsafe operations",
 "-v              print version, subversion (includes VERY IMPORTANT perl info)",
@@ -2269,8 +2288,13 @@ Perl_moreswitches(pTHX_ char *s)
            PL_debug = atoi(s+1);
            for (s++; isDIGIT(*s); s++) ;
        }
+#ifdef EBCDIC
+       if (DEBUG_p_TEST_ && ckWARN_d(WARN_DEBUGGING))
+           Perl_warner(aTHX_ packWARN(WARN_DEBUGGING),
+                   "-Dp not implemented on this platform\n");
+#endif
        PL_debug |= DEBUG_TOP_FLAG;
-#else
+#else /* !DEBUGGING */
        if (ckWARN_d(WARN_DEBUGGING))
            Perl_warner(aTHX_ packWARN(WARN_DEBUGGING),
                   "Recompile perl with -DDEBUGGING to use -D switch\n");
@@ -3443,11 +3467,11 @@ S_procself_val(pTHX_ SV *sv, char *arg0)
     int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
     /* FreeBSD's implementation is acknowledged to be imperfect, sometimes
        returning the text "unknown" from the readlink rather than the path
-       to the exacutable (or returing an error from the readlink).  Any valid
+       to the executable (or returning an error from the readlink).  Any valid
        path has a '/' in it somewhere, so use that to validate the result.
        See http://www.freebsd.org/cgi/query-pr.cgi?pr=35703
     */
-    if (len > 0 && memchr (buf, '/', len)) {
+    if (len > 0 && memchr(buf, '/', len)) {
        sv_setpvn(sv,buf,len);
     }
     else {