mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-29 08:08:37 +00:00
sh: Don't scan word twice in ${param+-word}.
There is no longer a case where argbackq has already been advanced but the string pointer needs to be advanced.
This commit is contained in:
parent
3f4760c8e1
commit
9e1bb30e23
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316414
@ -753,15 +753,14 @@ evalvar(const char *p, struct nodelist **restrict argbackq, int flag,
|
||||
break;
|
||||
|
||||
case VSNORMAL:
|
||||
break;
|
||||
return p;
|
||||
|
||||
case VSPLUS:
|
||||
case VSMINUS:
|
||||
if (!set) {
|
||||
argstr(p, argbackq,
|
||||
return argstr(p, argbackq,
|
||||
flag | (flag & EXP_SPLIT ? EXP_SPLIT_LIT : 0) |
|
||||
(varflags & VSQUOTE ? EXP_LIT_QUOTED : 0), dst);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -769,10 +768,8 @@ evalvar(const char *p, struct nodelist **restrict argbackq, int flag,
|
||||
case VSTRIMLEFTMAX:
|
||||
case VSTRIMRIGHT:
|
||||
case VSTRIMRIGHTMAX:
|
||||
if (!set) {
|
||||
set = 1;
|
||||
if (!set)
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Terminate the string and start recording the pattern
|
||||
* right after it
|
||||
@ -805,15 +802,14 @@ evalvar(const char *p, struct nodelist **restrict argbackq, int flag,
|
||||
abort();
|
||||
}
|
||||
|
||||
if (subtype != VSNORMAL) { /* skip to end of alternative */
|
||||
{ /* skip to end of alternative */
|
||||
int nesting = 1;
|
||||
for (;;) {
|
||||
if ((c = *p++) == CTLESC)
|
||||
p++;
|
||||
else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) {
|
||||
if (set)
|
||||
*argbackq = (*argbackq)->next;
|
||||
} else if (c == CTLVAR) {
|
||||
else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE))
|
||||
*argbackq = (*argbackq)->next;
|
||||
else if (c == CTLVAR) {
|
||||
if ((*p++ & VSTYPE) != VSNORMAL)
|
||||
nesting++;
|
||||
} else if (c == CTLENDVAR) {
|
||||
|
Loading…
Reference in New Issue
Block a user