File:  [XINU] / xinu / sys / ttygetc.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:47 2018 UTC (8 years, 3 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19910600, HEAD
Xinu for 68000/68010

/* ttygetc.c - ttygetc */

#include <conf.h>
#include <kernel.h>
#include <tty.h>
#include <io.h>

/*------------------------------------------------------------------------
 *  ttygetc - read one character from a tty device
 *------------------------------------------------------------------------
 */
ttygetc(devptr)
	struct	devsw	*devptr;
{
	int	ch;
	register struct	tty   *ttyp;

#ifdef	DEBUG
	dotrace("ttygetc", &devptr, 1);
#endif
	ttyp = &tty[devptr->dvminor];
	wait(ttyp->isem);		/* wait	for a character	in buff	*/
	disable();
	ch = ttyp->ibuff[ttyp->itail++];
	if (ttyp->itail	== IBUFLEN)
		ttyp->itail = 0;
	restore();
	return(ch);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.