plan9port/src/libbio/bputc.c

21 lines
227 B
C
Raw Normal View History

2003-09-30 17:47:41 +00:00
#include "lib9.h"
#include <bio.h>
int
Bputc(Biobuf *bp, int c)
{
2004-12-28 19:25:16 +00:00
int i;
2003-09-30 17:47:41 +00:00
2004-12-28 19:25:16 +00:00
for(;;) {
i = bp->ocount;
if(i) {
bp->ebuf[i++] = c;
bp->ocount = i;
return 0;
}
if(Bflush(bp) == Beof)
break;
2003-09-30 17:47:41 +00:00
}
return Beof;
}