use evalstr instead of wdstrip+substitute and drop home-grown backslash removal
This commit is contained in:
parent
d4aa35212c
commit
8d22d9226f
27
eval.c
27
eval.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.175 2015/12/12 17:28:10 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.176 2015/12/12 18:47:22 tg Exp $");
|
||||
|
||||
/*
|
||||
* string expansion
|
||||
@ -496,30 +496,9 @@ expand(
|
||||
else
|
||||
d[-2] = EOS;
|
||||
sp += (d ? d : p) - s - 1;
|
||||
tpat0 = wdstrip(s,
|
||||
WDS_KEEPQ | WDS_MAGIC);
|
||||
pat = substitute(tpat0, DOTILDE);
|
||||
if (d) {
|
||||
d = wdstrip(p, WDS_KEEPQ);
|
||||
rrep = substitute(d,
|
||||
DOTILDE);
|
||||
afree(d, ATEMP);
|
||||
} else
|
||||
rrep = null;
|
||||
pat = evalstr(s, DOTILDE | DOPAT);
|
||||
rrep = d ? evalstr(p, DOTILDE) : null;
|
||||
afree(s, ATEMP);
|
||||
s = d = pat;
|
||||
while (*s)
|
||||
if (*s != '\\' ||
|
||||
s[1] == '%' ||
|
||||
s[1] == '#' ||
|
||||
s[1] == '\0' ||
|
||||
/* XXX really? */ s[1] == '\\' ||
|
||||
s[1] == '/')
|
||||
*d++ = *s++;
|
||||
else
|
||||
s++;
|
||||
*d = '\0';
|
||||
afree(tpat0, ATEMP);
|
||||
|
||||
/* check for special cases */
|
||||
switch (*pat) {
|
||||
|
Loading…
Reference in New Issue
Block a user