Mail Archives: djgpp/1996/10/27/11:04:33
On Thu, 24 Oct 1996, Ove Keven wrote:
> But unfortunately, it doesn't work as it should. When I press a key,
> the screen scrolls up so the status line makes a mess on the screen,
> yet it does not even interpret the key I press either at first, but
> instead reverting to line-mode input, where I have to press Enter
> before it accepts the command.
>
> So what's wrong with it?
Less is OK, it's a bug in the DJGPP v2.01 library: the function `setmode'
doesn't work like the programs expect. The problem is with the following
fragment from `setmode.c':
if ((oldmode & 0x80) && (oldmode & 0x03) && handle == 0) /* for termios */
__djgpp_set_ctrl_c (! (mode & O_BINARY));
else if (oldmode & 0x80) /* Only for character dev */
{
regs.x.ax = 0x4401;
.
.
.
The above effectively says: if the handle is a character device which is
either STDIN or STDOUT (that's "oldmode & 0x03"), then do NOT put it into
raw (as opposed to cooked) mode. But that's exactly what `setmode' is
supposed to do for binary I/O from the keyboard or to the screen!
I don't understand why termios needed this change. In any case, any
problems that termios might have with raw mode should be resolved in
another way, since this will break *a lot* of programs.
- Raw text -