diff options
author | bde <bde@FreeBSD.org> | 1996-11-29 15:06:17 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-11-29 15:06:17 +0000 |
commit | 3d3ae943381a0da8785149061fb7bcd686838703 (patch) | |
tree | 742f2e2eff8c8f1d7b5cd54926194bbcdbd84854 | |
parent | cad2dd24ed50a22558c59866ee63d83380d2f5ce (diff) | |
download | FreeBSD-src-3d3ae943381a0da8785149061fb7bcd686838703.zip FreeBSD-src-3d3ae943381a0da8785149061fb7bcd686838703.tar.gz |
Fixed handling of non-POSIX control characters. They must not do
anything special unless IEXTEN is set.
Found by: NIST-PCTS
-rw-r--r-- | sys/kern/tty.c | 20 | ||||
-rw-r--r-- | sys/sys/termios.h | 12 |
2 files changed, 17 insertions, 15 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index bdae27a..fab7c83 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.83 1996/08/28 18:45:09 bde Exp $ + * $Id: tty.c,v 1.84 1996/08/31 16:52:26 bde Exp $ */ /*- @@ -273,9 +273,10 @@ ttyclose(tp) } /* Is 'c' a line delimiter ("break" character)? */ -#define TTBREAKC(c) \ +#define TTBREAKC(c, lflag) \ ((c) == '\n' || (((c) == cc[VEOF] || \ - (c) == cc[VEOL] || (c) == cc[VEOL2]) && (c) != _POSIX_VDISABLE)) + (c) == cc[VEOL] || ((c) == cc[VEOL2] && lflag & IEXTEN)) && \ + (c) != _POSIX_VDISABLE)) /* * Process input of a single character received on a tty. @@ -491,7 +492,7 @@ parmrk: /* * word erase (^W) */ - if (CCEQ(cc[VWERASE], c)) { + if (CCEQ(cc[VWERASE], c) && ISSET(lflag, IEXTEN)) { int ctype; /* @@ -530,14 +531,14 @@ parmrk: /* * reprint line (^R) */ - if (CCEQ(cc[VREPRINT], c)) { + if (CCEQ(cc[VREPRINT], c) && ISSET(lflag, IEXTEN)) { ttyretype(tp); goto endcase; } /* * ^T - kernel info and generate SIGINFO */ - if (CCEQ(cc[VSTATUS], c)) { + if (CCEQ(cc[VSTATUS], c) && ISSET(lflag, IEXTEN)) { if (ISSET(lflag, ISIG)) pgsignal(tp->t_pgrp, SIGINFO, 1); if (!ISSET(lflag, NOKERNINFO)) @@ -571,7 +572,7 @@ input_overflow: ttyecho(c, tp); goto endcase; } - if (TTBREAKC(c)) { + if (TTBREAKC(c, lflag)) { tp->t_rocount = 0; catq(&tp->t_rawq, &tp->t_canq); ttwakeup(tp); @@ -1627,7 +1628,8 @@ slowcase: /* * delayed suspend (^Y) */ - if (CCEQ(cc[VDSUSP], c) && ISSET(lflag, ISIG)) { + if (CCEQ(cc[VDSUSP], c) && + ISSET(lflag, IEXTEN | ISIG) == (IEXTEN | ISIG)) { pgsignal(tp->t_pgrp, SIGTSTP, 1); if (first) { error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, @@ -1665,7 +1667,7 @@ slowcase: * In canonical mode check for a "break character" * marking the end of a "line of input". */ - if (ISSET(lflag, ICANON) && TTBREAKC(c)) + if (ISSET(lflag, ICANON) && TTBREAKC(c, lflag)) break; first = 0; } diff --git a/sys/sys/termios.h b/sys/sys/termios.h index 14b2648..d983449 100644 --- a/sys/sys/termios.h +++ b/sys/sys/termios.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)termios.h 8.3 (Berkeley) 3/28/94 - * $Id: termios.h,v 1.5 1995/05/11 07:52:47 bde Exp $ + * $Id: termios.h,v 1.6 1995/05/30 08:14:40 rgrimes Exp $ */ #ifndef _SYS_TERMIOS_H_ @@ -47,22 +47,22 @@ #define VEOF 0 /* ICANON */ #define VEOL 1 /* ICANON */ #ifndef _POSIX_SOURCE -#define VEOL2 2 /* ICANON */ +#define VEOL2 2 /* ICANON together with IEXTEN */ #endif #define VERASE 3 /* ICANON */ #ifndef _POSIX_SOURCE -#define VWERASE 4 /* ICANON */ +#define VWERASE 4 /* ICANON together with IEXTEN */ #endif #define VKILL 5 /* ICANON */ #ifndef _POSIX_SOURCE -#define VREPRINT 6 /* ICANON */ +#define VREPRINT 6 /* ICANON together with IEXTEN */ #endif /* 7 spare 1 */ #define VINTR 8 /* ISIG */ #define VQUIT 9 /* ISIG */ #define VSUSP 10 /* ISIG */ #ifndef _POSIX_SOURCE -#define VDSUSP 11 /* ISIG */ +#define VDSUSP 11 /* ISIG together with IEXTEN */ #endif #define VSTART 12 /* IXON, IXOFF */ #define VSTOP 13 /* IXON, IXOFF */ @@ -73,7 +73,7 @@ #define VMIN 16 /* !ICANON */ #define VTIME 17 /* !ICANON */ #ifndef _POSIX_SOURCE -#define VSTATUS 18 /* ICANON */ +#define VSTATUS 18 /* ICANON together with IEXTEN */ /* 19 spare 2 */ #endif #define NCCS 20 |