|
@@ -88,9 +88,15 @@ static struct console_driver * has_input ( void ) {
|
88
|
88
|
*/
|
89
|
89
|
int getchar ( void ) {
|
90
|
90
|
struct console_driver *console;
|
91
|
|
- int character = 256;
|
|
91
|
+ int character;
|
|
92
|
+
|
|
93
|
+ while ( 1 ) {
|
|
94
|
+ console = has_input();
|
|
95
|
+ if ( console && console->getchar ) {
|
|
96
|
+ character = console->getchar ();
|
|
97
|
+ break;
|
|
98
|
+ }
|
92
|
99
|
|
93
|
|
- while ( character == 256 ) {
|
94
|
100
|
/* Doze for a while (until the next interrupt). This works
|
95
|
101
|
* fine, because the keyboard is interrupt-driven, and the
|
96
|
102
|
* timer interrupt (approx. every 50msec) takes care of the
|
|
@@ -105,10 +111,6 @@ int getchar ( void ) {
|
105
|
111
|
* input.
|
106
|
112
|
*/
|
107
|
113
|
step();
|
108
|
|
-
|
109
|
|
- console = has_input();
|
110
|
|
- if ( console && console->getchar )
|
111
|
|
- character = console->getchar ();
|
112
|
114
|
}
|
113
|
115
|
|
114
|
116
|
/* CR -> LF translation */
|