--- xinu/sys/ttygetc.c 2018/04/24 17:39:04 1.1.1.1 +++ xinu/sys/ttygetc.c 2018/04/24 17:39:47 1.1.1.2 @@ -10,20 +10,20 @@ *------------------------------------------------------------------------ */ ttygetc(devptr) -struct devsw *devptr; + struct devsw *devptr; { - PStype ps; int ch; - struct tty *iptr; + register struct tty *ttyp; - disable(ps); - iptr = &tty[devptr->dvminor]; - wait(iptr->isem); /* wait for a character in buff */ - ch = LOWBYTE & iptr->ibuff[iptr->itail++]; - if (iptr->itail >= IBUFLEN) - iptr->itail = 0; - if (iptr->ieof && (iptr->ieofc == ch) ) - ch = EOF; - restore(ps); +#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); }