unix/fiss

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

bbuffered.c (300B) download


 1#include "lib9.h"
 2
 3#include <bio.h>
 4
 5int Bbuffered(Biobuf* bp) {
 6	switch (bp->state) {
 7		case Bracteof:
 8		case Bractive:
 9			return -bp->icount;
10
11		case Bwactive:
12			return bp->bsize + bp->ocount;
13
14		case Binactive:
15			return 0;
16	}
17	fprint(2, "Bbuffered: unknown state %d\n", bp->state);
18	return 0;
19}