* Bug in select
@ 1998-07-01 18:21 Bernd Eggink
1998-07-03 16:15 ` PATCH: " Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Bernd Eggink @ 1998-07-01 18:21 UTC (permalink / raw)
To: Zsh-workers
Zsh-3.1.4 has a bug in 'select': An empty user input is not treated
correctly, due to a misconstructed do-loop (in do ... while(0) break and
continue have the same effect).
Here is a patch:
--- loop.c.old Wed Jul 1 19:19:26 1998
+++ loop.c Wed Jul 1 19:28:28 1998
@@ -156,7 +156,7 @@
inp = fdopen(dup((SHTTY == -1) ? 0 : SHTTY), "r");
selectlist(args);
for (;;) {
- do {
+ for (;;) {
if (empty(bufstack)) {
if (interact && SHTTY != -1 && isset(USEZLE))
str = (char *)zleread(prompt3, NULL, 0);
@@ -178,11 +178,10 @@
}
if ((s = strchr(str, '\n')))
*s = '\0';
- if(!*str) {
+ if(*str)
+ break;
selectlist(args);
- continue;
- }
- } while(0);
+ };
setsparam("REPLY", ztrdup(str));
i = atoi(str);
if (!i)
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* PATCH: Re: Bug in select
1998-07-01 18:21 Bug in select Bernd Eggink
@ 1998-07-03 16:15 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1998-07-03 16:15 UTC (permalink / raw)
To: Zsh-workers
On Jul 1, 8:21pm, Bernd Eggink wrote:
} Subject: Bug in select
}
} Zsh-3.1.4 has a bug in 'select': An empty user input is not treated
} correctly, due to a misconstructed do-loop
I couldn't get this patch to apply, probably because some mailer along
the way munged the whitespace.
Here it is again, with indentation cleaned up (was Bernd's patch made
with "diff -bw ..."?).
Index: Src/loop.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Src/loop.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 loop.c
--- loop.c 1998/06/01 17:08:44 1.1.1.1
+++ loop.c 1998/07/03 16:11:36
@@ -156,7 +156,7 @@
inp = fdopen(dup((SHTTY == -1) ? 0 : SHTTY), "r");
selectlist(args);
for (;;) {
- do {
+ for (;;) {
if (empty(bufstack)) {
if (interact && SHTTY != -1 && isset(USEZLE))
str = (char *)zleread(prompt3, NULL, 0);
@@ -178,11 +178,10 @@
}
if ((s = strchr(str, '\n')))
*s = '\0';
- if(!*str) {
- selectlist(args);
- continue;
- }
- } while(0);
+ if (*str)
+ break;
+ selectlist(args);
+ };
setsparam("REPLY", ztrdup(str));
i = atoi(str);
if (!i)
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-07-03 16:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-01 18:21 Bug in select Bernd Eggink
1998-07-03 16:15 ` PATCH: " Bart Schaefer
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).