[PATCH] Documentation/sandbox: Add hint how to end a sandboxed barebox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 Documentation/boards/sandbox.rst |  3 +++
 commands/test.c                  | 33 ++++++++++++++++----------------
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/Documentation/boards/sandbox.rst b/Documentation/boards/sandbox.rst
index 85a54e6b04d6..8b00093fb9f3 100644
--- a/Documentation/boards/sandbox.rst
+++ b/Documentation/boards/sandbox.rst
@@ -57,3 +57,6 @@ Available sandbox invocation options include:
   ``-y``, ``--yres <res>``
 
     Specify SDL height.
+
+To terminate barebox and return to the calling shell, the poweroff command is
+suitable.
diff --git a/commands/test.c b/commands/test.c
index 86636de1c283..f7068f757904 100644
--- a/commands/test.c
+++ b/commands/test.c
@@ -159,28 +159,29 @@ static int do_test(int argc, char *argv[])
 					break;
 				}
 				expr = 0;
-				if (opt == OPT_EXISTS) {
+				switch (opt) {
+				case OPT_EXISTS:
 					expr = 1;
 					break;
-				}
-				if (opt == OPT_FILE && S_ISREG(statbuf.st_mode)) {
-					expr = 1;
+
+				case OPT_FILE:
+					expr = S_ISREG(statbuf.st_mode);
 					break;
-				}
-				if (opt == OPT_DIRECTORY && S_ISDIR(statbuf.st_mode)) {
-					expr = 1;
+
+				case OPT_DIRECTORY:
+					expr = S_ISDIR(statbuf.st_mode);
 					break;
-				}
-				if (opt == OPT_SYMBOLIC_LINK && S_ISLNK(statbuf.st_mode)) {
-					expr = 1;
+
+				case OPT_SYMBOLIC_LINK:
+					expr = S_ISLNK(statbuf.st_mode);
 					break;
-				}
-				if (opt == OPT_BLOCK && S_ISBLK(statbuf.st_mode)) {
-					expr = 1;
+
+				case OPT_BLOCK:
+					expr = S_ISBLK(statbuf.st_mode);
 					break;
-				}
-				if (opt == OPT_CHAR && S_ISCHR(statbuf.st_mode)) {
-					expr = 1;
+
+				case OPT_CHAR:
+					expr = S_ISCHR(statbuf.st_mode);
 					break;
 				}
 			}
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux