summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-03-28 15:25:13 +0000
committerache <ache@FreeBSD.org>1995-03-28 15:25:13 +0000
commit8974e853cd221385cdca3d2e3802f2cd27b6a5d9 (patch)
tree3f309267ce4816d5590742e555375f84e605ad00 /sys/kern/tty.c
parentd8eb7d083387d8c95af5dff4cbacff0de7e2514a (diff)
downloadFreeBSD-src-8974e853cd221385cdca3d2e3802f2cd27b6a5d9.zip
FreeBSD-src-8974e853cd221385cdca3d2e3802f2cd27b6a5d9.tar.gz
ttyinput() fixes:
1) Preserve old buffer contents when input buffer overflows. Old code clear buffer and rewrite it again, if !MAXBEL (for MAXBEL it does right thing :-). F.e. if you type too long string, last chars passed, not first ones as expected. Moreover, it flush output queue too in this case without any needs. 2) Don't do IXOFF, if IGNCR and c==\r, ignore completely. 3) If PARMRK is active and !ISTRIP and char == 0377 put yet one 0377 to distinguish it from parity mark sequence. POSIX standard (thanx Bruce). Reviewed by: Submitted by: Obtained from: CVS:
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ff2b8a0..28e79ae 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.36 1995/03/16 18:12:45 bde Exp $
+ * $Id: tty.c,v 1.37 1995/03/28 11:09:35 ache Exp $
*/
#include "snp.h"
@@ -311,6 +311,11 @@ parmrk: (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
ttyblock(tp);
if (!ISSET(tp->t_state, TS_TYPEN) && ISSET(iflag, ISTRIP))
CLR(c, 0x80);
+
+ if ( c == 0377 && ISSET(iflag, PARMRK) && !ISSET(iflag, ISTRIP)
+ && ISSET(iflag, IGNBRK|IGNPAR) != (IGNBRK|IGNPAR))
+ (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
+
if (!ISSET(lflag, EXTPROC)) {
/*
* Check for literal nexting very first
@@ -406,7 +411,7 @@ parmrk: (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
*/
if (c == '\r') {
if (ISSET(iflag, IGNCR))
- goto endcase;
+ return (0);
else if (ISSET(iflag, ICRNL))
c = '\n';
} else if (c == '\n' && ISSET(iflag, INLCR))
@@ -510,8 +515,7 @@ parmrk: (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
if (ISSET(iflag, IMAXBEL)) {
if (tp->t_outq.c_cc < tp->t_hiwat)
(void)ttyoutput(CTRL('g'), tp);
- } else
- ttyflush(tp, FREAD | FWRITE);
+ }
goto endcase;
}
/*
OpenPOWER on IntegriCloud