hbase

heirloom base
git clone git://git.2f30.org/hbase
Log | Files | Refs | README

bbuffered.c (291B)


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