www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/27/11:04:33

Date: Sun, 27 Oct 1996 17:51:40 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Ove Keven <ovek AT arcticnet DOT no>
Cc: djgpp AT delorie DOT com, DJ Delorie <dj AT delorie DOT com>,
Daisuke Aoyama <jack AT st DOT rim DOT or DOT jp>
Subject: Re: GNU less doesn't work
In-Reply-To: <54pt8h$tmc@troll.powertech.no>
Message-Id: <Pine.SUN.3.91.961027174101.15339A-100000@is>
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019