Date: Thu, 8 Apr 1999 11:17:08 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Michel de Ruiter cc: "'DJGPP workers'" Subject: RE: setmode problem In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 6 Apr 1999, Michel de Ruiter wrote: > > > All problems disappeared when I set stdin to _IONBF (not buffered) > > > instead of _IOLBF (line buffered). At least, just one key press is > > > enough to let the C-BREAK through. > > I'm worried about the possible implications of turning off > > the buffering just because somebody reads in binary mode. > > Can anybody think of any downside to this change? If not, > > let's do it. > > Or let's just fix "all" the applications using setmode(O_BINARY)... Most of them are fixed already, actually (I had something to do with that ;-). I thought about this problem a bit more, and don't think the simple solution you propose is enough. Imagine a program that switches stdin to binary mode and also redirects it to a file with `dup'. With your change, the result will depend on the order of these two operations: in one case, you wind up with an unbuffered file, in the other it is buffered. So at least some changes in other functions, like `dup' and `dup2' will be necessary to prevent these subtle ``features''. > And it's documentation in setmode.txh. I thought setmode.txh already tells enough about this issue. If not, please tell what's missing. > It seems this problem is already known among some DJGPP "porters" but not > all. We (someone how knows most about this) should document this somewhere > at least... I agree, and I put this information in setmode.txh, open.txh, fopen.txh, and signal.txh exactly for that reason. Again, if something's missing from that description, please tell what it is.