summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-11-12 09:38:40 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-11-12 14:45:03 +0100
commit86e7032568d18853b96a807ce6334ca28fc70169 (patch)
tree959c8dabc4631ba7daaf8d8104cca611718e5ced /common
parent091ef4fcfc17f6af6a283da976d81b3b026fc6a9 (diff)
downloadbarebox-86e7032568d18853b96a807ce6334ca28fc70169.tar.gz
barebox-86e7032568d18853b96a807ce6334ca28fc70169.tar.xz
hush: refactor readline call
Don't call readline in if/else, instead setup a variable and call it once. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/hush.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/hush.c b/common/hush.c
index 5969127a91..0f1a9b9728 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -420,15 +420,16 @@ static void get_user_input(struct in_str *i)
{
int n;
static char the_command[CONFIG_CBSIZE];
+ char *prompt;
i->__promptme = 1;
- if (i->promptmode == 1) {
- n = readline(getprompt(), console_buffer, CONFIG_CBSIZE);
- } else {
- n = readline(CONFIG_PROMPT_HUSH_PS2, console_buffer, CONFIG_CBSIZE);
- }
+ if (i->promptmode == 1)
+ prompt = getprompt();
+ else
+ prompt = CONFIG_PROMPT_HUSH_PS2;
+ n = readline(prompt, console_buffer, CONFIG_CBSIZE);
if (n == -1 ) {
i->__promptme = 0;
n = 0;