blob: 81e71e5ec8a53a1f808e8e17b71b1f307f255761 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "lib9.h"
#include <bio.h>
int
Bprint(Biobuf *bp, char *fmt, ...)
{
va_list ap;
char *ip, *ep, *out;
int n;
ep = (char*)bp->ebuf;
ip = ep + bp->ocount;
va_start(ap, fmt);
out = vseprint(ip, ep, fmt, ap);
va_end(ap);
if(out == 0 || out >= ep-5) {
Bflush(bp);
ip = ep + bp->ocount;
va_start(ap, fmt);
out = vseprint(ip, ep, fmt, ap);
va_end(ap);
if(out >= ep-5)
return Beof;
}
n = out-ip;
bp->ocount += n;
return n;
}
|