another Debian workaround for /bin/sh: don’t pattern in trims

This commit is contained in:
tg 2011-03-28 08:27:09 +00:00
parent e8ea9954aa
commit e19d8612ad
2 changed files with 14 additions and 7 deletions

13
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.102 2011/03/17 21:57:50 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/eval.c,v 1.103 2011/03/28 08:27:08 tg Exp $");
/* /*
* string expansion * string expansion
@ -578,8 +578,11 @@ expand(const char *cp, /* input word */
* in a trim will work as * in a trim will work as
* expected) * expected)
*/ */
if (!Flag(FSH)) {
*dp++ = MAGIC; *dp++ = MAGIC;
*dp++ = (char)('@' | 0x80); *dp++ = (char)('@' |
0x80);
}
break; break;
case '=': case '=':
/* /*
@ -635,8 +638,12 @@ expand(const char *cp, /* input word */
switch (st->stype & 0x17F) { switch (st->stype & 0x17F) {
case '#': case '#':
case '%': case '%':
if (!Flag(FSH)) {
/* Append end-pattern */ /* Append end-pattern */
*dp++ = MAGIC; *dp++ = ')'; *dp = '\0'; *dp++ = MAGIC;
*dp++ = ')';
}
*dp = '\0';
dp = Xrestpos(ds, dp, st->base); dp = Xrestpos(ds, dp, st->base);
/* /*
* Must use st->var since calling * Must use st->var since calling

4
lex.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.144 2011/03/26 16:11:43 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/lex.c,v 1.145 2011/03/28 08:27:09 tg Exp $");
/* /*
* states while lexing word * states while lexing word
@ -463,7 +463,7 @@ yylex(int cf)
* If this is a trim operation, * If this is a trim operation,
* treat (,|,) specially in STBRACE. * treat (,|,) specially in STBRACE.
*/ */
if (ctype(c, C_SUBOP2)) { if (!Flag(FSH) && ctype(c, C_SUBOP2)) {
ungetsc(c); ungetsc(c);
PUSH_STATE(STBRACE); PUSH_STATE(STBRACE);
} else { } else {