mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Documentation/sandbox: Add hint how to end a sandboxed barebox
@ 2020-01-28 14:25 Uwe Kleine-König
  2020-01-28 14:45 ` Antony Pavlov
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2020-01-28 14:25 UTC (permalink / raw)
  To: barebox

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-29  7:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 14:25 [PATCH] Documentation/sandbox: Add hint how to end a sandboxed barebox Uwe Kleine-König
2020-01-28 14:45 ` Antony Pavlov
2020-01-28 14:49   ` Uwe Kleine-König
2020-01-28 14:52   ` [PATCH v2] " Uwe Kleine-König
2020-01-29  7:46     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox