* setopt autocontinue doesn't work
@ 2006-09-14 23:12 arno.
2006-09-15 16:11 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: arno. @ 2006-09-14 23:12 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 738 bytes --]
Hi,
setopt autocontinue doesn't work
% setopt autocontinue
% [[ -o autocontinue ]]
% print $?
1
That's because in function execcmd in file Src/exec.c, AUTOCONTINUE
value is saved :
oautocont = opts[AUTOCONTINUE]; (l 1841)
command is executed, and autocontinue is then restored :
opts[AUTOCONTINUE] = oautocont; (l 2679)
It happens to for every command, even when command is : setopt
autocontinue
so, assignement works well, at line, 2678, AUTOCONTINUE is set
(isset(AUTOCONTINUE) returns true), but that results is erased.
What is the point of saving and restoring autocontinue in that function?
Is there a way not to restore autocontinue if command was setopt
autocontinue ?
hope that helps
arno
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: setopt autocontinue doesn't work
2006-09-14 23:12 setopt autocontinue doesn't work arno.
@ 2006-09-15 16:11 ` Peter Stephenson
2006-09-15 18:55 ` Clint Adams
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2006-09-15 16:11 UTC (permalink / raw)
To: Zsh hackers list
> setopt autocontinue doesn't work
Weird... this has apparently been the case since the option was
introduced in 2001 and no one has noticed.
Without rewriting the code entirely, the following is the simplest fix.
Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.102
diff -u -r1.102 exec.c
--- Src/exec.c 16 Jun 2006 10:44:04 -0000 1.102
+++ Src/exec.c 15 Sep 2006 16:09:05 -0000
@@ -1838,7 +1838,7 @@
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 @@
* 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 @@
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 @@
if (errflag) {
lastval = 1;
- opts[AUTOCONTINUE] = oautocont;
+ if (oautocont >= 0)
+ opts[AUTOCONTINUE] = oautocont;
return;
}
@@ -2128,7 +2132,8 @@
if (errflag) {
lastval = 1;
- opts[AUTOCONTINUE] = oautocont;
+ if (oautocont >= 0)
+ opts[AUTOCONTINUE] = oautocont;
return;
}
@@ -2212,7 +2217,8 @@
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 @@
}
}
addproc(pid, text, 0, &bgtime);
- opts[AUTOCONTINUE] = oautocont;
+ if (oautocont >= 0)
+ opts[AUTOCONTINUE] = oautocont;
return;
}
/* pid == 0 */
@@ -2676,7 +2683,8 @@
zsfree(STTYval);
STTYval = 0;
- opts[AUTOCONTINUE] = oautocont;
+ if (oautocont >= 0)
+ opts[AUTOCONTINUE] = oautocont;
}
/* Arrange to have variables restored. */
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: setopt autocontinue doesn't work
2006-09-15 16:11 ` Peter Stephenson
@ 2006-09-15 18:55 ` Clint Adams
0 siblings, 0 replies; 3+ messages in thread
From: Clint Adams @ 2006-09-15 18:55 UTC (permalink / raw)
To: zsh-workers
> Weird... this has apparently been the case since the option was
> introduced in 2001 and no one has noticed.
Well, that's not entirely accurate;
http://www.zsh.org/mla/workers/2004/msg01029.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-15 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-14 23:12 setopt autocontinue doesn't work arno.
2006-09-15 16:11 ` Peter Stephenson
2006-09-15 18:55 ` Clint Adams
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).