about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/Src/exec.c b/Src/exec.c
index ac0288be0..4c9c291c4 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2917,25 +2917,24 @@ execfuncdef(Estate state, int do_exec)
 {
     Shfunc shf;
     char *s;
-    int signum, nprg, npats, num, len, plen, i;
-    Wordcode beg = state->pc, end, names;
+    int signum, nprg, npats, len, plen, i;
+    Wordcode beg = state->pc, end;
     Eprog prog;
     Patprog *pp;
+    LinkList names;
 
     end = beg + WC_FUNCDEF_SKIP(state->pc[-1]);
-    num = state->pc[0];
-    names = state->pc + 1;
-    nprg = state->pc[1 + num] - 4;
-    npats = state->pc[2 + num];
-
-    state->pc += num + 3;
+    names = ecgetlist(state, *state->pc++, 1);
+    nprg = *state->pc++ - 4;
+    npats = *state->pc++;
 
     plen = (end - state->pc) * sizeof(wordcode);
     len = plen + (npats * sizeof(Patprog));
 
+    execsubst(names);
+
     PERMALLOC {
-	while (num--) {
-	    s = ecrawstr(state->prog, names++);
+	while ((s = (char *) ugetnode(names))) {
 	    prog = (Eprog) zalloc(sizeof(*prog));
 	    prog->heap = 0;
 	    prog->len = len;