summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/common/hush.c b/common/hush.c
index 7a077baac7..f0f2eda395 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -471,21 +471,23 @@ static int file_get(struct in_str *i)
int ch;
ch = 0;
+
/* If there is data waiting, eat it up */
- if (i->p && *i->p) {
+ if (i->p && *i->p)
+ return *i->p++;
+
+ /* need to double check i->file because we might be doing something
+ * more complicated by now, like sourcing or substituting. */
+ while (!i->p || strlen(i->p) == 0 )
+ get_user_input(i);
+
+ i->promptmode = 2;
+
+ if (i->p && *i->p)
ch = *i->p++;
- } else {
- /* need to double check i->file because we might be doing something
- * more complicated by now, like sourcing or substituting. */
- while (!i->p || strlen(i->p) == 0 ) {
- get_user_input(i);
- }
- i->promptmode = 2;
- if (i->p && *i->p) {
- ch = *i->p++;
- }
- debug("%s: got a %d\n", __func__, ch);
- }
+
+ debug("%s: got a %d\n", __func__, ch);
+
return ch;
}