unix/fiss

lib/libbio/bputc.c in master
Repositories | Summary | Log | Files | LICENSE

bputc.c (234B) download


 1#include "lib9.h"
 2
 3#include <bio.h>
 4
 5int Bputc(Biobuf* bp, int c) {
 6	int i;
 7
 8	for (;;) {
 9		i = bp->ocount;
10		if (i) {
11			bp->ebuf[i++] = c;
12			bp->ocount    = i;
13			return 0;
14		}
15		if (Bflush(bp) == Beof)
16			break;
17	}
18	return Beof;
19}