ref: a97255112d90b1c776d610ac360a857af87556f3
parent: 850af54157f2fd111576750e2028435de05dbf5f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 28 21:55:05 EDT 2016
handle cooked mode eof
--- a/kern/devcons.c
+++ b/kern/devcons.c
@@ -613,27 +613,29 @@
}
} else {
while(!qcanread(lineq)) {
- readcons(kbdq, &kbd.line[kbd.x], 1);
- ch = kbd.line[kbd.x];
- eol = 0;
- switch(ch){
- case '\b':
- if(kbd.x)
- kbd.x--;
- break;
- case 0x15:
- kbd.x = 0;
- break;
- case '\n':
- case 0x04:
- eol = 1;
- default:
- kbd.line[kbd.x++] = ch;
- break;
+ eol = 1;
+ if(readcons(kbdq, &kbd.line[kbd.x], 1) == 1){
+ eol = 0;
+ ch = kbd.line[kbd.x];
+ switch(ch){
+ case '\b':
+ if(kbd.x)
+ kbd.x--;
+ break;
+ case 0x15:
+ kbd.x = 0;
+ break;
+ case 0x04:
+ eol = 1;
+ break;
+ case '\n':
+ eol = 1;
+ default:
+ kbd.line[kbd.x++] = ch;
+ break;
+ }
}
if(kbd.x == sizeof(kbd.line) || eol){
- if(ch == 0x04)
- kbd.x--;
qwrite(lineq, kbd.line, kbd.x);
kbd.x = 0;
}