Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: Bug in select



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



Messages sorted by: Reverse Date, Date, Thread, Author