about summary refs log tree commit diff
path: root/Src/params.c
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-12-02 19:19:27 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-12-02 19:32:11 +0900
commit1be52186b4aed40eb9fe295691932037ecf6c6ab (patch)
tree942e557c4463d80a95be958050ed7a4ec9bc3301 /Src/params.c
parent291940bae6cc0471c35c73498e873bc58dae9a95 (diff)
downloadzsh-1be52186b4aed40eb9fe295691932037ecf6c6ab.tar.gz
zsh-1be52186b4aed40eb9fe295691932037ecf6c6ab.tar.xz
zsh-1be52186b4aed40eb9fe295691932037ecf6c6ab.zip
51079: metafy sep in array subscript flag (s:sep:)
this enable sep to contain \0 etc.
Diffstat (limited to 'Src/params.c')
-rw-r--r--Src/params.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Src/params.c b/Src/params.c
index 27ea82298..f1fe38955 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1262,7 +1262,6 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
     /* first parse any subscription flags */
     if (v->pm && (*s == '(' || *s == Inpar)) {
 	int escapes = 0;
-	int waste;
 	for (s++; *s != ')' && *s != Outpar && s != *str; s++) {
 	    switch (*s) {
 	    case 'r':
@@ -1339,8 +1338,13 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
 		sav = *t;
 		*t = '\0';
 		s += arglen;
-		sep = escapes ? getkeystring(s, &waste, GETKEYS_SEP, NULL)
-		    : dupstring(s);
+		if (escapes) {
+		    int len;
+		    sep = getkeystring(s, &len, GETKEYS_SEP, NULL);
+		    sep = metafy(sep, len, META_HREALLOC);
+		}
+		else
+		    sep = dupstring(s);
 		*t = sav;
 		s = t + arglen - 1;
 		break;