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

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 (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@xxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html



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