summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-06-23 09:45:38 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-06-23 09:45:38 +0000
commitabd757eac42f9c5bb3f32f01d2928af05d3df3e0 (patch)
tree2cd5ebb72c198d80ecae2e1f50e5c905e6424fd6
parentf45c9cb8f2b331a51aec64349b6287b22a482c5e (diff)
downloadzsh-abd757eac42f9c5bb3f32f01d2928af05d3df3e0.tar.gz
zsh-abd757eac42f9c5bb3f32f01d2928af05d3df3e0.zip
12044: read -A bug
-rw-r--r--ChangeLog6
-rw-r--r--Src/builtin.c11
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9772fd8f0..3ee75a294 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/Src/builtin.c b/Src/builtin.c
index 90c82c06e..69dcdd70f 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -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++;