about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-09-24 14:55:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-09-24 14:55:32 +0000
commiteeb9ec471493312d44588026c18bd5440a3fd1eb (patch)
tree6bc698feb429c899daa9b15a6cb9a54bef8b72a1 /Src/utils.c
parent0c82828e8679105adcb53765f8a65f666b08f7c4 (diff)
downloadzsh-eeb9ec471493312d44588026c18bd5440a3fd1eb.tar.gz
zsh-eeb9ec471493312d44588026c18bd5440a3fd1eb.tar.xz
zsh-eeb9ec471493312d44588026c18bd5440a3fd1eb.zip
19129: extra argument to typeset -T gives character for joining array
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 0d9f9f9c3..56230fddb 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1793,14 +1793,20 @@ zjoin(char **arr, int delim, int heap)
     char **s, *ret, *ptr;
 
     for (s = arr; *s; s++)
-	len += strlen(*s) + 1;
+	len += strlen(*s) + 1 + (imeta(delim) ? 1 : 0);
     if (!len)
 	return heap? "" : ztrdup("");
     ptr = ret = (heap ? (char *) hcalloc(len) : (char *) zcalloc(len));
     for (s = arr; *s; s++) {
 	strucpy(&ptr, *s);
-	if (delim)
-	    *ptr++ = delim;
+	if (delim) {
+	    if (imeta(delim)) {
+		*ptr++ = Meta;
+		*ptr++ = delim ^ 32;
+	    }
+	    else
+		*ptr++ = delim;
+	}
     }
     ptr[-1] = '\0';
     return ret;
@@ -1856,7 +1862,15 @@ skipwsep(char **s)
     return i;
 }
 
-/* see findsep() below for handling of `quote' argument */
+/*
+ * haven't worked out what allownull does; it's passed down from
+ *   sepsplit but all the cases it's used are either 0 or 1 without
+ *   a comment.  it seems to be something to do with the `nulstring'
+ *   which i think is some kind of a metafication thing, so probably
+ *   allownull's value is associated with whether we are using
+ *   metafied strings.
+ * see findsep() below for handling of `quote' argument
+ */
 
 /**/
 mod_export char **