blob: 5ac070d497b143a8fe5a45bc0857284d4fccce5f [file] [log] [blame]
rsc727facb2004-12-28 19:18:33 +00001#include "lib9.h"
2#include <bio.h>
3
4static int
5fmtBflush(Fmt *f)
6{
7 Biobuf *bp;
8
9 bp = f->farg;
10 bp->ocount = (char*)f->to - (char*)f->stop;
11 if(Bflush(bp) < 0)
12 return 0;
13 f->stop = bp->ebuf;
14 f->to = (char*)f->stop + bp->ocount;
15 f->start = f->to;
16 return 1;
17}
18
19int
20Bvprint(Biobuf *bp, char *fmt, va_list arg)
21{
22 int n;
23 Fmt f;
24
25 f.runes = 0;
26 f.stop = bp->ebuf;
27 f.start = (char*)f.stop + bp->ocount;
28 f.to = f.start;
29 f.flush = fmtBflush;
30 f.farg = bp;
31 f.nfmt = 0;
rsc5eb2d212005-01-06 23:45:51 +000032 n = fmtvprint(&f, fmt, arg);
rsc727facb2004-12-28 19:18:33 +000033 bp->ocount = (char*)f.to - (char*)f.stop;
34 return n;
35}
36
37
38