mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] Documentation/sandbox: Add hint how to end a sandboxed barebox
Date: Tue, 28 Jan 2020 15:25:17 +0100	[thread overview]
Message-ID: <20200128142517.27979-1-u.kleine-koenig@pengutronix.de> (raw)

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

             reply	other threads:[~2020-01-28 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 14:25 Uwe Kleine-König [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200128142517.27979-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox