Charles.Forsyth20060303a828770d19 years agoHistory
28 lines · 456 B · C
RawDownload
#include	"lib9.h"#include	<bio.h> intBprint(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 == nil || 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;}