diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2002-01-06 01:09:09 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2002-01-06 01:09:09 +0000 |
commit | 0524ab98ff4328f1e9a5e09a66e94523f6a3d903 (patch) | |
tree | 3a2d5df6b60a4298c99fe968e9e625ef821f01f8 /Src | |
parent | 31634c24e7d8bdaa082a1d45560b5feae568d153 (diff) | |
download | zsh-0524ab98ff4328f1e9a5e09a66e94523f6a3d903.tar.gz zsh-0524ab98ff4328f1e9a5e09a66e94523f6a3d903.tar.xz zsh-0524ab98ff4328f1e9a5e09a66e94523f6a3d903.zip |
16400, 16401: preserve empty words that result from brace expansion.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/subst.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Src/subst.c b/Src/subst.c index 14ad37386..607e9b979 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -49,8 +49,8 @@ char nulstring[] = {Nularg, '\0'}; mod_export void prefork(LinkList list, int flags) { - LinkNode node; - int asssub = (flags & PF_TYPESET) && isset(KSHTYPESET); + LinkNode node, stop = 0; + int keep = 0, asssub = (flags & PF_TYPESET) && isset(KSHTYPESET); queue_signals(); for (node = firstnode(list); node; incnode(node)) { @@ -78,15 +78,22 @@ prefork(LinkList list, int flags) } } for (node = firstnode(list); node; incnode(node)) { + if (node == stop) + keep = 0; if (*(char *)getdata(node)) { remnulargs(getdata(node)); - if (unset(IGNOREBRACES) && !(flags & PF_SINGLE)) - while (hasbraces(getdata(node))) + if (unset(IGNOREBRACES) && !(flags & PF_SINGLE)) { + if (!keep) + stop = nextnode(node); + while (hasbraces(getdata(node))) { + keep = 1; xpandbraces(list, &node); + } + } if (unset(SHFILEEXPANSION)) filesub((char **)getaddrdata(node), flags & (PF_TYPESET|PF_ASSIGN)); - } else if (!(flags & PF_SINGLE)) + } else if (!(flags & PF_SINGLE) && !keep) uremnode(list, node); if (errflag) { unqueue_signals(); |