about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-11-22 11:42:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-11-22 11:42:47 +0000
commitcc9bc2dd0b90cbf920794f15d0fce73fe04babac (patch)
treebcf101de55b998fdf0f7eca2c7252e442952e1f2 /Src/utils.c
parente6946adf57a44fe84781f20c395ba51bd39fd4d9 (diff)
downloadzsh-cc9bc2dd0b90cbf920794f15d0fce73fe04babac.tar.gz
zsh-cc9bc2dd0b90cbf920794f15d0fce73fe04babac.tar.xz
zsh-cc9bc2dd0b90cbf920794f15d0fce73fe04babac.zip
28424: new POSIX_STRINGS option
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/utils.c b/Src/utils.c
index e788051cf..2e30c176a 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5200,7 +5200,7 @@ getkeystring(char *s, int *len, int how, int *misc)
     char *buf, tmp[1];
     char *t, *tdest = NULL, *u = NULL, *sstart = s, *tbuf = NULL;
     char svchar = '\0';
-    int meta = 0, control = 0;
+    int meta = 0, control = 0, ignoring = 0;
     int i;
 #if defined(HAVE_WCHAR_H) && defined(HAVE_WCTOMB) && defined(__STDC_ISO_10646__)
     wint_t wval;
@@ -5623,11 +5623,22 @@ getkeystring(char *s, int *len, int how, int *misc)
 	if (how & GETKEY_DOLLAR_QUOTE) {
 	    char *t2;
 	    for (t2 = tbuf; t2 < t; t2++) {
+		/*
+		 * In POSIX mode, an embedded NULL is discarded and
+		 * terminates processing.  It just does, that's why.
+		 */
+		if (isset(POSIXSTRINGS)) {
+		    if (*t2 == '\0')
+			ignoring = 1;
+		    if (ignoring)
+			break;
+		}
 		if (imeta(*t2)) {
 		    *tdest++ = Meta;
 		    *tdest++ = *t2 ^ 32;
-		} else
+		} else {
 		    *tdest++ = *t2;
+		}
 	    }
 	    /*
 	     * Reset use of temporary buffer.