Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: read -q broken on OSX / BSD?
- X-seq: zsh-workers 30949
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: read -q broken on OSX / BSD?
- Date: Sun, 06 Jan 2013 10:43:17 -0800
- In-reply-to: <CAPzVZKkeEr_oHVkv-mpudxCN=k=sP4PyvyCTofi3+JaP=fJafw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAPzVZKkeEr_oHVkv-mpudxCN=k=sP4PyvyCTofi3+JaP=fJafw@mail.gmail.com>
On Jan 6, 11:06am, Yaniv Aknin wrote:
} Subject: read -q broken on OSX / BSD?
}
} I'm running % read -q, and then typing a single character which
} isn't y, Y or n. However, the value set in $REPLY isn't n, it is the
} character I typed.
This is apparently version-dependent rather than platform-dependent.
It got changed by workers/27188 back in July 2009, but nobody noticed,
which pretty much tells you that read -q was mainly being used for its
exit status and not for what it returned.
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.268
diff -u -r1.268 builtin.c
--- Src/builtin.c 8 Nov 2012 16:50:42 -0000 1.268
+++ Src/builtin.c 6 Jan 2013 18:40:37 -0000
@@ -5490,6 +5490,9 @@
eof = 2;
else
eof = (bptr - buf != 1 || (buf[0] != 'y' && buf[0] != 'Y'));
+ buf[0] = eof ? 'n' : 'y';
+ buf[1] = 0;
+ bptr = buf+2;
}
if (OPT_ISSET(ops,'e') || OPT_ISSET(ops,'E'))
fwrite(buf, bptr - buf, 1, stdout);
--
Barton E. Schaefer
Messages sorted by:
Reverse Date,
Date,
Thread,
Author