summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-11-12 10:00:43 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-11-12 14:46:05 +0100
commit1d8041b03f9634adae00ce79e861dd028b573884 (patch)
treee37e0a03dc97152f40ccccb4a0fa999d01375fb0 /common/hush.c
parentad560a179799aec8a8deb900ad8b5d2baa753cb0 (diff)
downloadbarebox-1d8041b03f9634adae00ce79e861dd028b573884.tar.gz
hush: rename __promptme to interrupt
the name '__promptme' does not make clear what the variable means. rename it to 'interrupt' which is set to true when the user has hit ctrl-c. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/common/hush.c b/common/hush.c
index f0f2eda..95054b3 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -254,7 +254,7 @@ typedef struct {
* available? Where is it documented? */
struct in_str {
const char *p;
- int __promptme;
+ int interrupt;
int promptmode;
int (*get) (struct in_str *);
int (*peek) (struct in_str *);
@@ -422,8 +422,6 @@ static void get_user_input(struct in_str *i)
static char the_command[CONFIG_CBSIZE];
char *prompt;
- i->__promptme = 1;
-
if (i->promptmode == 1)
prompt = getprompt();
else
@@ -431,7 +429,7 @@ static void get_user_input(struct in_str *i)
n = readline(prompt, console_buffer, CONFIG_CBSIZE);
if (n == -1 ) {
- i->__promptme = 0;
+ i->interrupt = 1;
n = 0;
}
@@ -456,7 +454,7 @@ static void get_user_input(struct in_str *i)
}
}
- if (i->__promptme == 0) {
+ if (i->interrupt) {
the_command[0] = '\n';
the_command[1] = '\0';
}
@@ -503,7 +501,7 @@ static void setup_file_in_str(struct in_str *i)
{
i->peek = file_peek;
i->get = file_get;
- i->__promptme = 1;
+ i->interrupt = 0;
i->promptmode = 1;
i->p = NULL;
}
@@ -512,7 +510,7 @@ static void setup_string_in_str(struct in_str *i, const char *s)
{
i->peek = static_peek;
i->get = static_get;
- i->__promptme = 1;
+ i->interrupt = 0;
i->promptmode = 1;
i->p = s;
}
@@ -1470,7 +1468,7 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
while ((ch = b_getch(input)) != EOF) {
m = map[ch];
- if (input->__promptme == 0)
+ if (input->interrupt)
return 1;
next = (ch == '\n') ? 0 : b_peek(input);
@@ -1528,7 +1526,7 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
dest->nonnull = 1;
b_addchr(dest, '\'');
while (ch = b_getch(input), ch != EOF && ch != '\'') {
- if (input->__promptme == 0)
+ if (input->interrupt)
return 1;
b_addchr(dest,ch);
}
@@ -1660,7 +1658,7 @@ static int parse_stream_outer(struct p_context *ctx, struct in_str *inp, int fla
free(ctx->stack);
b_reset(&temp);
}
- if (inp->__promptme == 0)
+ if (inp->interrupt)
printf("<INTERRUPT>\n");
temp.nonnull = 0;
temp.quote = 0;