diff options
author | rsc <devnull@localhost> | 2003-09-30 17:47:41 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-09-30 17:47:41 +0000 |
commit | b2cfc4e2e71d0f0a5113ddfbd93c8285cc4d74e4 (patch) | |
tree | f382987fec33cf639d75b1fe1b5d76b8f155d074 /src/libbio/bprint.c | |
parent | 5f7d5e8d1899f41b0e5366c0251530ea1dc753d0 (diff) | |
download | plan9port-b2cfc4e2e71d0f0a5113ddfbd93c8285cc4d74e4.tar.gz plan9port-b2cfc4e2e71d0f0a5113ddfbd93c8285cc4d74e4.tar.bz2 plan9port-b2cfc4e2e71d0f0a5113ddfbd93c8285cc4d74e4.zip |
Initial revision
Diffstat (limited to 'src/libbio/bprint.c')
-rw-r--r-- | src/libbio/bprint.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libbio/bprint.c b/src/libbio/bprint.c new file mode 100644 index 00000000..81e71e5e --- /dev/null +++ b/src/libbio/bprint.c @@ -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; +} |