shithub: pc

ref: bd6157cf317c95546a015c2f764d096b13d4491a
dir: /include/bio.h/

View raw version
#include <stdio.h>

typedef FILE Biobufhdr;
typedef Biobufhdr Biobuf;

static uint8_t lastc;

static int
Bgetc(Biobufhdr *bp)
{
	lastc = fgetc(bp);
	return feof(bp) ? -1 : lastc;
}

static int
Bungetc(Biobufhdr *bp)
{
	ungetc(lastc, bp);
	lastc = 0;
	return 0;
}

static Biobufhdr *
Bfdopen(int f, int mode)
{
	return stdin;
}