about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/exec.c24
2 files changed, 18 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c88a4196..8d947b045 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2006-09-15  Peter Stephenson  <pws@csr.com>
 
+	* 22715: Src/exec.c: AUTOCONTINUE option never worked.
+
 	* 22713: Src/Zle/zle_tricky.c: word end in math completion context
 	was screwy.
 
diff --git a/Src/exec.c b/Src/exec.c
index 6b178142c..57c0822fb 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1838,7 +1838,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
     int nullexec = 0, assign = 0, forked = 0;
     int is_shfunc = 0, is_builtin = 0, is_exec = 0, use_defpath = 0;
     /* Various flags to the command. */
-    int cflags = 0, checked = 0, oautocont = opts[AUTOCONTINUE];
+    int cflags = 0, checked = 0, oautocont = -1;
     LinkList redir;
     wordcode code;
     Wordcode beg = state->pc, varspc;
@@ -1873,8 +1873,10 @@ execcmd(Estate state, int input, int output, int how, int last1)
      * reference to a job in the job table.                */
     if (type == WC_SIMPLE && args && nonempty(args) &&
 	*(char *)peekfirst(args) == '%') {
-        if (how & Z_DISOWN)
+        if (how & Z_DISOWN) {
+	    oautocont = opts[AUTOCONTINUE];
             opts[AUTOCONTINUE] = 1;
+	}
 	pushnode(args, dupstring((how & Z_DISOWN)
 				 ? "disown" : (how & Z_ASYNC) ? "bg" : "fg"));
 	how = Z_SYNC;
@@ -2060,7 +2062,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		if (cflags & BINF_BUILTIN) {
 		    zwarn("no such builtin: %s", cmdarg);
 		    lastval = 1;
-                    opts[AUTOCONTINUE] = oautocont;
+		    if (oautocont >= 0)
+			opts[AUTOCONTINUE] = oautocont;
 		    return;
 		}
 		break;
@@ -2084,7 +2087,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     if (errflag) {
 	lastval = 1;
-        opts[AUTOCONTINUE] = oautocont;
+	if (oautocont >= 0)
+	    opts[AUTOCONTINUE] = oautocont;
 	return;
     }
 
@@ -2128,7 +2132,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     if (errflag) {
 	lastval = 1;
-        opts[AUTOCONTINUE] = oautocont;
+	if (oautocont >= 0)
+	    opts[AUTOCONTINUE] = oautocont;
 	return;
     }
 
@@ -2212,7 +2217,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	if ((pid = zfork(&bgtime)) == -1) {
 	    close(synch[0]);
 	    close(synch[1]);
-            opts[AUTOCONTINUE] = oautocont;
+	    if (oautocont >= 0)
+		opts[AUTOCONTINUE] = oautocont;
 	    return;
 	} if (pid) {
 	    close(synch[1]);
@@ -2238,7 +2244,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		}
 	    }
 	    addproc(pid, text, 0, &bgtime);
-            opts[AUTOCONTINUE] = oautocont;
+	    if (oautocont >= 0)
+		opts[AUTOCONTINUE] = oautocont;
 	    return;
 	}
 	/* pid == 0 */
@@ -2676,7 +2683,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     zsfree(STTYval);
     STTYval = 0;
-    opts[AUTOCONTINUE] = oautocont;
+    if (oautocont >= 0)
+	opts[AUTOCONTINUE] = oautocont;
 }
 
 /* Arrange to have variables restored. */