|
|
1.1 ! root 1: /* ttygetc.c - ttygetc */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <tty.h> ! 6: #include <io.h> ! 7: ! 8: /*------------------------------------------------------------------------ ! 9: * ttygetc - read one character from a tty device ! 10: *------------------------------------------------------------------------ ! 11: */ ! 12: ttygetc(devptr) ! 13: struct devsw *devptr; ! 14: { ! 15: PStype ps; ! 16: int ch; ! 17: struct tty *iptr; ! 18: ! 19: disable(ps); ! 20: iptr = &tty[devptr->dvminor]; ! 21: wait(iptr->isem); /* wait for a character in buff */ ! 22: ch = LOWBYTE & iptr->ibuff[iptr->itail++]; ! 23: if (iptr->itail >= IBUFLEN) ! 24: iptr->itail = 0; ! 25: if (iptr->ieof && (iptr->ieofc == ch) ) ! 26: ch = EOF; ! 27: restore(ps); ! 28: return(ch); ! 29: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.