about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-09-13 13:04:39 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-09-13 13:04:39 +0000
commit1268f477b0d88ff10b7de4dea33b53b29cbed287 (patch)
tree06826b9b7a7a59a4e179ae634c949e018ad1bec1
parentb12c16850521328a396bb62c3b07558f9308c621 (diff)
downloadzsh-1268f477b0d88ff10b7de4dea33b53b29cbed287.tar.gz
zsh-1268f477b0d88ff10b7de4dea33b53b29cbed287.tar.xz
zsh-1268f477b0d88ff10b7de4dea33b53b29cbed287.zip
20363: Src/init.c, Src/Zle/zle_main.c
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_main.c18
-rw-r--r--Src/init.c2
3 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d65cbe194..94ce16d70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-13  Peter Stephenson  <pws@csr.com>
+
+	* 20363: Src/init.c, Src/Zle/zle_main.c: exiting after 10 EOFs
+	with ignore_eof set was broken in zle.
+
 2004-09-10  Peter Stephenson  <pws@csr.com>
 
 	* 20348: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: Rejig WIDGETSTYLE
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 5299c755b..80c0db6ed 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -688,17 +688,27 @@ zlecore(void)
 	selectlocalmap(NULL);
 	bindk = getkeycmd();
 	if (bindk) {
-	    if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) &&
-		lastchar == eofchar) {
+	    if (!ll && isfirstln && lastchar == eofchar) {
 		/*
 		 * Slight hack: this relies on getkeycmd returning
 		 * a value for the EOF character.  However,
 		 * undefined-key is fine.  That's necessary because
 		 * otherwise we can't distinguish this case from
 		 * a ^C.
+		 *
+		 * The noxitct test is done in the top-level loop
+		 * if zle is not running.  As we trap EOFs at this
+		 * level inside zle we need to mimic it here.
+		 * If we break, the top-level loop will actually increment
+		 * noexitct an extra time; that doesn't cause any
+		 * problems.
 		 */
-		eofsent = 1;
-		break;
+		if (!(zlereadflags & ZLRF_IGNOREEOF) ||
+		    ++noexitct >= 10)
+		{
+		    eofsent = 1;
+		    break;
+		}
 	    }
 	    if (execzlefunc(bindk, zlenoargs))
 		handlefeep(zlenoargs);
diff --git a/Src/init.c b/Src/init.c
index ef101069c..d562349d5 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -37,7 +37,7 @@
 #include "version.h"
 
 /**/
-int noexitct = 0;
+mod_export int noexitct = 0;
 
 /* buffer for $_ and its length */