wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

boffset.c (343B)


      1 #include	"plan9.h"
      2 #include	<bio.h>
      3 
      4 off_t
      5 Boffset(Biobuf *bp)
      6 {
      7 	off_t n;
      8 
      9 	switch(bp->state) {
     10 	default:
     11 		fprint(2, "Boffset: unknown state %d\n", bp->state);
     12 		n = Beof;
     13 		break;
     14 
     15 	case Bracteof:
     16 	case Bractive:
     17 		n = bp->offset + bp->icount;
     18 		break;
     19 
     20 	case Bwactive:
     21 		n = bp->offset + (bp->bsize + bp->ocount);
     22 		break;
     23 	}
     24 	return n;
     25 }