about summary refs log tree commit diff
path: root/Src/hashtable.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-09-29 21:02:59 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-09-29 21:02:59 +0100
commitcf6b0f5663e798c8d4303697115230ac4469baca (patch)
tree6d91ba3556177799897a307b3c17ca7c286f7d0e /Src/hashtable.c
parent4a529201b8524bb3b149a5e7702bbaf8787617f2 (diff)
downloadzsh-cf6b0f5663e798c8d4303697115230ac4469baca.tar.gz
zsh-cf6b0f5663e798c8d4303697115230ac4469baca.tar.xz
zsh-cf6b0f5663e798c8d4303697115230ac4469baca.zip
33285: apply function definition redirections at execution
Diffstat (limited to 'Src/hashtable.c')
-rw-r--r--Src/hashtable.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/hashtable.c b/Src/hashtable.c
index ef187927b..7a430629d 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -887,6 +887,8 @@ freeshfuncnode(HashNode hn)
     zsfree(shf->node.nam);
     if (shf->funcdef)
 	freeeprog(shf->funcdef);
+    if (shf->redir)
+	freeeprog(shf->redir);
     zsfree(shf->filename);
     if (shf->sticky) {
 	if (shf->sticky->n_on_opts)
@@ -954,10 +956,19 @@ printshfuncnode(HashNode hn, int printflags)
 		printf(" \"$@\"");
 	    }
 	}   
-	printf("\n}\n");
+	printf("\n}");
     } else {
-	printf(" () { }\n");
+	printf(" () { }");
     }
+    if (f->redir) {
+	t = getpermtext(f->redir, NULL, 1);
+	if (t) {
+	    zputs(t, stdout);
+	    zsfree(t);
+	}
+    }
+
+    putchar('\n');
 }
 
 /**************************************/