fiss

Friedel's Initialization and Service Supervision
Log | Files | Refs | LICENSE

bbuffered.c (300B)


      1 #include "lib9.h"
      2 
      3 #include <bio.h>
      4 
      5 int 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 }