Annotation of xinu/sys/ttygetc.c, revision 1.1.1.2

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)
1.1.1.2 ! root       13:        struct  devsw   *devptr;
1.1       root       14: {
                     15:        int     ch;
1.1.1.2 ! root       16:        register struct tty   *ttyp;
1.1       root       17: 
1.1.1.2 ! root       18: #ifdef DEBUG
        !            19:        dotrace("ttygetc", &devptr, 1);
        !            20: #endif
        !            21:        ttyp = &tty[devptr->dvminor];
        !            22:        wait(ttyp->isem);               /* wait for a character in buff */
        !            23:        disable();
        !            24:        ch = ttyp->ibuff[ttyp->itail++];
        !            25:        if (ttyp->itail == IBUFLEN)
        !            26:                ttyp->itail = 0;
        !            27:        restore();
1.1       root       28:        return(ch);
                     29: }

unix.superglobalmegacorp.com

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