mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-05 11:01:13 +02:00
zsh-workers/7539
This commit is contained in:
parent
a17bcbc45e
commit
ffa18a29ab
2 changed files with 31 additions and 0 deletions
|
@ -587,6 +587,10 @@ Quote the resulting words with backslashes.
|
||||||
item(tt(Q))(
|
item(tt(Q))(
|
||||||
Remove one level of quotes from the resulting words.
|
Remove one level of quotes from the resulting words.
|
||||||
)
|
)
|
||||||
|
item(tt(%))(
|
||||||
|
Expand all tt(%) escapes in the resulting words in the same way as in
|
||||||
|
prompts (see noderef(Prompt Expansion)).
|
||||||
|
)
|
||||||
item(tt(X))(
|
item(tt(X))(
|
||||||
With this flag parsing errors occuring with the tt(Q) flag or the
|
With this flag parsing errors occuring with the tt(Q) flag or the
|
||||||
pattern matching forms such as `tt(${)var(name)tt(#)var(pattern)tt(})'
|
pattern matching forms such as `tt(${)var(name)tt(#)var(pattern)tt(})'
|
||||||
|
|
27
Src/subst.c
27
Src/subst.c
|
@ -730,6 +730,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
int arrasg = 0;
|
int arrasg = 0;
|
||||||
int eval = 0;
|
int eval = 0;
|
||||||
int aspar = 0;
|
int aspar = 0;
|
||||||
|
int presc = 0;
|
||||||
int nojoin = 0;
|
int nojoin = 0;
|
||||||
char inbrace = 0; /* != 0 means ${...}, otherwise $... */
|
char inbrace = 0; /* != 0 means ${...}, otherwise $... */
|
||||||
char hkeys = 0;
|
char hkeys = 0;
|
||||||
|
@ -934,6 +935,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
wantt = 1;
|
wantt = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '%':
|
||||||
|
presc = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
flagerr:
|
flagerr:
|
||||||
zerr("error in flags", NULL, 0);
|
zerr("error in flags", NULL, 0);
|
||||||
|
@ -1569,6 +1574,28 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
makecapitals(&val);
|
makecapitals(&val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (presc) {
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (isarr) {
|
||||||
|
char **ap;
|
||||||
|
|
||||||
|
if (!copied)
|
||||||
|
aval = arrdup(aval), copied = 1;
|
||||||
|
ap = aval;
|
||||||
|
for (; *ap; ap++) {
|
||||||
|
unmetafy(*ap, &len);
|
||||||
|
*ap = unmetafy(promptexpand(metafy(*ap, len, META_NOALLOC),
|
||||||
|
0, NULL, NULL), &len);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!copied)
|
||||||
|
val = dupstring(val), copied = 1;
|
||||||
|
unmetafy(val, &len);
|
||||||
|
val = unmetafy(promptexpand(metafy(val, len, META_NOALLOC),
|
||||||
|
0, NULL, NULL), &len);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (quotemod) {
|
if (quotemod) {
|
||||||
if (isarr) {
|
if (isarr) {
|
||||||
char **ap;
|
char **ap;
|
||||||
|
|
Loading…
Reference in a new issue