about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-03 12:21:55 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-03 12:21:55 +0000
commit70e5b622fff4d3218106fb10f146200576b1f787 (patch)
tree76e8ee286e879f4e42e786717ab0fed2d5c1d2a6 /Src/hist.c
parent0d6350d65a856b74000393dd4c4f5453e8801444 (diff)
downloadzsh-70e5b622fff4d3218106fb10f146200576b1f787.tar.gz
zsh-70e5b622fff4d3218106fb10f146200576b1f787.tar.xz
zsh-70e5b622fff4d3218106fb10f146200576b1f787.zip
new (z) parameter flag to do shell-word splitting on the value (11113)
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 530b6e05c..3dde19845 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2037,17 +2037,28 @@ unlockhistfile(char *fn)
 
 /**/
 mod_export LinkList
-bufferwords(int *index)
+bufferwords(LinkList list, char *buf, int *index)
 {
-    LinkList list = newlinklist();
     int num = 0, cur = -1, got = 0, ne = noerrs, ocs = cs;
     char *p;
 
+    if (!list)
+	list = newlinklist();
+
     zleparse = 1;
     addedx = 0;
     noerrs = 1;
     lexsave();
-    if (!isfirstln && chline) {
+    if (buf) {
+	int l = strlen(buf);
+
+	p = (char *) zhalloc(l + 2);
+	memcpy(p, buf, l);
+	p[l] = ' ';
+	p[l + 1] = '\0';
+	inpush(p, 0, NULL);
+	cs = 0;
+    } else if (!isfirstln && chline) {
 	p = (char *) zhalloc(hptr - chline + ll + 2);
 	memcpy(p, chline, hptr - chline);
 	memcpy(p + (hptr - chline), line, ll);
@@ -2074,6 +2085,17 @@ bufferwords(int *index)
 	    untokenize((p = dupstring(tokstr)));
 	    addlinknode(list, p);
 	    num++;
+	} else if (buf) {
+	    if (IS_REDIROP(tok) && tokfd >= 0) {
+		char b[20];
+
+		sprintf(b, "%d%s", tokfd, tokstrings[tok]);
+		addlinknode(list, dupstring(b));
+		num++;
+	    } else if (tok != NEWLIN) {
+		addlinknode(list, dupstring(tokstrings[tok]));
+		num++;
+	    }
 	}
 	if (!got && !zleparse) {
 	    got = 1;