about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-11-30 23:26:17 +0100
committerOliver Kiddle <opk@zsh.org>2014-11-30 23:29:25 +0100
commit40c5e00de09066916ef42067ae21e58a5268c647 (patch)
tree65612e3d187e8e191e5d679247097c07d5202e23
parent0d4b548d1e4a08105597791fd6308d7fd70d3ddf (diff)
downloadzsh-40c5e00de09066916ef42067ae21e58a5268c647.tar.gz
zsh-40c5e00de09066916ef42067ae21e58a5268c647.tar.xz
zsh-40c5e00de09066916ef42067ae21e58a5268c647.zip
33800: remove old workaround for ancient systems to
consume typeahead before setting up the terminal
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_main.c43
2 files changed, 5 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index fed76e508..8d639b52e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-11-30  Oliver Kiddle  <opk@zsh.org>
 
+	* 33800: Src/Zle/zle_main.c: remove old workaround for ancient
+	systems to consume typeahead before setting up the terminal
+
 	* 33818: Src/Builtins/sched.c, Src/Zle/complist.c,
 	Src/exec.c, Src/sort.c, Src/utils.c: fix types passed to sizeof
 	detected by coverity as being wrong
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index a38f55bfe..caa052b13 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -187,10 +187,6 @@ mod_export char *zlenoargs[1] = { NULL };
 
 static char **raw_lp, **raw_rp;
 
-#ifdef FIONREAD
-static int delayzsetterm;
-#endif
-
 /*
  * File descriptors we are watching as well as the terminal fd. 
  * These are all for reading; we don't watch for writes or exceptions.
@@ -210,9 +206,6 @@ mod_export void
 zsetterm(void)
 {
     struct ttyinfo ti;
-#if defined(FIONREAD)
-    int val;
-#endif
 
     if (fetchttyinfo) {
 	/*
@@ -224,30 +217,6 @@ zsetterm(void)
 	fetchttyinfo = 0;
     }
 
-#if defined(FIONREAD)
-    ioctl(SHTTY, FIONREAD, (char *)&val);
-    if (val) {
-	/*
-	 * Problems can occur on some systems when switching from
-	 * canonical to non-canonical input.  The former is usually
-	 * set while running programmes, but the latter is necessary
-	 * for zle.  If there is input in canonical mode, then we
-	 * need to read it without setting up the terminal.  Furthermore,
-	 * while that input gets processed there may be more input
-	 * being typed (i.e. further typeahead).  This means that
-	 * we can't set up the terminal for zle *at all* until
-	 * we are sure there is no more typeahead to come.  So
-	 * if there is typeahead, we set the flag delayzsetterm.
-	 * Then getbyte() calls here to performs another FIONREAD call;
-	 * if that is 0, we have finally used up all the typeahead, and
-	 * it is safe to alter the terminal, which we do at that point.
-	 */
-	delayzsetterm = 1;
-	return;
-    } else
-	delayzsetterm = 0;
-#endif
-
 /* sanitize the tty */
 #ifdef HAS_TIO
     shttyinfo.tio.c_lflag |= ICANON | ECHO;
@@ -343,7 +312,7 @@ zsetterm(void)
 	ti.ltchars.t_dsuspc = ti.ltchars.t_lnextc = -1;
 #endif
 
-#if defined(TTY_NEEDS_DRAINING) && defined(TIOCOUTQ) && defined(HAVE_SELECT)
+#if defined(TIOCOUTQ) && defined(HAVE_SELECT)
     if (baud) {			/**/
 	int n = 0;
 
@@ -541,11 +510,7 @@ raw_getbyte(long do_keytmout, char *cptr)
      * timeouts may be external, so we may have both a permanent watched
      * fd and a long-term timeout.
      */
-    if ((nwatch || tmout.tp != ZTM_NONE)
-#ifdef FIONREAD
-	&& ! delayzsetterm
-#endif
-	) {
+    if ((nwatch || tmout.tp != ZTM_NONE)) {
 #if defined(HAVE_SELECT) || defined(HAVE_POLL)
 	int i, errtry = 0, selret;
 # ifdef HAVE_POLL
@@ -883,10 +848,6 @@ getbyte(long do_keytmout, int *timeout)
     if (kungetct)
 	ret = STOUC(kungetbuf[--kungetct]);
     else {
-#ifdef FIONREAD
-	if (delayzsetterm)
-	    zsetterm();
-#endif
 	for (;;) {
 	    int q = queue_signal_level();
 	    dont_queue_signals();