1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-07 23:51:14 +02:00

23176: apply the (X) parameter flag to the (#) flag; fix comment typo.

This commit is contained in:
Bart Schaefer 2007-02-25 23:41:03 +00:00
parent d98959ab67
commit 3fc59a0f09
3 changed files with 31 additions and 9 deletions

View file

@ -4,6 +4,13 @@
Completion/Unix/Commands/_ip (tweaked), Doc/Zsh/compsys.yo: add to
regex completion handling and add new ip completion.
2007-02-25 Barton E. Schaefer <schaefer@zsh.org>
* 23176 (tweaked): Doc/Zsh/expn.yo, Src/subst.c: make the (X)
parameter expansion flag apply to the (#) flag as well, so that
"character not in range" is not normally a fatal error. Also
fix a minor typo in a comment.
2007-02-25 Clint Adams <clint@zsh.org>
* 23185: Tobias Gruetzmacher: Completion/Unix/Command/_qemu: qemu

View file

@ -874,9 +874,10 @@ Similar to tt(w) with the difference that empty words between
repeated delimiters are also counted.
)
item(tt(X))(
With this flag parsing errors occurring with the tt(Q) and tt(e) flags or the
pattern matching forms such as `tt(${)var(name)tt(#)var(pattern)tt(})'
are reported. Without the flag they are silently ignored.
With this flag, parsing errors occurring with the tt(Q), tt(e) and tt(#)
flags or the pattern matching forms such as
`tt(${)var(name)tt(#)var(pattern)tt(})' are reported. Without the flag,
errors are silently ignored.
)
item(tt(z))(
Split the result of the expansion into words using shell parsing to

View file

@ -1193,7 +1193,7 @@ static char *
substevalchar(char *ptr)
{
zlong ires = mathevali(ptr);
int len;
int len = 0;
if (errflag)
return NULL;
@ -1204,7 +1204,8 @@ substevalchar(char *ptr)
/* inefficient: should separate out \U handling from getkeystring */
sprintf(buf, "\\U%.8x", (unsigned int)ires);
ptr = getkeystring(buf, &len, GETKEYS_BINDKEY, NULL);
} else
}
if (len == 0)
#endif
{
ptr = zhalloc(2);
@ -2603,7 +2604,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
/*
* Handler ${+...}. TODO: strange, why do we handle this only
* if there isn't a trailing modifier? Why don't we do this
* e.g. when we hanlder the ${(t)...} flag?
* e.g. when we handle the ${(t)...} flag?
*/
if (chkset) {
val = dupstring(vunset ? "0" : "1");
@ -2658,6 +2659,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (errflag)
return NULL;
if (evalchar) {
int one = noerrs, oef = errflag, haserr = 0;
if (!quoteerr)
noerrs = 1;
/*
* Evaluate the value numerically and output the result as
* a character.
@ -2669,15 +2674,24 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
for (avptr = aval, av2ptr = aval2; *avptr; avptr++, av2ptr++)
{
if (!(*av2ptr = substevalchar(*avptr)))
return NULL;
/* When noerrs = 1, the only error is out-of-memory */
if (!(*av2ptr = substevalchar(*avptr))) {
haserr = 1;
break;
}
}
*av2ptr = NULL;
aval = aval2;
} else {
/* When noerrs = 1, the only error is out-of-memory */
if (!(val = substevalchar(val)))
return NULL;
haserr = 1;
}
noerrs = one;
if (!quoteerr)
errflag = oef;
if (haserr || errflag)
return NULL;
}
/*
* This handles taking a length with ${#foo} and variations.