X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=438139f6e5e68b77edb068ba09c55c932c879231;hb=462d8b025fb2f0b0f3b03c2b1a0b9a1d4406346c;hp=9cfcc4e1c5c8a3fc8aa795823d501b5e860d6cde;hpb=479b2847c3fbb8fe8ee4a5811514a771839458c4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index 9cfcc4e..438139f 100644 --- a/doio.c +++ b/doio.c @@ -1,6 +1,7 @@ /* doio.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + * 2000, 2001, 2002, 2003, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -323,13 +324,13 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, if (num_svs > 1) { Perl_croak(aTHX_ "More than one argument to '%c&' open",IoTYPE(io)); } + /*SUPPRESS 530*/ + for (; isSPACE(*type); type++) ; if (num_svs && (SvIOK(*svp) || (SvPOK(*svp) && looks_like_number(*svp)))) { fd = SvUV(*svp); num_svs = 0; } else if (isDIGIT(*type)) { - /*SUPPRESS 530*/ - for (; isSPACE(*type); type++) ; fd = atoi(type); } else { @@ -339,8 +340,6 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, } else { GV *thatgv; - /*SUPPRESS 530*/ - for (; isSPACE(*type); type++) ; thatgv = gv_fetchpv(type,FALSE,SVt_PVIO); thatio = GvIO(thatgv); } @@ -719,6 +718,8 @@ Perl_nextargv(pTHX_ register GV *gv) #endif } PL_filemode = 0; + if (!GvAV(gv)) + return Nullfp; while (av_len(GvAV(gv)) >= 0) { STRLEN oldlen; sv = av_shift(GvAV(gv)); @@ -775,8 +776,8 @@ Perl_nextargv(pTHX_ register GV *gv) { if (ckWARN_d(WARN_INPLACE)) Perl_warner(aTHX_ packWARN(WARN_INPLACE), - "Can't do inplace edit: %s would not be unique", - SvPVX(sv)); + "Can't do inplace edit: %"SVf" would not be unique", + sv); do_close(gv,FALSE); continue; } @@ -786,8 +787,8 @@ Perl_nextargv(pTHX_ register GV *gv) if (PerlLIO_rename(PL_oldname,SvPVX(sv)) < 0) { if (ckWARN_d(WARN_INPLACE)) Perl_warner(aTHX_ packWARN(WARN_INPLACE), - "Can't rename %s to %s: %s, skipping file", - PL_oldname, SvPVX(sv), Strerror(errno) ); + "Can't rename %s to %"SVf": %s, skipping file", + PL_oldname, sv, Strerror(errno) ); do_close(gv,FALSE); continue; } @@ -802,8 +803,8 @@ Perl_nextargv(pTHX_ register GV *gv) if (link(PL_oldname,SvPVX(sv)) < 0) { if (ckWARN_d(WARN_INPLACE)) Perl_warner(aTHX_ packWARN(WARN_INPLACE), - "Can't rename %s to %s: %s, skipping file", - PL_oldname, SvPVX(sv), Strerror(errno) ); + "Can't rename %s to %"SVf": %s, skipping file", + PL_oldname, sv, Strerror(errno) ); do_close(gv,FALSE); continue; } @@ -1268,7 +1269,8 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp) default: if (PerlIO_isutf8(fp)) { if (!SvUTF8(sv)) - sv_utf8_upgrade(sv = sv_mortalcopy(sv)); + sv_utf8_upgrade_flags(sv = sv_mortalcopy(sv), + SV_GMAGIC|SV_UTF8_NO_ENCODING); } else if (DO_UTF8(sv)) { if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) @@ -1322,7 +1324,7 @@ Perl_my_stat(pTHX) else { SV* sv = POPs; char *s; - STRLEN n_a; + STRLEN len; PUTBACK; if (SvTYPE(sv) == SVt_PVGV) { gv = (GV*)sv; @@ -1333,9 +1335,10 @@ Perl_my_stat(pTHX) goto do_fstat; } - s = SvPV(sv, n_a); + s = SvPV(sv, len); PL_statgv = Nullgv; - sv_setpv(PL_statname, s); + sv_setpvn(PL_statname, s, len); + s = SvPVX(PL_statname); /* s now NUL-terminated */ PL_laststype = OP_STAT; PL_laststatval = PerlLIO_stat(s, &PL_statcache); if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(s, '\n')) @@ -1642,10 +1645,10 @@ nothing in the core. if (mark == sp) break; s = SvPVx(*++mark, n_a); - if (isUPPER(*s)) { + if (isALPHA(*s)) { if (*s == 'S' && s[1] == 'I' && s[2] == 'G') s += 3; - if (!(val = whichsig(s))) + if ((val = whichsig(s)) < 0) Perl_croak(aTHX_ "Unrecognized signal name \"%s\"",s); } else @@ -1745,22 +1748,23 @@ nothing in the core. SV* modified = *++mark; void * utbufp = &utbuf; - /* be like C, and if both times are undefined, let the C - library figure out what to do. This usually means - "current time" */ + /* Be like C, and if both times are undefined, let the C + * library figure out what to do. This usually means + * "current time". */ if ( accessed == &PL_sv_undef && modified == &PL_sv_undef ) - utbufp = NULL; - - Zero(&utbuf, sizeof utbuf, char); + utbufp = NULL; + else { + Zero(&utbuf, sizeof utbuf, char); #ifdef BIG_TIME - utbuf.actime = (Time_t)SvNVx(accessed); /* time accessed */ - utbuf.modtime = (Time_t)SvNVx(modified); /* time modified */ + utbuf.actime = (Time_t)SvNVx(accessed); /* time accessed */ + utbuf.modtime = (Time_t)SvNVx(modified); /* time modified */ #else - utbuf.actime = (Time_t)SvIVx(accessed); /* time accessed */ - utbuf.modtime = (Time_t)SvIVx(modified); /* time modified */ + utbuf.actime = (Time_t)SvIVx(accessed); /* time accessed */ + utbuf.modtime = (Time_t)SvIVx(modified); /* time modified */ #endif - APPLY_TAINT_PROPER(); + } + APPLY_TAINT_PROPER(); tot = sp - mark; while (++mark <= sp) { char *name = SvPVx(*mark, n_a);