aboutsummaryrefslogtreecommitdiff
path: root/src/libbio/boffset.c
blob: df28aaf76ab1f27f47f6c9c2c39ef8bafde3cae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include	"lib9.h"
#include	<bio.h>

off_t
Boffset(Biobuf *bp)
{
	off_t n;

	switch(bp->state) {
	default:
		fprint(2, "Boffset: unknown state %d\n", bp->state);
		n = Beof;
		break;

	case Bracteof:
	case Bractive:
		n = bp->offset + bp->icount;
		break;

	case Bwactive:
		n = bp->offset + (bp->bsize + bp->ocount);
		break;
	}
	return n;
}