Initial revision
This commit is contained in:
parent
5f7d5e8d18
commit
b2cfc4e2e7
242 changed files with 18177 additions and 0 deletions
28
src/libbio/bprint.c
Normal file
28
src/libbio/bprint.c
Normal file
|
|
@ -0,0 +1,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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue