]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Add 'true' and 'false' commands
authorPeter Tyser <ptyser@xes-inc.com>
Fri, 16 Oct 2009 22:36:27 +0000 (17:36 -0500)
committerWolfgang Denk <wd@denx.de>
Sun, 22 Nov 2009 23:06:13 +0000 (00:06 +0100)
These commands are only enabled when the hush shell is enabled and can
be useful in scripts such as:

while true do
    echo "Booting OS...";
    run $bootcmd;
    echo "Booting OS failed";
    sleep 10;
done

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
common/cmd_test.c

index 3cdd07bf32685f23a6256700956ef7765b9c9e4d..d886f893c7ed7cf444b47adf93c87a4b3bc75a5f 100644 (file)
@@ -149,3 +149,25 @@ U_BOOT_CMD(
        "minimal test like /bin/sh",
        "[args..]"
 );
+
+int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       return 1;
+}
+
+U_BOOT_CMD(
+       false,  CONFIG_SYS_MAXARGS,     1,      do_false,
+       "do nothing, unsuccessfully",
+       NULL
+);
+
+int do_true(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       return 0;
+}
+
+U_BOOT_CMD(
+       true,   CONFIG_SYS_MAXARGS,     1,      do_true,
+       "do nothing, successfully",
+       NULL
+);