diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-11 15:27:00 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-11 15:27:00 +0800 |
commit | f4ee8c859c3d3fe6c5b540bffa6a0b6f320f8b3e (patch) | |
tree | 22b3d58db0458f6e4c03a30422c4708dc0e2ff7e /src/expand.c | |
parent | [EXPAND] Removed herefd hack (diff) | |
download | dash-f4ee8c859c3d3fe6c5b540bffa6a0b6f320f8b3e.tar.gz dash-f4ee8c859c3d3fe6c5b540bffa6a0b6f320f8b3e.zip |
[EXPAND] Expand here-documents in the current shell environment
Previously we always expanded here-documents in a subshell. This is contrary to the POSIX specification and how other shells behave. What's more this slows down many expansions due to the extra fork (however, it must be said that it is possible for it speed up certain expansions by running it simultaneously with the command on two CPUs). This patch move the expansion into the current shell environment. Test case: unset a cat <<- EOF > /dev/null ${a=NOT} EOF echo ${a}BAD Old result: BAD New result: NOTBAD
Diffstat (limited to '')
-rw-r--r-- | src/expand.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/expand.c b/src/expand.c index ee699e8..f3d63c4 100644 --- a/src/expand.c +++ b/src/expand.c @@ -178,18 +178,6 @@ static inline const char *getpwhome(const char *name) /* - * Expand shell variables and backquotes inside a here document. - */ - -void -expandhere(union node *arg, int fd) -{ - expandarg(arg, (struct arglist *)NULL, EXP_QUOTED); - xwrite(fd, stackblock(), expdest - (char *)stackblock()); -} - - -/* * Perform variable substitution and command substitution on an argument, * placing the resulting list of arguments in arglist. If EXP_FULL is true, * perform splitting and file name expansion. When arglist is NULL, perform |