| tdo flush properly - plan9port - [fork] Plan 9 from user space | |
| git clone git://src.adamsgaard.dk/plan9port | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit 62780722f528fdbc19afb48128f1638e55d1568b | |
| parent e5f0d957f2737346033dbd3175fb6a0803d841ba | |
| Author: rsc <devnull@localhost> | |
| Date: Sun, 25 Apr 2004 21:13:58 +0000 | |
| do flush properly | |
| Diffstat: | |
| M src/libbio/bfmt.c | 6 +++++- | |
| M src/libbio/bprint.c | 2 ++ | |
| 2 files changed, 7 insertions(+), 1 deletion(-) | |
| --- | |
| diff --git a/src/libbio/bfmt.c b/src/libbio/bfmt.c | |
| t@@ -31,7 +31,11 @@ Bfmtinit(Fmt *f, Biobuf *b) | |
| int | |
| Bfmtflush(Fmt *f) | |
| { | |
| - if(_Bfmtflush(f) <= 0) | |
| + Biobuf *b; | |
| + | |
| + b = f->farg; | |
| + if(f->to == nil) | |
| return -1; | |
| + b->ocount = (char*)f->to - (char*)f->stop; | |
| return f->nfmt; | |
| } | |
| diff --git a/src/libbio/bprint.c b/src/libbio/bprint.c | |
| t@@ -14,5 +14,7 @@ Bprint(Biobuf *bp, char *fmt, ...) | |
| f.args = args; | |
| n = dofmt(&f, fmt); | |
| va_end(args); | |
| + if(n > 0 && Bfmtflush(&f) < 0) | |
| + return -1; | |
| return n; | |
| } |