diff options
| author | Stephen Warren <swarren@nvidia.com> | 2014-02-03 13:21:05 -0700 | 
|---|---|---|
| committer | Tom Rini <trini@ti.com> | 2014-02-19 09:47:33 -0500 | 
| commit | 2453de99df576fb907fe06cac58c628e3590833f (patch) | |
| tree | a331706ce42516b2aa0a253ac8ebce4071f7caec | |
| parent | d9b651ce31f464605eb590db9f60dd0bf92238dc (diff) | |
| download | olio-uboot-2014.01-2453de99df576fb907fe06cac58c628e3590833f.tar.xz olio-uboot-2014.01-2453de99df576fb907fe06cac58c628e3590833f.zip | |
cmd_test: evaluate to false without any arguments
This emulates bash:
$ if test; then echo yes; else echo no; fi
no
Currently, the code sets expr = -1 in this case, which gets mapped to
0 (true) at the end of do_test() by the logical -> shell exit code
conversion.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
| -rw-r--r-- | common/cmd_test.c | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/common/cmd_test.c b/common/cmd_test.c index b927d09eb..4c2f967c6 100644 --- a/common/cmd_test.c +++ b/common/cmd_test.c @@ -77,7 +77,7 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	left = argc - 1;  	ap = argv + 1; -	expr = -1; +	expr = 0;  	last_unop = OP_INVALID;  	last_binop = OP_INVALID;  	last_expr = -1; |