1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

make (e) flag be silent unless (X) is given, too (11768)

This commit is contained in:
Sven Wischnowsky 2000-06-06 08:35:54 +00:00
parent 0d0a134822
commit 4900804b61
4 changed files with 29 additions and 15 deletions

View file

@ -1,3 +1,8 @@
2000-06-06 Sven Wischnowsky <wischnow@zsh.org>
* 11768: Doc/Zsh/expn.yo, Src/lex.c, Src/subst.c: make (e) flag be
silent unless (X) is given, too
2000-06-05 Oliver Kiddle <opk@zsh.org>
* 11756: Completion/User/_urls, Completion/Linux/_rpm: accept -g

View file

@ -643,7 +643,7 @@ setting of the tt(PROMPT_PERCENT), tt(PROMPT_SUBST) and
tt(PROMPT_BANG) options.
)
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) 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.
)

View file

@ -1418,6 +1418,22 @@ dquote_parse(char endchar, int sub)
/**/
mod_export int
parsestr(char *s)
{
int err;
if ((err = parsestrnoerr(s))) {
untokenize(s);
if (err > 32 && err < 127)
zerr("parse error near `%c'", NULL, err);
else
zerr("parse error", NULL, 0);
}
return err;
}
/**/
mod_export int
parsestrnoerr(char *s)
{
int l = strlen(s), err;
@ -1434,13 +1450,6 @@ parsestr(char *s)
inpop();
DPUTS(cmdsp, "BUG: parsestr: cmdstack not empty.");
lexrestore();
if (err) {
untokenize(s);
if (err > 32 && err < 127)
zerr("parse error near `%c'", NULL, err);
else
zerr("parse error", NULL, 0);
}
return err;
}

View file

@ -702,13 +702,13 @@ get_intarg(char **s)
/* Parsing for the (e) flag. */
static int
subst_parse_str(char **sp, int single)
subst_parse_str(char **sp, int single, int err)
{
char *s;
*sp = s = dupstring(*sp);
if (!parsestr(s)) {
if (!(err ? parsestr(s) : parsestrnoerr(s))) {
if (!single) {
for (; *s; s++)
if (*s == Qstring)
@ -1852,7 +1852,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (prenum || postnum)
x = dopadding(x, prenum, postnum, preone, postone,
premul, postmul);
if (eval && subst_parse_str(&x, (qt && !nojoin)))
if (eval && subst_parse_str(&x, (qt && !nojoin), quoteerr))
return NULL;
xlen = strlen(x);
for (tn = firstnode(&tl);
@ -1888,7 +1888,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (prenum || postnum)
x = dopadding(x, prenum, postnum, preone, postone,
premul, postmul);
if (eval && subst_parse_str(&x, (qt && !nojoin)))
if (eval && subst_parse_str(&x, (qt && !nojoin), quoteerr))
return NULL;
xlen = strlen(x);
strcatsub(&y, ostr, aptr, x, xlen, NULL, globsubst, copied);
@ -1903,7 +1903,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (prenum || postnum)
x = dopadding(x, prenum, postnum, preone, postone,
premul, postmul);
if (eval && subst_parse_str(&x, (qt && !nojoin)))
if (eval && subst_parse_str(&x, (qt && !nojoin), quoteerr))
return NULL;
if (qt && !*x && isarr != 2)
y = dupstring(nulstring);
@ -1919,7 +1919,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (prenum || postnum)
x = dopadding(x, prenum, postnum, preone, postone,
premul, postmul);
if (eval && subst_parse_str(&x, (qt && !nojoin)))
if (eval && subst_parse_str(&x, (qt && !nojoin), quoteerr))
return NULL;
xlen = strlen(x);
*str = strcatsub(&y, aptr, aptr, x, xlen, fstr, globsubst, copied);
@ -1938,7 +1938,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (prenum || postnum)
x = dopadding(x, prenum, postnum, preone, postone,
premul, postmul);
if (eval && subst_parse_str(&x, (qt && !nojoin)))
if (eval && subst_parse_str(&x, (qt && !nojoin), quoteerr))
return NULL;
xlen = strlen(x);
*str = strcatsub(&y, ostr, aptr, x, xlen, fstr, globsubst, copied);