#include	"all.h"
#include	<fio.h>


Fgetc(int fd)
{
	Fbuffer *f;
	char *next;

	FIOSET(f, fd);
	next = f->next;
	if(next >= f->end) {
		if(f->end >= &f->buf[FIOBSIZE])
			f->end = f->buf;
		f->next = f->end;
		if(_F_fillbuf(fd) <= 0)
			return -1;
		next = f->next;
	}
	f->lnext = next;
	f->flags &= ~(FIO_RDLAST|FIO_WRITING);
	f->next = next+1;
	return *(unsigned char*)next;
}
