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

1.1       root        1: /* tdump.c - tdump, tdumph, tdump1 */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <tty.h>
                      6: 
                      7: /*
                      8:  * routines to dump contents of tty control block
                      9:  */
                     10: static char    *unctrl[]       = {     /* unctrl codes for ttys        */
                     11:        "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K",
                     12:        "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
                     13:        "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
                     14:        " ", "!", "\"", "#", "$",  "%", "&", "'", "(", ")", "*", "+", ",", "-",
                     15:        ".", "/", "0",  "1", "2",  "3", "4", "5", "6", "7", "8", "9", ":", ";",
                     16:        "<", "=", ">",  "?", "@",  "A", "B", "C", "D", "E", "F", "G", "H", "I",
                     17:        "J", "K", "L",  "M", "N",  "O", "P", "Q", "R", "S", "T", "U", "V", "W",
                     18:        "X", "Y", "Z",  "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
                     19:        "f", "g", "h",  "i", "j",  "k", "l", "m", "n", "o", "p", "q", "r", "s",
                     20:        "t", "u", "v",  "w", "x",  "y", "z", "{", "|", "}", "~", "^?"
                     21: };
                     22: 
                     23: /*------------------------------------------------------------------------
                     24:  *  tdump  --  dump the tty control blocks
                     25:  *------------------------------------------------------------------------
                     26:  */
                     27: tdump()
                     28: {
                     29:        int i;
                     30: 
                     31:        for (i=0 ; i<Ntty ; i++)
                     32:                tdump1(i);
                     33: }
                     34: 
                     35: /*------------------------------------------------------------------------
1.1.1.2 ! root       36:  *  tdumph  --  dump the tty control blocks and halt
1.1       root       37:  *------------------------------------------------------------------------
                     38:  */
                     39: tdumph()
                     40: {
                     41:        tdump();
1.1.1.2 ! root       42:        kprintf("\nDump complete -- type P to continue\n");
        !            43: /*     halt();         */
1.1       root       44: }
                     45: 
                     46: /*------------------------------------------------------------------------
                     47:  *  tdump1  --  dump one tty control block
                     48:  *------------------------------------------------------------------------
                     49:  */
                     50: tdump1(tnum)
                     51: int tnum;
                     52: {
                     53:         register struct tty *iptr;
1.1.1.2 ! root       54:        int len;
1.1       root       55:        int i;
                     56: 
1.1.1.2 ! root       57:         disable();
1.1       root       58:         iptr = &tty[tnum];
1.1.1.2 ! root       59:        kprintf("Tty %d CSR at 0x%x\n",tnum,iptr->ioaddr);
        !            60:         kprintf("INPUT  -- tail at %d, head at %d, sem #%d = value %d\n",
1.1       root       61:                iptr->itail,iptr->ihead,iptr->isem,i=scount(iptr->isem));
                     62:        if (i<0)
                     63:                i=0;
                     64:        else if (i > IBUFLEN)
                     65:                i = IBUFLEN;
                     66:        tqdump(iptr->itail,i,IBUFLEN,iptr->ibuff);
1.1.1.2 ! root       67:         kprintf("OUTPUT -- tail at %d, head at %d, sem #%d = value %d\n",
1.1       root       68:                iptr->otail,iptr->ohead,iptr->osem,i=scount(iptr->osem));
                     69:        i = OBUFLEN - i;
                     70:        if (i < 0)
                     71:                i = 0;
                     72:        else if (i>OBUFLEN)
                     73:                i = OBUFLEN;
                     74:        tqdump(iptr->otail,i,OBUFLEN,iptr->obuff);
1.1.1.2 ! root       75:         restore();
1.1       root       76: }
                     77: static tqdump(start, len, maxlen, buff)
                     78: int start,len,maxlen;
                     79: char *buff;
                     80: {
                     81:        register int i;
                     82:         for ( i=start ; len>0 ; len-- ) {
                     83:                 if ( buff[i]&0200 ) kprintf("M-");
                     84:                 kprintf("%s",unctrl[buff[i]&0177]);
                     85:                if (++i >= maxlen)
                     86:                        i = 0;
                     87:         }
                     88:        kprintf("\n");
                     89: }

unix.superglobalmegacorp.com

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