/* getch.c */

#include <stdio.h>
#include "getch.h"

int getch(void)
{
	return( (bufp > 0 ? buf[--bufp] : getchar()) );
}

void ungetch(int c) 
{
	if(bufp >= BUFSZ) {
		printf("ungetch: Buffer is full !!\n");
	} else {
		buf[bufp++] = c;
	}

	return;
}

