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

17
eval.c
View File

@ -22,7 +22,7 @@
#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
@ -578,8 +578,11 @@ expand(const char *cp, /* input word */
* in a trim will work as
* expected)
*/
*dp++ = MAGIC;
*dp++ = (char)('@' | 0x80);
if (!Flag(FSH)) {
*dp++ = MAGIC;
*dp++ = (char)('@' |
0x80);
}
break;
case '=':
/*
@ -635,8 +638,12 @@ expand(const char *cp, /* input word */
switch (st->stype & 0x17F) {
case '#':
case '%':
/* Append end-pattern */
*dp++ = MAGIC; *dp++ = ')'; *dp = '\0';
if (!Flag(FSH)) {
/* Append end-pattern */
*dp++ = MAGIC;
*dp++ = ')';
}
*dp = '\0';
dp = Xrestpos(ds, dp, st->base);
/*
* Must use st->var since calling

4
lex.c
View File

@ -22,7 +22,7 @@
#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
@ -463,7 +463,7 @@ yylex(int cf)
* If this is a trim operation,
* treat (,|,) specially in STBRACE.
*/
if (ctype(c, C_SUBOP2)) {
if (!Flag(FSH) && ctype(c, C_SUBOP2)) {
ungetsc(c);
PUSH_STATE(STBRACE);
} else {