[U-Boot] [PATCH V4 07/12] cmd_test: evaluate to false without any arguments

Stephen Warren swarren at wwwdotorg.org
Mon Feb 3 21:21:05 CET 2014


From: Stephen Warren <swarren at nvidia.com>

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 at nvidia.com>
---
v4: No change.
v3: New patch.
---
 common/cmd_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cmd_test.c b/common/cmd_test.c
index b927d09eb3e0..4c2f967c6dc0 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;
-- 
1.8.1.5



More information about the U-Boot mailing list