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