mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] run_shell: run again on ctrl-c
Date: Mon, 21 May 2012 09:09:55 +0200	[thread overview]
Message-ID: <1337584195-6754-1-git-send-email-s.hauer@pengutronix.de> (raw)

We can start a new interactive shell now using the 'sh' command on
the command line. This shell exits on ctrl-c though. Add a loop
around it to continue instead of exiting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/hush.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/common/hush.c b/common/hush.c
index 3d51e4c..8e8dd03 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1612,7 +1612,6 @@ static int parse_stream_outer(struct p_context *ctx, struct in_str *inp, int fla
 			}
 			if (inp->__promptme == 0)
 				printf("<INTERRUPT>\n");
-			inp->__promptme = 1;
 			temp.nonnull = 0;
 			temp.quote = 0;
 			free_pipe_list(ctx->list_head,0);
@@ -1807,9 +1806,12 @@ int run_shell(void)
 	struct in_str input;
 	struct p_context ctx;
 
-	setup_file_in_str(&input);
-	rcode = parse_stream_outer(&ctx, &input, FLAG_PARSE_SEMICOLON);
-	release_context(&ctx);
+	do {
+		setup_file_in_str(&input);
+		rcode = parse_stream_outer(&ctx, &input, FLAG_PARSE_SEMICOLON);
+		release_context(&ctx);
+	} while (!input.__promptme);
+
 	return rcode;
 }
 
-- 
1.7.10


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

                 reply	other threads:[~2012-05-21  7:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1337584195-6754-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@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