unix/fiss

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

boffset.c (355B) download


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