1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

12044: read -A bug

This commit is contained in:
Peter Stephenson 2000-06-23 09:45:38 +00:00
parent f45c9cb8f2
commit abd757eac4
2 changed files with 16 additions and 1 deletions

@ -1,3 +1,9 @@
2000-06-23 Peter Stephenson <pws@cambridgesiliconradio.com>
* 12044: Src/builtin.c: read -A assigned an unnecessary null
if there was trailing whitespace; careful of distinction between
whitespace and non-whitespace field separators.
2000-06-23 Sven Wischnowsky <wischnow@zsh.org>
* 12041,12043 : Completion/Core/compinit: even more compinit stuff,

@ -3553,6 +3553,15 @@ bin_read(char *name, char **args, char *ops, int func)
}
if (c == EOF || c == '\n')
break;
/*
* `first' is non-zero if any separator we encounter is a
* non-whitespace separator, which means that anything
* (even an empty string) between, before or after separators
* is significant. If it is zero, we have a whitespace
* separator, which shouldn't cause extra empty strings to
* be emitted. Hence the test for (*buf || first) when
* we assign the result of reading a word.
*/
if (!bslash && isep(c)) {
if (bptr != buf || (!iwsep(c) && first)) {
first |= !iwsep(c);
@ -3587,7 +3596,7 @@ bin_read(char *name, char **args, char *ops, int func)
zputs(buf, stdout);
putchar('\n');
}
if (!ops['e']) {
if (!ops['e'] && (*buf || first)) {
if (ops['A']) {
addlinknode(readll, buf);
al++;