Date: Mon, 01 Jan 2001 20:49:06 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: jmichel AT schur DOT institut DOT math DOT jussieu DOT fr (Jean Michel) Message-Id: <2561-Mon01Jan2001204906+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 CC: djgpp AT delorie DOT com In-reply-to: <92qb0f$17r$1@schur.institut.math.jussieu.fr> (jmichel AT schur DOT institut DOT math DOT jussieu DOT fr) Subject: Re: Bug in djgpp libc References: <92qb0f$17r$1 AT schur DOT institut DOT math DOT jussieu DOT fr> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: jmichel AT schur DOT institut DOT math DOT jussieu DOT fr (Jean Michel) > Newsgroups: comp.os.msdos.djgpp > Date: 1 Jan 2001 17:24:47 +0100 > ... > >The program can know that it writes to a console device: it just needs to > >call isatty() on the handle. It can also filter out ^Z characters if > >stdout is connected to the console. Finally, it can remove trailing ^Z > >from input after it reads it. (Such removal will happen automatically if > >the input is read in text mode.) > > > >Would that solve the problem? > > Well, does not djgpp claim to be an environment which makes it easy to > port Unix programs to DOS (even at the expense of doing a lot of > contortions to implement stat accurately, for instance)? We try, yes. > I claim that in > the same way it should be the job of the libc low-level routines to > detect that the output is to a console device, and do the appropriate > thing (filter ^Z, whatever) so that no spurious error is returned This was discussed on the developers' list several times in the past. Unfortunately, the conclusion was that there's no way of fixing this without either breaking something else or fatally hurting performance of programs which don't send ^Z to the console (those are the majority, btw). For example, if low-level libc primitives would need to scan each buffer they get for ^Z characters, instead of simply handing it to DOS, they will become much slower. I'd still like to know if the suggestions I made help you solve the problem, and if not, why. One other possibility is to use the DJGPP termios emulation, which modifies the console I/O so that ^Z is no longer a problem. If ruby is an interactive program coming from Unix, it probably tries to use termios anyway; perhaps the DJGPP port disables that for some (histerical?) reasons, in which case all you need to do is remove the disabling code.