FILE *in = source;
int fd, ch;
- int next;
+ unsigned char byte, next;
int key;
struct timeval timeout;
for (;;) {
- ch = fgetc (in);
+ ch = read (fd, &byte, 1) == 1 ? byte : EOF;
if (ch != 0x1B) {
break;
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
- if (select (fd + 1, &ready, NULL, NULL, &timeout) <= 0 || (key = fgetc (in)) == EOF) {
+ if (select (fd + 1, &ready, NULL, NULL, &timeout) <= 0 || (key = read (fd, &byte, 1) == 1 ? byte : EOF) == EOF) {
continue;
}
putchar ('\b');
putchar (' ');
putchar ('\b');
+
+ fflush (stdout);
}
} else {
dos_write_console_char (stdout, (uint8_t) c);
}
+
+ fflush (stdout);
}