mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
test/[: use a shell state bit (re: 7003aba4)
Instead of a global 'sh_in_test_builtin' integer flag, it is nicer to use the mechanism for shell state bits, which was designed for this sort of thing. src/cmd/ksh93/include/defs.h, src/cmd/ksh93/sh/defs.c: - Remove global sh_in_test_builtin integer. - Define new SH_INTESTCMD state bit. src/cmd/ksh93/bltins/test.c: _ERROR_exit_b_test(), b_test(): - Use the new state bit.
This commit is contained in:
parent
42301639d6
commit
cd2cf236c2
3 changed files with 5 additions and 6 deletions
|
|
@ -89,9 +89,9 @@ static int e3(struct test*);
|
|||
*/
|
||||
int _ERROR_exit_b_test(int exitval)
|
||||
{
|
||||
if(sh_in_test_builtin)
|
||||
if(sh_isstate(SH_INTESTCMD))
|
||||
{
|
||||
sh_in_test_builtin = 0;
|
||||
sh_offstate(SH_INTESTCMD);
|
||||
if(exitval < 2)
|
||||
exitval = 2;
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ int b_test(int argc, char *argv[],Shbltin_t *context)
|
|||
register int not;
|
||||
int exitval;
|
||||
|
||||
sh_in_test_builtin = 1;
|
||||
sh_onstate(SH_INTESTCMD);
|
||||
tdata.sh = context->shp;
|
||||
tdata.av = argv;
|
||||
tdata.ap = 1;
|
||||
|
|
@ -226,7 +226,7 @@ int b_test(int argc, char *argv[],Shbltin_t *context)
|
|||
tdata.ac = argc;
|
||||
exitval = (!expr(&tdata,0));
|
||||
done:
|
||||
sh_in_test_builtin = 0;
|
||||
sh_offstate(SH_INTESTCMD);
|
||||
return(exitval);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue