summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/console.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/console.c b/src/core/console.c
index 6f55d5583..653f689d0 100644
--- a/src/core/console.c
+++ b/src/core/console.c
@@ -88,9 +88,15 @@ static struct console_driver * has_input ( void ) {
*/
int getchar ( void ) {
struct console_driver *console;
- int character = 256;
+ int character;
+
+ while ( 1 ) {
+ console = has_input();
+ if ( console && console->getchar ) {
+ character = console->getchar ();
+ break;
+ }
- while ( character == 256 ) {
/* Doze for a while (until the next interrupt). This works
* fine, because the keyboard is interrupt-driven, and the
* timer interrupt (approx. every 50msec) takes care of the
@@ -105,10 +111,6 @@ int getchar ( void ) {
* input.
*/
step();
-
- console = has_input();
- if ( console && console->getchar )
- character = console->getchar ();
}
/* CR -> LF translation */