since we already support XSI test -a/-o, they better behave

This commit is contained in:
tg 2016-06-26 00:44:25 +00:00
parent 97d1d5e4fe
commit 582e745958

13
funcs.c
View File

@ -38,7 +38,7 @@
#endif #endif
#endif #endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.296 2016/06/25 23:52:46 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.297 2016/06/26 00:44:25 tg Exp $");
#if HAVE_KILLPG #if HAVE_KILLPG
/* /*
@ -2855,6 +2855,7 @@ c_test(const char **wp)
int argc, rv, invert = 0; int argc, rv, invert = 0;
Test_env te; Test_env te;
Test_op op; Test_op op;
Test_meta tm;
const char *lhs, **swp; const char *lhs, **swp;
te.flags = 0; te.flags = 0;
@ -2915,6 +2916,16 @@ c_test(const char **wp)
rv = test_eval(&te, op, lhs, *te.pos.wp++, true); rv = test_eval(&te, op, lhs, *te.pos.wp++, true);
goto ptest_out; goto ptest_out;
} }
if (ptest_isa(&te, tm = TM_AND) || ptest_isa(&te, tm = TM_OR)) {
/* XSI */
argc = test_eval(&te, TO_STNZE, lhs, NULL, true);
rv = test_eval(&te, TO_STNZE, *te.pos.wp++, NULL, true);
if (tm == TM_AND)
rv = argc && rv;
else
rv = argc || rv;
goto ptest_out;
}
/* back up to lhs */ /* back up to lhs */
te.pos.wp = swp; te.pos.wp = swp;
if (ptest_isa(&te, TM_NOT)) { if (ptest_isa(&te, TM_NOT)) {