diff options
author | Chip Salzenberg <chip@perl.com> | 1997-03-22 07:42:31 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-03-22 15:34:25 +1200 |
commit | 4b65379bc43430e952dd16dee404322de24998dc (patch) | |
tree | 70a70b5aea627ada9fbb24c8fa84ae36a2bf60cf /mg.c | |
parent | b226d704a95b67a31c9c67a9ab25966507c62295 (diff) | |
download | perl-4b65379bc43430e952dd16dee404322de24998dc.tar.gz |
Automatically flush on C< $| = 1 >
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1374,9 +1374,18 @@ MAGIC* mg; IoPAGE(GvIOp(defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)); break; case '|': - IoFLAGS(GvIOp(defoutgv)) &= ~IOf_FLUSH; - if ((SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) != 0) { - IoFLAGS(GvIOp(defoutgv)) |= IOf_FLUSH; + { + IO *io = GvIOp(defoutgv); + if ((SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) == 0) + IoFLAGS(io) &= ~IOf_FLUSH; + else { + if (!(IoFLAGS(io) & IOf_FLUSH)) { + PerlIO *ofp = IoOFP(io); + if (ofp) + (void)PerlIO_flush(ofp); + IoFLAGS(io) |= IOf_FLUSH; + } + } } break; case '*': |