about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-07-09 11:04:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-07-09 11:04:01 +0000
commit2d2ce4ecc2ee36088df2f4f494e5d335a7359562 (patch)
treeb03647735a3b409af44c1ae95943da15cd8d60c9
parent9deb9a4e9675040e581034e2227397181264ce0b (diff)
downloadzsh-2d2ce4ecc2ee36088df2f4f494e5d335a7359562.tar.gz
zsh-2d2ce4ecc2ee36088df2f4f494e5d335a7359562.tar.xz
zsh-2d2ce4ecc2ee36088df2f4f494e5d335a7359562.zip
18836: read with metafied delimiter didn't work.
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c3
-rw-r--r--Test/B04read.ztst6
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 13655b070..50228f4c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-09  Peter Stephenson  <pws@csr.com>
+
+	* 18836: Src/builtin.c, Test/B04read.ztst: `read -d' failed with
+	metafied delimiters, in particular null.
+
 2003-07-07  Peter Stephenson  <pws@csr.com>
 
 	* 18824: Functions/Zle/kill-word-match: deleted to the end
diff --git a/Src/builtin.c b/Src/builtin.c
index f8a713152..bdb7c72d8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4231,7 +4231,8 @@ bin_read(char *name, char **args, Options ops, int func)
 	}
     }
     if (OPT_ISSET(ops,'d')) {
-        delim = *OPT_ARG(ops,'d');
+	char *delimstr = OPT_ARG(ops,'d');
+        delim = (delimstr[0] == Meta) ? delimstr[1] ^ 32 : delimstr[0];
 	if (SHTTY != -1) {
 	    struct ttyinfo ti;
 	    gettyinfo(&ti);
diff --git a/Test/B04read.ztst b/Test/B04read.ztst
index 45a3486af..5efbf24ca 100644
--- a/Test/B04read.ztst
+++ b/Test/B04read.ztst
@@ -63,3 +63,9 @@
 0:read with timeout (no waiting should occur)
 >hello
 >0
+
+ print -n 'Testing the\0null hypothesis\0' |
+ while read -d $'\0' line; do print $line; done
+0:read with null delimiter
+>Testing the
+>null hypothesis