ash: add comment explaining last change
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
740058b42b
commit
d1df1a709f
12
shell/ash.c
12
shell/ash.c
@ -6756,6 +6756,10 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
|
|||||||
// p, varname, strloc, subtype, startloc, varflags, quotes);
|
// p, varname, strloc, subtype, startloc, varflags, quotes);
|
||||||
|
|
||||||
#if BASH_PATTERN_SUBST
|
#if BASH_PATTERN_SUBST
|
||||||
|
/* For "${v/pattern/repl}", we must find the delimiter _before_
|
||||||
|
* argstr() call expands possible variable references in pattern:
|
||||||
|
* think about "v=a; a=a/; echo ${v/$a/r}" case.
|
||||||
|
*/
|
||||||
repl = NULL;
|
repl = NULL;
|
||||||
if (subtype == VSREPLACE || subtype == VSREPLACEALL) {
|
if (subtype == VSREPLACE || subtype == VSREPLACEALL) {
|
||||||
/* Find '/' and replace with NUL */
|
/* Find '/' and replace with NUL */
|
||||||
@ -6770,11 +6774,8 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
|
|||||||
*repl = '\0';
|
*repl = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((unsigned char)*repl == CTLESC
|
if ((unsigned char)*repl == CTLESC && repl[1])
|
||||||
&& repl[1]
|
|
||||||
) {
|
|
||||||
repl++;
|
repl++;
|
||||||
}
|
|
||||||
repl++;
|
repl++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6941,11 +6942,10 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
|
|||||||
|
|
||||||
if (!repl) {
|
if (!repl) {
|
||||||
//bb_error_msg("str9:'%s' slash_pos:%d", str, slash_pos);
|
//bb_error_msg("str9:'%s' slash_pos:%d", str, slash_pos);
|
||||||
|
repl = nullstr;
|
||||||
if (slash_pos >= 0) {
|
if (slash_pos >= 0) {
|
||||||
repl = str + slash_pos;
|
repl = str + slash_pos;
|
||||||
*repl++ = '\0';
|
*repl++ = '\0';
|
||||||
} else {
|
|
||||||
repl = nullstr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//bb_error_msg("str:'%s' repl:'%s'", str, repl);
|
//bb_error_msg("str:'%s' repl:'%s'", str, repl);
|
||||||
|
Loading…
Reference in New Issue
Block a user