ash: match bash behavior for ${empty_var/*/repl}
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
883cdb79a4
commit
2b7c1aa92c
@ -7178,7 +7178,7 @@ subevalvar(char *start, char *str, int strloc,
|
|||||||
len = 0;
|
len = 0;
|
||||||
idx = startp;
|
idx = startp;
|
||||||
end = str - 1;
|
end = str - 1;
|
||||||
while (idx < end) {
|
while (idx <= end) {
|
||||||
try_to_match:
|
try_to_match:
|
||||||
loc = scanright(idx, rmesc, rmescend, str, quotes, 1);
|
loc = scanright(idx, rmesc, rmescend, str, quotes, 1);
|
||||||
//bb_error_msg("scanright('%s'):'%s'", str, loc);
|
//bb_error_msg("scanright('%s'):'%s'", str, loc);
|
||||||
@ -7186,6 +7186,8 @@ subevalvar(char *start, char *str, int strloc,
|
|||||||
/* No match, advance */
|
/* No match, advance */
|
||||||
char *restart_detect = stackblock();
|
char *restart_detect = stackblock();
|
||||||
skip_matching:
|
skip_matching:
|
||||||
|
if (idx >= end)
|
||||||
|
break;
|
||||||
STPUTC(*idx, expdest);
|
STPUTC(*idx, expdest);
|
||||||
if (quotes && (unsigned char)*idx == CTLESC) {
|
if (quotes && (unsigned char)*idx == CTLESC) {
|
||||||
idx++;
|
idx++;
|
||||||
@ -7198,8 +7200,6 @@ subevalvar(char *start, char *str, int strloc,
|
|||||||
len++;
|
len++;
|
||||||
rmesc++;
|
rmesc++;
|
||||||
/* continue; - prone to quadratic behavior, smarter code: */
|
/* continue; - prone to quadratic behavior, smarter code: */
|
||||||
if (idx >= end)
|
|
||||||
break;
|
|
||||||
if (str[0] == '*') {
|
if (str[0] == '*') {
|
||||||
/* Pattern is "*foo". If "*foo" does not match "long_string",
|
/* Pattern is "*foo". If "*foo" does not match "long_string",
|
||||||
* it would never match "ong_string" etc, no point in trying.
|
* it would never match "ong_string" etc, no point in trying.
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
|
w
|
||||||
Ok:0
|
Ok:0
|
||||||
|
Loading…
Reference in New Issue
Block a user