sync to 99.9% of the WEGA kernel

This commit is contained in:
Oliver Lehmann 2008-05-07 04:51:51 +00:00
parent 338d90258f
commit 4c0135e7e2
1 changed files with 96 additions and 100 deletions

View File

@ -11,6 +11,12 @@
*************************************************************************** ***************************************************************************
**************************************************************************/ **************************************************************************/
/*
* Line discipline 0
*/
char tt0wstr[] = "@[$]tt0.c Rev : 4.1 09/29/83 01:02:58";
#include <sys/param.h> #include <sys/param.h>
#include <sys/state.h> #include <sys/state.h>
#include <sys/conf.h> #include <sys/conf.h>
@ -27,14 +33,6 @@
#include <sys/s.out.h> #include <sys/s.out.h>
#include <sys/user.h> #include <sys/user.h>
/*
* Line discipline 0
*/
char tt0wstr[] = "@[$]tt0.c Rev : 4.1 09/29/83 01:02:58";
extern putcb();
extern char partab[]; extern char partab[];
/* /*
@ -62,7 +60,6 @@ int ncode;
register flg; register flg;
register unsigned char *cp; register unsigned char *cp;
char *csp; char *csp;
extern tttimeo();
flg = tp->t_iflag; flg = tp->t_iflag;
switch (ncode) { switch (ncode) {
@ -71,7 +68,7 @@ int ncode;
c = ucp.ch; c = ucp.ch;
if (c&PERROR && !(flg&INPCK)) if (c&PERROR && !(flg&INPCK))
c &= ~PERROR; c &= ~PERROR;
if (c&(FRERROR|PERROR|OVERRUN)) { if (c&(FRERROR|PERROR|OVERRUN)) {
if ((c&0377) == 0) { if ((c&0377) == 0) {
if (flg&IGNBRK) if (flg&IGNBRK)
return; return;
@ -83,21 +80,21 @@ int ncode;
} else { } else {
if (flg&IGNPAR) if (flg&IGNPAR)
return; return;
} }
if (flg&PARMRK) { if (flg&PARMRK) {
ttin(tp, (long) 0377, 1); ttin(tp, (long) 0377, 1);
ttin(tp, (long) 0, 1); ttin(tp, (long) 0, 1);
} else } else
c = 0; c = 0;
c |= 0400; c |= 0400;
} else { } else {
if (flg&ISTRIP) if (flg&ISTRIP)
c &= 0177; c &= 0177;
else { else {
c &= 0377; c &= 0377;
if (c == 0377 && flg&PARMRK) if (c == 0377 && flg&PARMRK)
if (putc(0377, &tp->t_rawq)) if (putc(0377, &tp->t_rawq))
return; return;
} }
} }
if (flg&IXON) { if (flg&IXON) {
@ -144,81 +141,81 @@ int ncode;
flg = tp->t_lflag; flg = tp->t_lflag;
if (!(tp->t_state&IEXTPROC) && tp->t_lflag) if (!(tp->t_state&IEXTPROC) && tp->t_lflag) {
while (ncode--) { while (ncode--) {
c = *cp++; c = *cp++;
flg = tp->t_lflag; flg = tp->t_lflag;
if (flg&ISIG) {
if (flg&ISIG) { if (c == tp->t_cc[VINTR]) {
if (c == tp->t_cc[VINTR]) { signal(tp->t_pgrp, SIGINT);
signal(tp->t_pgrp, SIGINT); if (!(flg&NOFLSH))
if (!(flg&NOFLSH)) ttyflush(tp, (FREAD|FWRITE));
ttyflush(tp, (FREAD|FWRITE)); if ((flg&ECHO) &&
if ((flg&ECHO) && (flg&ISPCI)) {
(flg&ISPCI)) { for ( csp = "(intr)"; (*csp); )
for ( csp = "(intr)"; (*csp); ) ttxput(tp, (long) *csp++, 0);
ttxput(tp, (long) *csp++, 0); (*tp->t_proc)(tp, T_OUTPUT);
(*tp->t_proc)(tp, T_OUTPUT); }
continue;
}
if (c == tp->t_cc[VQUIT]) {
signal(tp->t_pgrp, SIGQUIT);
if (!(flg&NOFLSH))
ttyflush(tp, (FREAD|FWRITE));
if ((flg&ECHO) &&
(flg&ISPCI)) {
for ( csp = "(quit)\n"; (*csp); )
ttxput(tp,(long) *csp++, 0);
(*tp->t_proc)(tp, T_OUTPUT);
}
continue;
} }
continue;
}
if (c == tp->t_cc[VQUIT]) {
signal(tp->t_pgrp, SIGQUIT);
if (!(flg&NOFLSH))
ttyflush(tp, (FREAD|FWRITE));
if ((flg&ECHO) &&
(flg&ISPCI)) {
for ( csp = "(quit)\n"; (*csp); )
ttxput(tp,(long) *csp++, 0);
(*tp->t_proc)(tp, T_OUTPUT);
}
continue;
} }
} if (flg&ICANON) {
if (flg&ICANON) { if (c == '\n') {
if (c == '\n') { if (flg&ECHONL)
if (flg&ECHONL) flg |= ECHO;
flg |= ECHO;
tp->t_delct++;
} else if (c == tp->t_cc[VEOL])
tp->t_delct++;
if (!(tp->t_state&ESC)) {
if (c == '\\')
tp->t_state |= ESC;
if (c == tp->t_cc[VERASE] && flg&ECHOE) {
if (flg&ECHO)
ttxput(tp, (long) '\b', 0);
flg |= ECHO;
ttxput(tp, (long) ' ', 0);
c = '\b';
} else if (c == tp->t_cc[VKILL] && flg&ECHOK) {
if ((flg & ECHO) &&
(flg & ISPCI)) {
for ( csp = "XXX"; (*csp);)
ttxput(tp, (long) *csp++, 0);
(*tp->t_proc)(tp, T_OUTPUT);
}
ttxput(tp, (long) c, 0);
flg |= ECHO;
c = '\n';
} else if (c == tp->t_cc[VEOF]) {
if ((flg & ECHO) &&
(flg & ISPCI)) {
for ( csp = "(eof)\n"; (*csp);)
ttxput(tp, (long) *csp++, 0);
(*tp->t_proc)(tp, T_OUTPUT);
}
flg &= ~ECHO;
tp->t_delct++; tp->t_delct++;
} else if (c == tp->t_cc[VEOL])
tp->t_delct++;
if (!(tp->t_state&ESC)) {
if (c == '\\')
tp->t_state |= ESC;
if (c == tp->t_cc[VERASE] && flg&ECHOE) {
if (flg&ECHO)
ttxput(tp, (long) '\b', 0);
flg |= ECHO;
ttxput(tp, (long) ' ', 0);
c = '\b';
} else if (c == tp->t_cc[VKILL] && flg&ECHOK) {
if ((flg & ECHO) &&
(flg & ISPCI)) {
for ( csp = "XXX"; (*csp);)
ttxput(tp, (long) *csp++, 0);
(*tp->t_proc)(tp, T_OUTPUT);
}
ttxput(tp, (long) c, 0);
flg |= ECHO;
c = '\n';
} else if (c == tp->t_cc[VEOF]) {
if ((flg & ECHO) &&
(flg & ISPCI)) {
for ( csp = "(eof)\n"; (*csp);)
ttxput(tp, (long) *csp++, 0);
(*tp->t_proc)(tp, T_OUTPUT);
}
flg &= ~ECHO;
tp->t_delct++;
}
} else {
if (c != '\\' || (flg&XCASE))
tp->t_state &= ~ESC;
} }
} else {
if (c != '\\' || (flg&XCASE))
tp->t_state &= ~ESC;
} }
} if (flg&ECHO) {
if (flg&ECHO) { ttxput(tp, (long) c, 0);
ttxput(tp, (long) c, 0); (*tp->t_proc)(tp, T_OUTPUT);
(*tp->t_proc)(tp, T_OUTPUT); }
} }
} }
if (!(flg&ICANON)) { if (!(flg&ICANON)) {
@ -258,13 +255,12 @@ union {
} ucp; } ucp;
int ncode; int ncode;
{ {
register c; register c;
register flg; register flg;
register unsigned char *cp; register unsigned char *cp;
register char *colp; register char *colp;
int ctype; int ctype;
register int cs; int cs;
struct cblock *scf; struct cblock *scf;
flg = tp->t_oflag; flg = tp->t_oflag;
@ -290,7 +286,6 @@ int ncode;
cp = (unsigned char *)&ucp.ptr->c_data[ucp.ptr->c_first]; cp = (unsigned char *)&ucp.ptr->c_data[ucp.ptr->c_first];
scf = ucp.ptr; scf = ucp.ptr;
} }
while (ncode--) { while (ncode--) {
c = *cp++; c = *cp++;
if (c >= DELAYDEL){ if (c >= DELAYDEL){
@ -299,7 +294,7 @@ int ncode;
sysinfo.outch++; sysinfo.outch++;
putc(c, &tp->t_outq); putc(c, &tp->t_outq);
continue; continue;
} }
/* /*
* Generate escapes for upper-case-only terminals. * Generate escapes for upper-case-only terminals.
*/ */
@ -332,19 +327,21 @@ int ncode;
colp = &tp->t_col; colp = &tp->t_col;
c = 0; c = 0;
switch (ctype&077) { switch (ctype&077) {
case 0: /* ordinary */
case 0: /* ordinary */
(*colp)++; (*colp)++;
case 1: /* non-printing */ case 1: /* non-printing */
break; break;
case 2: /* backspace */ case 2: /* backspace */
if (flg&BSDLY) if (flg&BSDLY)
c = 2; c = 2;
if (*colp) if (*colp)
(*colp)--; (*colp)--;
break; break;
case 3: /* line feed */
case 3: /* line feed */
if (flg&ONLRET) if (flg&ONLRET)
goto cr; goto cr;
if (flg&ONLCR) { if (flg&ONLCR) {
@ -361,6 +358,7 @@ int ncode;
if (flg&NLDLY) if (flg&NLDLY)
c = 5; c = 5;
break; break;
case 4: /* tab */ case 4: /* tab */
c = 8 - ((*colp)&07); c = 8 - ((*colp)&07);
*colp += c; *colp += c;
@ -381,19 +379,19 @@ int ncode;
} }
break; break;
case 5: /* vertical tab */ case 5: /* vertical tab */
if (flg&VTDLY) if (flg&VTDLY)
c = 0177; c = 0177;
break; break;
case 6: /* carriage return */ case 6: /* carriage return */
if (flg&OCRNL) { if (flg&OCRNL) {
cs = '\n'; cs = '\n';
goto nl; goto nl;
} }
if (flg&ONOCR && *colp == 0) if (flg&ONOCR && *colp == 0)
continue; continue;
cr: cr:
ctype = flg&CRDLY; ctype = flg&CRDLY;
if (ctype == CR1) { if (ctype == CR1) {
if (*colp) if (*colp)
@ -405,7 +403,8 @@ int ncode;
} }
*colp = 0; *colp = 0;
break; break;
case 7: /* form feed */
case 7: /* form feed */
if (flg&FFDLY) if (flg&FFDLY)
c = 0177; c = 0177;
break; break;
@ -431,7 +430,6 @@ int ncode;
putcf(scf); putcf(scf);
} }
/* /*
* Get next function from output queue. * Get next function from output queue.
* Called from xmit interrupt complete. * Called from xmit interrupt complete.
@ -442,11 +440,9 @@ register struct tty *tp;
return; return;
} }
extern timeout();
tttimeo(tp) tttimeo(tp)
register struct tty *tp; register struct tty *tp;
{ {
tp->t_state &= ~TACT; /* timeout waiting on rawq */ tp->t_state &= ~TACT; /* timeout waiting on rawq */
if (tp->t_lflag&ICANON) if (tp->t_lflag&ICANON)
return; /* enable canonicalization */ return; /* enable canonicalization */
@ -471,7 +467,7 @@ register struct tty *tp;
int cmd; int cmd;
long arg; long arg;
{ {
ushort chg; ushort chg;
switch(cmd) { switch(cmd) {
case LDCHG: case LDCHG: