diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-05-18 12:39:24 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-05-18 12:39:24 +0000 |
commit | 11e31474665c0ca7f689457633f72483f3f9f2ad (patch) | |
tree | c9b7353cfa4aef29d9d04358fe34db82d8c2d7c2 | |
parent | 9a7d4529ea622a9871fe21d40ce53c86a6e6b212 (diff) | |
download | zsh-11e31474665c0ca7f689457633f72483f3f9f2ad.tar.gz zsh-11e31474665c0ca7f689457633f72483f3f9f2ad.tar.xz zsh-11e31474665c0ca7f689457633f72483f3f9f2ad.zip |
try to make ${(e)..} work for complicated parameter expansions in the value; this means: keep Qstring tokens unchanged if they are inside double quotes and tokenizing patterns in parameter expansions (14381)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/subst.c | 15 |
2 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 851c7ba0c..7e711ac70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-05-18 Sven Wischnowsky <wischnow@zsh.org> + + * 14381: Src/subst.c: try to make ${(e)..} work for complicated + parameter expansions in the value; this means: keep Qstring + tokens unchanged if they are inside double quotes and + tokenizing patterns in parameter expansions + 2001-05-18 Bart Schaefer <schaefer@zsh.org> * unposted: Test/.distfiles, Test/V01zmodload.ztst: Add the basic diff --git a/Src/subst.c b/Src/subst.c index 492778400..24103b3da 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -720,9 +720,13 @@ subst_parse_str(char **sp, int single, int err) if (!(err ? parsestr(s) : parsestrnoerr(s))) { if (!single) { + int qt = 0; + for (; *s; s++) - if (*s == Qstring) + if (!qt && *s == Qstring) *s = String; + else if (*s == Dnull) + qt = !qt; } return 0; } @@ -1483,7 +1487,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) case '#': case Pound: case '/': - if (qt) { + /* This once was executed only `if (qt) ...'. But with that + * patterns in a expansion resulting from a ${(e)...} aren't + * tokenized even though this function thinks they are (it thinks + * they are because subst_parse_string() turns Qstring tokens + * into String tokens and for unquoted parameter expansions the + * lexer normally does tokenize patterns inside parameter + * expansions). */ + { int one = noerrs, oef = errflag, haserr; if (!quoteerr) |