fix a few expansion substitutions to do tilde expansion

issue spotted by izabera and confirmed by Geoff Clare
This commit is contained in:
tg 2015-12-12 17:28:10 +00:00
parent c10a8b5809
commit d4aa35212c
1 changed files with 8 additions and 5 deletions

13
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.174 2015/10/09 19:29:47 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.175 2015/12/12 17:28:10 tg Exp $");
/*
* string expansion
@ -498,10 +498,11 @@ expand(
sp += (d ? d : p) - s - 1;
tpat0 = wdstrip(s,
WDS_KEEPQ | WDS_MAGIC);
pat = substitute(tpat0, 0);
pat = substitute(tpat0, DOTILDE);
if (d) {
d = wdstrip(p, WDS_KEEPQ);
rrep = substitute(d, 0);
rrep = substitute(d,
DOTILDE);
afree(d, ATEMP);
} else
rrep = null;
@ -608,9 +609,11 @@ expand(
}
case '#':
case '%':
/* ! DOBLANK,DOBRACE,DOTILDE */
/* ! DOBLANK,DOBRACE */
f = (f & DONTRUNCOMMAND) |
DOPAT | DOTEMP | DOSCALAR;
DOPAT | DOTILDE |
DOTEMP | DOSCALAR;
tilde_ok = 1;
st->quotew = quote = 0;
/*
* Prepend open pattern (so |