eliminate legacy macros

This commit is contained in:
tg
2017-04-27 19:33:53 +00:00
parent 91a3d6751e
commit 1080008a8f
12 changed files with 114 additions and 170 deletions

8
eval.c
View File

@@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.204 2017/04/27 19:16:07 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.205 2017/04/27 19:33:47 tg Exp $");
/*
* string expansion
@@ -1227,7 +1227,7 @@ varsub(Expand *xp, const char *sp, const char *word,
} else if (ctype(c, C_SUB1)) {
slen += 2;
stype |= c;
} else if (ksh_issubop2(c)) {
} else if (ctype(c, C_SUB2)) {
/* Note: ksh88 allows :%, :%%, etc */
slen += 2;
stype = c;
@@ -1335,7 +1335,7 @@ varsub(Expand *xp, const char *sp, const char *word,
c = stype & 0x7F;
/* test the compiler's code generator */
if (((stype < 0x100) && (ksh_issubop2(c) ||
if (((stype < 0x100) && (ctype(c, C_SUB2) ||
(((stype & 0x80) ? *xp->str == '\0' : xp->str == null) &&
(state != XARG || (ifs0 || xp->split ?
(xp->u.strv[0] == NULL) : !hasnonempty(xp->u.strv))) ?
@@ -1345,7 +1345,7 @@ varsub(Expand *xp, const char *sp, const char *word,
/* expand word instead of variable value */
state = XBASE;
if (Flag(FNOUNSET) && xp->str == null && !zero_ok &&
(ksh_issubop2(c) || (state != XBASE && c != '+')))
(ctype(c, C_SUB2) || (state != XBASE && c != '+')))
errorf(Tf_parm, sp);
*stypep = stype;
*slenp = slen;