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

Re: 3.1.7-pre-2



On Apr 30,  4:45pm, Bart Schaefer wrote:
} Subject: Re: 3.1.7-pre-1 for the workers
}
} I have a couple of issues that came up after the prerelease to resolve.
} 
} The "read -q" bug that Sven patched in 10727.

So ... 10727 makes this work:

	zsh -c "read -q '?Can you see this? '" < /dev/null

But the following still sends the prompt to the redirected stderr, which
seems wrong to me:

	zsh -c "read -q '?Can you see this? '" < /dev/null >& /dev/null

The goal is to read from the tty only after also prompting there.  Patch
follows for consideration; I have not committed it, pending commentary.
The first hunk is the interesting one: It seems to me there's never any
longer a reason to send the prompt to stderr, but I may be missing some
case where ZLE is active and yet SHTTY == -1.  (?)

The other two hunks just avoid a redundant close().

Index: Src/builtin.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Src/builtin.c,v
retrieving revision 1.86
diff -u -r1.86 builtin.c
--- builtin.c	2000/04/30 18:54:07	1.86
+++ builtin.c	2000/05/01 02:32:28
@@ -3420,8 +3420,8 @@
 	     *readpmpt && *readpmpt != '?'; readpmpt++);
 	if (*readpmpt++) {
 	    if (keys || isatty(0)) {
-		zputs(readpmpt, (haso ? shout : stderr));
-		fflush(haso ? shout : stderr);
+		zputs(readpmpt, shout);
+		fflush(shout);
 	    }
 	    readpmpt[-1] = '\0';
 	}
@@ -3461,8 +3461,7 @@
 	    else
 		settyinfo(&shttyinfo);
 	    if (haso) {
-		close(SHTTY);
-		fclose(shout);
+		fclose(shout);	/* close(SHTTY) */
 		shout = oshout;
 		SHTTY = -1;
 	    }
@@ -3494,8 +3493,7 @@
 
 	    /* dispose of result appropriately, etc. */
 	    if (haso) {
-		close(SHTTY);
-		fclose(shout);
+		fclose(shout);	/* close(SHTTY) */
 		shout = oshout;
 		SHTTY = -1;
 	    }

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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