diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-11-04 08:26:19 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-11-04 08:26:19 +0000 |
commit | 1542b985032ae6eca76d4ca4c21d2269e21544f1 (patch) | |
tree | 29942426b17d0905958ad71fd1da85cb571fe4fb /doio.c | |
parent | da9274502cf796d52a9875e4c9f650b53901ad73 (diff) | |
parent | d20626d86bf3d55ba658adbc2678de4c519cbc6c (diff) | |
download | perl-1542b985032ae6eca76d4ca4c21d2269e21544f1.tar.gz |
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@4513
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -484,9 +484,15 @@ Perl_nextargv(pTHX_ register GV *gv) #endif Uid_t fileuid; Gid_t filegid; + IO *io = GvIOp(gv); if (!PL_argvoutgv) PL_argvoutgv = gv_fetchpv("ARGVOUT",TRUE,SVt_PVIO); + if (io && (IoFLAGS(io) & IOf_ARGV) && (IoFLAGS(io) & IOf_START)) { + IoFLAGS(io) &= ~IOf_START; + if (PL_inplace) + av_push(PL_argvout_stack, SvREFCNT_inc(PL_defoutgv)); + } if (PL_filemode & (S_ISUID|S_ISGID)) { PerlIO_flush(IoIFP(GvIOn(PL_argvoutgv))); /* chmod must follow last write */ #ifdef HAS_FCHMOD @@ -610,11 +616,12 @@ Perl_nextargv(pTHX_ register GV *gv) SETERRNO(0,0); /* in case sprintf set errno */ #ifdef VMS if (!do_open(PL_argvoutgv,SvPVX(sv),SvCUR(sv),PL_inplace!=0, - O_WRONLY|O_CREAT|O_TRUNC,0,Nullfp)) { + O_WRONLY|O_CREAT|O_TRUNC,0,Nullfp)) #else if (!do_open(PL_argvoutgv,SvPVX(sv),SvCUR(sv),PL_inplace!=0, - O_WRONLY|O_CREAT|OPEN_EXCL,0666,Nullfp)) { + O_WRONLY|O_CREAT|OPEN_EXCL,0666,Nullfp)) #endif + { if (ckWARN_d(WARN_INPLACE)) Perl_warner(aTHX_ WARN_INPLACE, "Can't do inplace edit on %s: %s", PL_oldname, Strerror(errno) ); @@ -657,8 +664,16 @@ Perl_nextargv(pTHX_ register GV *gv) } } } + if (io && (IoFLAGS(io) & IOf_ARGV)) + IoFLAGS(io) |= IOf_START; if (PL_inplace) { (void)do_close(PL_argvoutgv,FALSE); + if (io && (IoFLAGS(io) & IOf_ARGV) && AvFILLp(PL_argvout_stack) >= 0) { + GV *oldout = (GV*)av_pop(PL_argvout_stack); + setdefout(oldout); + SvREFCNT_dec(oldout); + return Nullfp; + } setdefout(gv_fetchpv("STDOUT",TRUE,SVt_PVIO)); } return Nullfp; |