From 73ca2634cf80dacd27da412bbb2b6c3af29e8fe8 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 23 Mar 2000 04:22:57 +0000 Subject: zsh-workers/10197 --- Src/exec.c | 13 +++++++++++++ Src/init.c | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/Src/exec.c b/Src/exec.c index da8173a0b..16ba418ec 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2672,7 +2672,9 @@ getoutput(char *cmd, int qt) redup(pipes[1], 1); opts[MONITOR] = 0; entersubsh(Z_SYNC, 1, 0); + cmdpush(CS_CMDSUBST); execode(prog, 0, 1); + cmdpop(); close(1); _exit(lastval); zerr("exit returned in child!!", NULL, 0); @@ -2801,7 +2803,9 @@ getoutputfile(char *cmd) redup(fd, 1); opts[MONITOR] = 0; entersubsh(Z_SYNC, 1, 0); + cmdpush(CS_CMDSUBST); execode(prog, 0, 1); + cmdpop(); close(1); _exit(lastval); zerr("exit returned in child!!", NULL, 0); @@ -2885,7 +2889,9 @@ getproc(char *cmd) redup(pipes[out], out); closem(0); /* this closes pipes[!out] as well */ #endif + cmdpush(CS_CMDSUBST); execode(prog, 0, 1); + cmdpop(); zclose(out); _exit(lastval); return NULL; @@ -2911,7 +2917,9 @@ getpipe(char *cmd) entersubsh(Z_ASYNC, 1, 0); redup(pipes[out], out); closem(0); /* this closes pipes[!out] as well */ + cmdpush(CS_CMDSUBST); execode(prog, 0, 1); + cmdpop(); _exit(lastval); return 0; } @@ -2963,7 +2971,9 @@ execcond(Estate state, int do_exec) fprintf(xtrerr, "[["); tracingcond++; } + cmdpush(CS_COND); stat = !evalcond(state); + cmdpop(); if (isset(XTRACE)) { fprintf(xtrerr, " ]]\n"); fflush(xtrerr); @@ -2986,6 +2996,7 @@ execarith(Estate state, int do_exec) printprompt4(); fprintf(xtrerr, "(("); } + cmdpush(CS_MATH); e = ecgetstr(state, EC_DUPTOK, &htok); if (htok) singsub(&e); @@ -2994,6 +3005,8 @@ execarith(Estate state, int do_exec) val = mathevali(e); + cmdpop(); + if (isset(XTRACE)) { fprintf(xtrerr, " ))\n"); fflush(xtrerr); diff --git a/Src/init.c b/Src/init.c index fe90b1f2b..e7dec681e 100644 --- a/Src/init.c +++ b/Src/init.c @@ -904,6 +904,8 @@ source(char *s) int oldshst, osubsh, oloops; FILE *obshin; char *old_scriptname = scriptname, *us; + char *ocs; + int ocsp; if (!s || (!(prog = try_source_file((us = unmeta(s)))) && @@ -919,6 +921,10 @@ source(char *s) oldlineno = lineno; /* store our current lineno */ oloops = loops; /* stored the # of nested loops we are in */ oldshst = opts[SHINSTDIN]; /* store current value of this option */ + ocs = cmdstack; + ocsp = cmdsp; + cmdstack = (unsigned char *) zalloc(CMDSTACKSZ); + cmdsp = 0; if (!prog) { SHIN = tempfd; @@ -957,6 +963,9 @@ source(char *s) errflag = 0; retflag = 0; scriptname = old_scriptname; + free(cmdstack); + cmdstack = ocs; + cmdsp = ocsp; return 0; } -- cgit 1.4.1