This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Unicode 4.1.0
[perl5.git] / pp_sys.c
index 0bb7165..cf188f0 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -322,16 +322,16 @@ PP(pp_backtick)
     STRLEN n_a;
     char *tmps = POPpx;
     I32 gimme = GIMME_V;
-    char *mode = "r";
+    const char *mode = "r";
 
     TAINT_PROPER("``");
     if (PL_op->op_private & OPpOPEN_IN_RAW)
        mode = "rb";
     else if (PL_op->op_private & OPpOPEN_IN_CRLF)
        mode = "rt";
-    fp = PerlProc_popen(tmps, mode);
+    fp = PerlProc_popen(tmps, (char *)mode);
     if (fp) {
-       char *type = NULL;
+        const char *type = NULL;
        if (PL_curcop->cop_io) {
            type = SvPV_nolen(PL_curcop->cop_io);
        }
@@ -345,13 +345,14 @@ PP(pp_backtick)
                ;
        }
        else if (gimme == G_SCALAR) {
-           SV *oldrs = PL_rs;
+           ENTER;
+           SAVESPTR(PL_rs);
            PL_rs = &PL_sv_undef;
            sv_setpv(TARG, ""); /* note that this preserves previous buffer */
            while (sv_gets(TARG, fp, SvCUR(TARG)) != Nullch)
                /*SUPPRESS 530*/
                ;
-           PL_rs = oldrs;
+           LEAVE;
            XPUSHs(TARG);
            SvTAINTED_on(TARG);
        }
@@ -432,7 +433,7 @@ PP(pp_warn)
 {
     dSP; dMARK;
     SV *tmpsv;
-    char *tmps;
+    const char *tmps;
     STRLEN len;
     if (SP - MARK != 1) {
        dTARGET;
@@ -462,7 +463,7 @@ PP(pp_warn)
 PP(pp_die)
 {
     dSP; dMARK;
-    char *tmps;
+    const char *tmps;
     SV *tmpsv;
     STRLEN len;
     bool multiarg = 0;
@@ -789,7 +790,7 @@ PP(pp_tie)
     GV *gv;
     SV *sv;
     I32 markoff = MARK - PL_stack_base;
-    char *methname;
+    const char *methname;
     int how = PERL_MAGIC_tied;
     U32 items;
 
@@ -1346,7 +1347,7 @@ PP(pp_leavewrite)
            }
            topgv = gv_fetchpv(IoTOP_NAME(io),FALSE, SVt_PVFM);
            if (!topgv || !GvFORM(topgv)) {
-               IoLINES_LEFT(io) = 100000000;
+               IoLINES_LEFT(io) = IoPAGE_LEN(io);
                goto forget_top;
            }
            IoTOP_GV(io) = topgv;
@@ -1698,7 +1699,7 @@ PP(pp_sysread)
 
        read_target = sv_newmortal();
        SvUPGRADE(read_target, SVt_PV);
-       buffer = SvGROW(read_target, length + 1);
+       buffer = SvGROW(read_target, (STRLEN)(length + 1));
     }
 
     if (PL_op->op_type == OP_SYSREAD) {
@@ -1967,7 +1968,7 @@ PP(pp_eof)
                if ((IoFLAGS(io) & IOf_START) && av_len(GvAVn(gv)) < 0) {
                    IoLINES(io) = 0;
                    IoFLAGS(io) &= ~IOf_START;
-                   do_open(gv, "-", 1, FALSE, O_RDONLY, 0, Nullfp);
+                   do_open(gv, (char *)"-", 1, FALSE, O_RDONLY, 0, Nullfp);
                    sv_setpvn(GvSV(gv), "-", 1);
                    SvSETMAGIC(GvSV(gv));
                }
@@ -2109,7 +2110,6 @@ PP(pp_truncate)
      * might not be signed: if it is not, clever compilers will moan. */
     /* XXX Configure probe for the signedness of the length type of *truncate() needed? XXX */
     SETERRNO(0,0);
-#if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE) || defined(F_FREESP)
     {
        int result = 1;
        GV *tmpgv;
@@ -2184,9 +2184,6 @@ PP(pp_truncate)
            SETERRNO(EBADF,RMS_IFI);
        RETPUSHUNDEF;
     }
-#else
-    DIE(aTHX_ "truncate not implemented");
-#endif
 }
 
 PP(pp_fcntl)
@@ -2199,7 +2196,7 @@ PP(pp_ioctl)
     dSP; dTARGET;
     SV *argsv = POPs;
     unsigned int func = POPu;
-    int optype = PL_op->op_type;
+    const int optype = PL_op->op_type;
     char *s;
     IV retval;
     GV *gv = (GV*)POPs;
@@ -3463,7 +3460,6 @@ PP(pp_fttext)
        sv = POPs;
       really_filename:
        PL_statgv = Nullgv;
-       PL_laststatval = -1;
        PL_laststype = OP_STAT;
        sv_setpv(PL_statname, SvPV(sv, n_a));
        if (!(fp = PerlIO_open(SvPVX(PL_statname), "r"))) {
@@ -4531,9 +4527,9 @@ PP(pp_gmtime)
 {
     dSP;
     Time_t when;
-    struct tm *tmbuf;
-    static char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-    static char *monname[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+    const struct tm *tmbuf;
+    static const char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+    static const char *monname[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                              "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
 
     if (MAXARG < 1)