mirror of
https://git.suckless.org/9base
synced 2025-08-14 11:45:45 -07:00
22 lines
308 B
C
22 lines
308 B
C
#include "lib9.h"
|
|
#include <bio.h>
|
|
#include <fmt.h>
|
|
|
|
int
|
|
Bbuffered(Biobuf *bp)
|
|
{
|
|
switch(bp->state) {
|
|
case Bracteof:
|
|
case Bractive:
|
|
return -bp->icount;
|
|
|
|
case Bwactive:
|
|
return bp->bsize + bp->ocount;
|
|
|
|
case Binactive:
|
|
return 0;
|
|
}
|
|
fprint(2, "Bbuffered: unknown state %d\n", bp->state);
|
|
return 0;
|
|
}
|