do flush properly

This commit is contained in:
rsc 2004-04-25 21:13:58 +00:00
parent e5f0d957f2
commit 62780722f5
2 changed files with 7 additions and 1 deletions

View file

@ -31,7 +31,11 @@ Bfmtinit(Fmt *f, Biobuf *b)
int int
Bfmtflush(Fmt *f) Bfmtflush(Fmt *f)
{ {
if(_Bfmtflush(f) <= 0) Biobuf *b;
b = f->farg;
if(f->to == nil)
return -1; return -1;
b->ocount = (char*)f->to - (char*)f->stop;
return f->nfmt; return f->nfmt;
} }

View file

@ -14,5 +14,7 @@ Bprint(Biobuf *bp, char *fmt, ...)
f.args = args; f.args = args;
n = dofmt(&f, fmt); n = dofmt(&f, fmt);
va_end(args); va_end(args);
if(n > 0 && Bfmtflush(&f) < 0)
return -1;
return n; return n;
} }