From 84e28c465d4115e5f59dd6eb4da4a41d7dc11774 Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Sat, 3 May 2008 22:10:19 +0000 Subject: [PATCH] TODO: still not 100% equal changed much code to get it more equal. changed also code to make the diff to the plexis sources I have as small as possible while getting the same object code --- WEGA/src/uts/dev/tt0.c | 991 +++++++++++++++++++++-------------------- 1 file changed, 504 insertions(+), 487 deletions(-) diff --git a/WEGA/src/uts/dev/tt0.c b/WEGA/src/uts/dev/tt0.c index 61638ac..22a5823 100644 --- a/WEGA/src/uts/dev/tt0.c +++ b/WEGA/src/uts/dev/tt0.c @@ -1,487 +1,504 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern putcb(); - -ttin(tp, c, count) -register struct tty *tp; -long c; -int count; -{ - - register ushort ch; - register ushort mode; - register char *cp; - char *csp; - - extern tttimeo(); - - mode = tp->t_iflag; - if (count){ - if (count == 1) - goto L214; - putcb(c, tp); - sysinfo.rawch += count; - cp = &c->c_data[c->c_first]; -L5a: - if (tp->t_rawq.c_cc <= TTXOHI) { /* 3 */ -L62: - mode = tp->t_lflag; - if ((tp->t_state & IEXTPROC) || - (mode == 0)){ /* 4,5 */ - if (!(mode & ICANON)){/* 6 */ - tp->t_state &= ~RTO; - if (tp->t_cc[VMIN] <= tp->t_rawq.c_cc) /* 7 */ - tp->t_delct = 1; - else - if ((tp->t_cc[VTIME]) && - ((tp->t_state & TACT) == 0)) /* 72,73 */ - ttimeout(tp); - if ((tp->t_delct) == 0) return; /* 74 */ - } - if (tp->t_state & IASLP) { /* 75 */ - tp->t_state &= ~IASLP; - wakeup(tp); - } - return; - } - if (count--){ /* 67 */ - ch = *cp++; - mode = tp->t_lflag; - if (!(mode & ISIG)){ /* 68 */ -L494: - if (mode & ICANON){ /* 69 */ - if (ch == '\n'){ /* 70 */ - if (mode & ECHONL) - mode |= ECHO; - tp->t_delct++; - } - else - if (ch == tp->t_cc[VEOL]) - tp->t_delct++; - if ((tp->t_state & ESC) == 0){ /* 50 */ - if (ch == '\\') - tp->t_state |= ESC; - if ((ch == tp->t_cc[VERASE]) && - (mode & INPCK)){ /* 52,53 */ - if (mode & ECHO) /* 54 */ - ttxput(tp, (long) CERASE, 0); - mode |= ECHO; - ttxput(tp, (long) ' ', 0); - ch = CERASE; - } /* von 52,53 */ - else if ((ch == tp->t_cc[VKILL]) && - (mode & ISTRIP)){ /* 55,56 */ - if ((mode & ECHO) && - (mode & ISPCI)){ /* 57,58 */ - for ( csp = &"???"; (*csp);) - ttxput(tp, (long) *csp++, 0); - (*tp->t_proc)(tp, T_OUTPUT); - } - ttxput(tp, (long) ch, 0); - mode |= ECHO; - ch = '\n'; - } - else if (ch != tp->t_cc[VEOF]) /* 60 */ - if ((mode & ECHO) && - (mode & ISPCI)){ /* 61,62 */ - for ( csp = &"(eof)"; (*csp);) - ttxput(tp, (long) *csp++, 0); - (*tp->t_proc)(tp, T_OUTPUT); - } - mode &= ~ECHO; - tp->t_delct++; - } - else if ((ch == '\\') || - (mode & XCASE)) /* 64,65 */ - tp->t_state &= ~RTO; - } - if (mode & ECHO) /* 66 */ - ttxput(tp, (long) ch, 0); - (*tp->t_proc)(tp, T_OUTPUT); - } /* von 68 */ - else { - if (ch != tp->t_cc[VINTR]){ /* 43 */ - if (ch == tp->t_cc[VQUIT]) /* 44 */ - goto L494; - if (!(mode & NOFLSH)) - ttyflush(tp, T_RESUME); - if ((mode & ECHO) || - (mode & ISPCI)){ /* 46,47 */ - for ( csp = &"(quit)"; (*csp); csp++) - ttxput(tp,(long) *csp, 0); - (*tp->t_proc)(tp, T_OUTPUT); - } /* von 43 */ - } - else { - if (!(mode & NOFLSH)) - ttyflush(tp, T_RESUME); - if ((mode & ECHO) && - (mode & ISPCI)) /* 40,41 */{ - for ( csp = &"(intr)"; (*csp); csp++) - ttxput(tp, (long) *csp, 0); - (*tp->t_proc)(tp, T_OUTPUT); - } /* von 40,41 */ - } - } /* von 68 else */ - } /* von 67 */ - if (!(mode & ICANON)){ /* 6 */ - if (tp->t_cc[VMIN] <= tp->t_rawq.c_cc) - tp->t_delct = 1; - if ((tp->t_cc[VTIME]) && - ((tp->t_state & TACT) == 0)) - meout(tp); - } /* von 6 */ - if ((tp->t_delct) && - (tp->t_state & IASLP)){ /* 74,75 */ - tp->t_state &= ~IASLP; - wakeup(tp); - } - return; - } /* von 3 */ - else { - if ((mode & IXOFF)&& - (tp->t_state & TBLOCK)) /* 8,9 */ - (*tp->t_proc)(tp, T_BLOCK); - if (tp->t_rawq.c_cc <= TTYHOG) /* 10 */ - goto L62; - else - ttyflush(tp, T_TIME); - return; - } /* 3 von else */ - } /* von 1 */ - else { - count++; - ch = c.half.left; - if ((ch & IXOFF) && - (!(mode & INPCK))) /* 13,14 */ - ch &= ~PERROR; - if (ch & (OVERRUN | FRERROR | PERROR)){ /* 15 */ - if (ch & 0xff){ /* 16 */ - if (mode & IGNPAR) return; - if (mode & IGNBRK) return; - if (mode & BRKINT){ /* 12 */ - signal(tp->t_pgrp, SIGINT); - ttyflush(tp, T_RESUME); - return; - } - } /* von 16 */ - if (mode & PARMRK){ /* 18 */ - ttin(tp, (long) 0xff, 1); - ttin(tp, (long) 0, 1); - } - else - ch = 0; - ch |= ICRNL; - } /* von 15 */ - else { - if (mode & ISTRIP) /* 23 */ - ch &= 0x7f; - else - if (((ch & 0xff)== 0xff) && - (mode & PARMRK) && - (putc( 0xff, tp))) /* 24,25,26 */ return; - } - if (mode & IXON){ /* 19 */ - if (tp->t_state & TTSTOP) - if ((ch == CSTART) || - (mode & IXANY)) /* 21,22 */ - (*tp->t_proc)(tp, T_RESUME); - if (ch == CSTART) return; - if (ch == CSTOP) return; - } - if ((ch == '\n')&& - (mode & INLCR)) /* 30,31 */ - c = '\r'; - else { - if (c == 0xd){ /* 32 */ - if (mode & IGNCR) return; - if (mode & ICRNL) - c = '\n'; - } - } - } - if (mode & IUCLC) /* 35 */ - c = toupper(c); -L214: - if (putc(c, tp)){/* 38 */ - sysinfo.rawch++; - cp = &lobyte(c.half.right); - goto L5a; - } -} - - - - -extern char partab[]; -ttxput(tp, arg, count) -register struct tty *tp; -union { - long c; - struct cblock *cb; - struct - { - char l_l; - char l_r; - char r_l; - char r_r; - } - byte; -} -arg; -int count; - -{ - - register ch; - register ushort mode; - register char *cp; - char *colp; - int pch, vch; - struct cblock *cbp; - - mode = tp->t_oflag; - if (tp->t_state & OEXTPROC) - mode &= ~OPOST; - if (!(count)) { - if (tp->t_outq.c_cc >= TTYHOG) return; - count++; - if (!(mode & OPOST)){ - sysinfo.outch++; - putc(arg.r_r, &tp->t_outq); - return; - } - else { - cp = &arg.r_r; - cbp = 0; - } - } - else { - if (!(mode & OPOST)){ - sysinfo.outch += count; - putcb(arg.c, &tp->t_outq); - return; - } - else { - cp = &arg.cb->c_data[arg.cb->c_first]; - cbp = arg.cb; - } - } - while(count--){ - ch = (unsigned char) (*cp++); - if (ch >= DELAYDEL){ /* b7 */ - if (ch == DELAYDEL) - putc(DELAYDEL, &tp->t_outq); - sysinfo.outch++; - putc(ch, &tp->t_outq); - continue; - } - if (tp->t_lflag & XCASE){ - for ( colp = "({)}!|^~'`\\"; (*colp++); ) - if (ch == *colp++){ - tp->t_lflag &= ~XCASE; - ttxput(tp, (long)'\\', 0); - tp->t_lflag |= XCASE; - ch = *(colp - 2); - break; - } - if ((ch >= 'A') && (ch <= 'Z')){ - tp->t_lflag &= ~XCASE; - ttxput(tp, (long)'\\', 0); - tp->t_lflag |= XCASE; - } - } - if (mode & OLCUC) - if ((ch >= 'a') && - (ch <= 'z')) - ch += 'A'-'a'; - vch = ch; - pch = partab[ch]; - colp = &tp->t_col; - ch = 0; - switch (pch & 077){ - case 0: - (*colp)++; - break; - case 2: - if (mode & BS1) - ch = 2; - if (*colp) - (*colp)--; - break; - case 3: - if (!(mode & ONLRET)){ - if (mode & ONLCR){ - if ((!(mode & ONOCR)) || - (*colp)){ - sysinfo.outch++; - putc('\r', &tp->t_outq); - } - } - else - goto nldly; - } - goto crdly; - case 4: - ch = 8 - (*colp & 7); - *colp += ch; - pch = mode & TABDLY; - if (pch == 0){ - ch = 0; - break; - } - if (pch == TAB1){ - if (ch < 5) - ch = 0; - break; - } - if (pch == TAB2){ - ch = 2; - break; - } - if (pch == TAB3){ - sysinfo.outch += ch; - do - putc(' ', &tp->t_outq); - while (--ch); - continue; - } - break; - case 5: - if (mode & VTDLY) - ch = 0x7f; - break; - case 6: - if (mode & OCRNL){ - vch = '\n'; -nldly: - if (mode & NLDLY) - ch = 5; - break; - } - if ((mode & ONOCR) && - (*colp == 0)) - continue; -crdly: - pch = mode & CRDLY; - if (pch == CR1){ - if (*colp) - ch = max((*colp>>4)+3, 6); - } - else - if (pch == CR2) - ch = 5; - else - if (pch == CR3) - ch = 9; - *colp = 0; - case 1: - default: - break; - case 7: - if (mode & FFDLY) - ch = 0x7f; - } - sysinfo.outch++; - putc(vch, &tp->t_outq); - if (ch){ - if ((ch < ' ') && - (mode & OFILL)){ - if (mode & OFDEL) - vch = 0x7f; - else - vch = 0; - putc(vch, &tp->t_outq); - if (ch > 3) - putc(vch, &tp->t_outq); - - } - else { - putc(DELAYDEL, &tp->t_outq); - putc(ch | DELAYDEL, &tp->t_outq); - } - } - /* } - else { - putc(DELAYDEL, &tp->t_outq); - sysinfo.outch++; - putc(ch, &tp->t_outq); - continue; - } */ - } /* von while */ - if (cbp) - putcf(cbp); -} - -ttout(tp) -register struct tty *tp; -{ - return; -} - - -extern timeout(); -tttimeout(tp) -register struct tty *tp; -{ - - tp->t_state &= ~TACT; /* timeout waiting on rawq */ - if (tp->t_lflag & ICANON) return; /* enable canonicalization */ - if (tp->t_cc[VTIME] == 0) return; /* time out */ - if (( tp->t_rawq.c_cc == 0) && (tp->t_cc[VMIN])) return; - if (tp->t_state & RTO){ /* timeout waiting on rawq */ - tp->t_delct = 1; - if (!(tp->t_state & IASLP)) return; /* wakeup when input done */ - tp->t_state &= ~IASLP; - wakeup(tp); - return; - } - tp->t_state |= (RTO | TACT); - timeout(tttimeout, tp, tp->t_cc[VTIME] * 6); -} - -extern putcb(); - -ttioctl(tp, com, arg) -register struct tty *tp; -int com; -long arg; -{ - - ushort ldmode; - - switch(com) { - case LDCHG: - ldmode = tp->t_lflag ^ arg; - if (!(ldmode & ICANON)) - break; - dvi(); - if (tp->t_canq.c_cc){ - if (tp->t_rawq.c_cc){ - tp->t_canq.c_cc += tp->t_rawq.c_cc; - tp->t_canq.c_cl->c_next = tp->t_rawq.c_cf; - tp->t_outq.c_cf = tp->t_rawq.c_cl; - } - tp->t_rawq = tp->t_canq; - tp->t_canq = ttnulq; - } - tp->t_delct = tp->t_rawq.c_cc; - evi(); - break; - default: - break; - } -} +/************************************************************************** +*************************************************************************** + + W E G A - Quelle + KERN 3.2 Modul : tt0.c + + Bearbeiter : O. Lehmann + Datum : 03.05.08 + Version : 1.0 + +*************************************************************************** +**************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Line discipline 0 + */ + +char tt0wstr[] = "@[$]tt0.c Rev : 4.1 09/29/83 01:02:58"; + + +extern putcb(); +extern char partab[]; + +#ifdef 0 +ttin(tp, c, count) +register struct tty *tp; +long c; +int count; +{ + register ushort ch; + register ushort mode; + register char *cp; + char *csp; + char *foo; + + extern tttimeo(); + + mode = tp->t_iflag; + if( count) { + if(count == 1) + goto L214; + putcb(c, tp); + sysinfo.rawch += count; + cp = &c->c_data[c->c_first]; +L5a: + if (tp->t_rawq.c_cc <= TTXOHI) { /* 3 */ +L62: + mode = tp->t_lflag; + if ((tp->t_state & IEXTPROC) || + (mode == 0)){ /* 4,5 */ + if (!(mode & ICANON)){/* 6 */ + tp->t_state &= ~RTO; + if (tp->t_cc[VMIN] <= tp->t_rawq.c_cc) /* 7 */ + tp->t_delct = 1; + else + if ((tp->t_cc[VTIME]) && + ((tp->t_state & TACT) == 0)) /* 72,73 */ + ttimeout(tp); + if ((tp->t_delct) == 0) return; /* 74 */ + } + if (tp->t_state & IASLP) { /* 75 */ + tp->t_state &= ~IASLP; + wakeup(tp); + } + return; + } + if (count--){ /* 67 */ + ch = *cp++; + mode = tp->t_lflag; + if (!(mode & ISIG)){ /* 68 */ +L494: + if (mode & ICANON){ /* 69 */ + if (ch == '\n'){ /* 70 */ + if (mode & ECHONL) + mode |= ECHO; + tp->t_delct++; + } + else + if (ch == tp->t_cc[VEOL]) + tp->t_delct++; + if ((tp->t_state & ESC) == 0){ /* 50 */ + if (ch == '\\') + tp->t_state |= ESC; + if ((ch == tp->t_cc[VERASE]) && + (mode & INPCK)){ /* 52,53 */ + if (mode & ECHO) /* 54 */ + ttxput(tp, (long) CERASE, 0); + mode |= ECHO; + ttxput(tp, (long) ' ', 0); + ch = CERASE; + } /* von 52,53 */ + else if ((ch == tp->t_cc[VKILL]) && + (mode & ISTRIP)){ /* 55,56 */ + if ((mode & ECHO) && + (mode & ISPCI)){ /* 57,58 */ + for ( csp = &"???"; (*csp);) + ttxput(tp, (long) *csp++, 0); + (*tp->t_proc)(tp, T_OUTPUT); + } + ttxput(tp, (long) ch, 0); + mode |= ECHO; + ch = '\n'; + } + else if (ch != tp->t_cc[VEOF]) /* 60 */ + if ((mode & ECHO) && + (mode & ISPCI)){ /* 61,62 */ + for ( csp = &"(eof)"; (*csp);) + ttxput(tp, (long) *csp++, 0); + (*tp->t_proc)(tp, T_OUTPUT); + } + mode &= ~ECHO; + tp->t_delct++; + } + else if ((ch == '\\') || + (mode & XCASE)) /* 64,65 */ + tp->t_state &= ~RTO; + } + if (mode & ECHO) /* 66 */ + ttxput(tp, (long) ch, 0); + (*tp->t_proc)(tp, T_OUTPUT); + } /* von 68 */ + else { + if (ch != tp->t_cc[VINTR]){ /* 43 */ + if (ch == tp->t_cc[VQUIT]) /* 44 */ + goto L494; + if (!(mode & NOFLSH)) + ttyflush(tp, T_RESUME); + if ((mode & ECHO) || + (mode & ISPCI)){ /* 46,47 */ + for ( csp = &"(quit)"; (*csp); csp++) + ttxput(tp,(long) *csp, 0); + (*tp->t_proc)(tp, T_OUTPUT); + } /* von 43 */ + } + else { + if (!(mode & NOFLSH)) + ttyflush(tp, T_RESUME); + if ((mode & ECHO) && + (mode & ISPCI)) /* 40,41 */{ + for ( csp = &"(intr)"; (*csp); csp++) + ttxput(tp, (long) *csp, 0); + (*tp->t_proc)(tp, T_OUTPUT); + } /* von 40,41 */ + } + } /* von 68 else */ + } /* von 67 */ + if (!(mode & ICANON)){ /* 6 */ + if (tp->t_cc[VMIN] <= tp->t_rawq.c_cc) + tp->t_delct = 1; + if ((tp->t_cc[VTIME]) && + ((tp->t_state & TACT) == 0)) + meout(tp); + } /* von 6 */ + if ((tp->t_delct) && + (tp->t_state & IASLP)){ /* 74,75 */ + tp->t_state &= ~IASLP; + wakeup(tp); + } + return; + } /* von 3 */ + else { + if ((mode & IXOFF)&& + (tp->t_state & TBLOCK)) /* 8,9 */ + (*tp->t_proc)(tp, T_BLOCK); + if (tp->t_rawq.c_cc <= TTYHOG) /* 10 */ + goto L62; + else + ttyflush(tp, T_TIME); + return; + } /* 3 von else */ + } /* von 1 */ + else { + count++; + ch = c.half.left; + if ((ch & IXOFF) && + (!(mode & INPCK))) /* 13,14 */ + ch &= ~PERROR; + if (ch & (OVERRUN | FRERROR | PERROR)){ /* 15 */ + if (ch & 0xff){ /* 16 */ + if (mode & IGNPAR) return; + if (mode & IGNBRK) return; + if (mode & BRKINT){ /* 12 */ + signal(tp->t_pgrp, SIGINT); + ttyflush(tp, T_RESUME); + return; + } + } /* von 16 */ + if (mode & PARMRK){ /* 18 */ + ttin(tp, (long) 0xff, 1); + ttin(tp, (long) 0, 1); + } + else + ch = 0; + ch |= ICRNL; + } /* von 15 */ + else { + if (mode & ISTRIP) /* 23 */ + ch &= 0x7f; + else + if (((ch & 0xff)== 0xff) && + (mode & PARMRK) && + (putc( 0xff, tp))) /* 24,25,26 */ return; + } + if (mode & IXON){ /* 19 */ + if (tp->t_state & TTSTOP) + if ((ch == CSTART) || + (mode & IXANY)) /* 21,22 */ + (*tp->t_proc)(tp, T_RESUME); + if (ch == CSTART) return; + if (ch == CSTOP) return; + } + if ((ch == '\n')&& + (mode & INLCR)) /* 30,31 */ + c = '\r'; + else { + if (c == 0xd){ /* 32 */ + if (mode & IGNCR) return; + if (mode & ICRNL) + c = '\n'; + } + } + } + if (mode & IUCLC) /* 35 */ + c = toupper(c); +L214: + if (putc(c, tp)) + return; + sysinfo.rawch++; + cp = &lobyte(c.half.right); + goto L5a; +} +#endif + +/* + * Put character(s) on TTY output queue, adding delays, + * expanding tabs, and handling the CR/NL bit. + * It is called both from the top half for output, and from + * interrupt level for echoing. + */ +ttxput(tp, ucp, ncode) +register struct tty *tp; +union { + long ch; + struct cblock *ptr; + struct + { + char l_l; + char l_r; + char r_l; + char r_r; + } + byte; +} ucp; +int ncode; +{ + register c; + register flg; + register unsigned char *cp; + register char *colp; + int ctype; + register int cs; + struct cblock *scf; + + flg = tp->t_oflag; + if (tp->t_state&OEXTPROC) + flg &= ~OPOST; + if (ncode == 0) { + if (tp->t_outq.c_cc >= TTYHOG) + return; + ncode++; + if (!(flg&OPOST)) { + sysinfo.outch++; + putc(ucp.r_r, &tp->t_outq); + return; + } + cp = (unsigned char *)&ucp.r_r; + scf = NULL; + } else { + if (!(flg&OPOST)) { + sysinfo.outch += ncode; + putcb(ucp.ch, &tp->t_outq); + return; + } + cp = (unsigned char *)&ucp.ptr->c_data[ucp.ptr->c_first]; + scf = ucp.ptr; + } + while (ncode--) { + c = *cp++; + if (c >= DELAYDEL){ + if (c == DELAYDEL) + putc(DELAYDEL, &tp->t_outq); + sysinfo.outch++; + putc(c, &tp->t_outq); + continue; + } + /* + * Generate escapes for upper-case-only terminals. + */ + if (tp->t_lflag&XCASE) { + colp = "({)}!|^~'`\\"; + while(*colp++) + if (c == *colp++) { + tp->t_lflag &= ~XCASE; + ttxput(tp, (long)'\\', 0); + tp->t_lflag |= XCASE; + c = colp[-2]; + break; + } + if ('A' <= c && c <= 'Z'){ + tp->t_lflag &= ~XCASE; + ttxput(tp, (long)'\\', 0); + tp->t_lflag |= XCASE; + } + } + if (flg&OLCUC && 'a' <= c && c <= 'z') + c += 'A' - 'a'; + cs = c; + /* + * Calculate delays. + * The numbers here represent clock ticks + * and are not necessarily optimal for all terminals. + * The delays are indicated by characters above 0200. + */ + ctype = partab[c]; + colp = &tp->t_col; + c = 0; + switch (ctype&077) { + case 0: /* ordinary */ + (*colp)++; + + case 1: /* non-printing */ + break; + + case 2: /* backspace */ + if (flg&BSDLY) + c = 2; + if (*colp) + (*colp)--; + break; + case 3: /* line feed */ + if (flg&ONLRET) + goto cr; + if (flg&ONLCR) { + if (!(flg&ONOCR && *colp==0)) { + sysinfo.outch++; + putc('\r', &tp->t_outq); + } + goto cr; + } + nl: + if (flg&NLDLY) + c = 5; + break; + case 4: /* tab */ + c = 8 - ((*colp)&07); + *colp += c; + ctype = flg&TABDLY; + if (ctype == TAB0) { + c = 0; + } else if (ctype == TAB1) { + if (c < 5) + c = 0; + } else if (ctype == TAB2) { + c = 2; + } else if (ctype == TAB3) { + sysinfo.outch += c; + do + putc(' ', &tp->t_outq); + while (--c); + continue; + } + break; + + case 5: /* vertical tab */ + if (flg&VTDLY) + c = 0177; + break; + + case 6: /* carriage return */ + if (flg&OCRNL) { + cs = '\n'; + goto nl; + } + if (flg&ONOCR && *colp == 0) + continue; + cr: + ctype = flg&CRDLY; + if (ctype == CR1) { + if (*colp) + c = max((*colp>>4) + 3, 6); + } else if (ctype == CR2) { + c = 5; + } else if (ctype == CR3) { + c = 9; + } + *colp = 0; + break; + case 7: /* form feed */ + if (flg&FFDLY) + c = 0177; + break; + } + sysinfo.outch++; + putc(cs, &tp->t_outq); + if (c) { + if ((c < 32) && flg&OFILL) { + if (flg&OFDEL) + cs = 0177; + else + cs = 0; + putc(cs, &tp->t_outq); + if (c > 3) + putc(cs, &tp->t_outq); + } else { + putc(DELAYDEL, &tp->t_outq); + putc(c|DELAYDEL, &tp->t_outq); + } + } + } + if (scf != NULL) + putcf(scf); +} + + +/* + * Get next function from output queue. + * Called from xmit interrupt complete. + */ +ttout(tp) +register struct tty *tp; +{ + return; +} + +extern timeout(); +tttimeo(tp) +register struct tty *tp; +{ + + tp->t_state &= ~TACT; /* timeout waiting on rawq */ + if (tp->t_lflag&ICANON) + return; /* enable canonicalization */ + if (tp->t_cc[VTIME] == 0) + return; /* time out */ + if (( tp->t_rawq.c_cc == 0) && (tp->t_cc[VMIN])) + return; + if (tp->t_state&RTO) { /* timeout waiting on rawq */ + tp->t_delct = 1; + if (tp->t_state&IASLP) {/* wakeup when input done */ + tp->t_state &= ~IASLP; + wakeup(tp); + } + } else { + tp->t_state |= RTO|TACT; + timeout(tttimeo, tp, tp->t_cc[VTIME]*(HZ/10)); + } +} + +ttioctl(tp, cmd, arg) +register struct tty *tp; +int cmd; +long arg; +{ + ushort chg; + + switch(cmd) { + case LDCHG: + chg = tp->t_lflag^arg; + if (!(chg&ICANON)) + break; + dvi(); + if (tp->t_canq.c_cc) { + if (tp->t_rawq.c_cc) { + tp->t_canq.c_cc += tp->t_rawq.c_cc; + tp->t_canq.c_cl->c_next = tp->t_rawq.c_cf; + tp->t_canq.c_cl = tp->t_rawq.c_cl; + } + tp->t_rawq = tp->t_canq; + tp->t_canq = ttnulq; + } + tp->t_delct = tp->t_rawq.c_cc; + evi(); + break; + + default: + break; + } +}