diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-05-31 17:17:12 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-05-31 17:17:12 +0000 |
commit | 4f6753e586dba5e6c240e670d41fc8fd011034e1 (patch) | |
tree | 88ee74a45ccdff717c60b3c722c94e2e2801b843 | |
parent | 4f990533e35b75a89f6ec86d9835e97ea5aafaa0 (diff) | |
download | busybox-4f6753e586dba5e6c240e670d41fc8fd011034e1.tar.gz |
Cope gracefully when people type something, then hit ^C.
-Erik
-rw-r--r-- | hush.c | 5 | ||||
-rw-r--r-- | shell/hush.c | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -891,6 +891,7 @@ static void get_user_input(struct in_str *i) the_command[0]=fgetc(i->file); the_command[1]='\0'; #endif + fflush(stdout); i->p = the_command; } @@ -908,7 +909,9 @@ static int file_get(struct in_str *i) /* need to double check i->file because we might be doing something * more complicated by now, like sourcing or substituting. */ if (i->__promptme && interactive && i->file == stdin) { - get_user_input(i); + while(! i->p || (interactive && strlen(i->p)==0) ) { + get_user_input(i); + } i->promptmode=2; i->__promptme = 0; if (i->p && *i->p) { diff --git a/shell/hush.c b/shell/hush.c index 5c129ce17..372c95753 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -891,6 +891,7 @@ static void get_user_input(struct in_str *i) the_command[0]=fgetc(i->file); the_command[1]='\0'; #endif + fflush(stdout); i->p = the_command; } @@ -908,7 +909,9 @@ static int file_get(struct in_str *i) /* need to double check i->file because we might be doing something * more complicated by now, like sourcing or substituting. */ if (i->__promptme && interactive && i->file == stdin) { - get_user_input(i); + while(! i->p || (interactive && strlen(i->p)==0) ) { + get_user_input(i); + } i->promptmode=2; i->__promptme = 0; if (i->p && *i->p) { |