|
|
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: /*------------------------------------------------------------------------
36: * tdumph -- dump the tty control block
37: *------------------------------------------------------------------------
38: */
39: tdumph()
40: {
41: tdump();
42: }
43:
44: /*------------------------------------------------------------------------
45: * tdump1 -- dump one tty control block
46: *------------------------------------------------------------------------
47: */
48: tdump1(tnum)
49: int tnum;
50: {
51: register struct tty *iptr;
52: PStype ps;
53: int i;
54:
55: disable(ps);
56: iptr = &tty[tnum];
57: kprintf("Tty %d CSR at %o\n",tnum,iptr->ioaddr);
58: kprintf("INPUT -- tail at %d head at %d sem # %d value %d\n",
59: iptr->itail,iptr->ihead,iptr->isem,i=scount(iptr->isem));
60: if (i<0)
61: i=0;
62: else if (i > IBUFLEN)
63: i = IBUFLEN;
64: tqdump(iptr->itail,i,IBUFLEN,iptr->ibuff);
65: kprintf("OUTPUT -- tail at %d head at %d sem # %d value %d\n",
66: iptr->otail,iptr->ohead,iptr->osem,i=scount(iptr->osem));
67: i = OBUFLEN - i;
68: if (i < 0)
69: i = 0;
70: else if (i>OBUFLEN)
71: i = OBUFLEN;
72: tqdump(iptr->otail,i,OBUFLEN,iptr->obuff);
73: restore(ps);
74: }
75: static tqdump(start, len, maxlen, buff)
76: int start,len,maxlen;
77: char *buff;
78: {
79: register int i;
80: for ( i=start ; len>0 ; len-- ) {
81: if ( buff[i]&0200 ) kprintf("M-");
82: kprintf("%s",unctrl[buff[i]&0177]);
83: if (++i >= maxlen)
84: i = 0;
85: }
86: kprintf("\n");
87: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.