summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-11-12 09:51:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-11-12 14:45:03 +0100
commit8875a3967937911f7437fc614416eedc1050cbe3 (patch)
tree65649982a0489584682bff0270632407cd650cad /common
parent6058a2273c8f3761739011e5d3cf94e2fabdd2a3 (diff)
downloadbarebox-8875a3967937911f7437fc614416eedc1050cbe3.tar.gz
barebox-8875a3967937911f7437fc614416eedc1050cbe3.tar.xz
hush: refactor get_user_input()
Save indentation level by returning early. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/hush.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/common/hush.c b/common/hush.c
index 0f1a9b9728..7a077baac7 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -441,25 +441,27 @@ static void get_user_input(struct in_str *i)
if (i->promptmode == 1) {
strcpy(the_command,console_buffer);
i->p = the_command;
- } else {
- if (console_buffer[0] != '\n') {
- if (strlen(the_command) + strlen(console_buffer)
- < CONFIG_CBSIZE) {
- n = strlen(the_command);
- the_command[n - 1] = ' ';
- strcpy(&the_command[n], console_buffer);
- }
- else {
- the_command[0] = '\n';
- the_command[1] = '\0';
- }
- }
- if (i->__promptme == 0) {
+ return;
+ }
+
+ if (console_buffer[0] != '\n') {
+ if (strlen(the_command) + strlen(console_buffer)
+ < CONFIG_CBSIZE) {
+ n = strlen(the_command);
+ the_command[n - 1] = ' ';
+ strcpy(&the_command[n], console_buffer);
+ } else {
the_command[0] = '\n';
the_command[1] = '\0';
}
- i->p = console_buffer;
}
+
+ if (i->__promptme == 0) {
+ the_command[0] = '\n';
+ the_command[1] = '\0';
+ }
+
+ i->p = console_buffer;
}
/* This is the magic location that prints prompts