Date: Sat, 24 Feb 2001 10:21:59 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De Message-Id: <7263-Sat24Feb2001102159+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: haible AT ilog DOT fr, djgpp-workers AT delorie DOT com In-reply-to: <2D628811C2A@HRZ1.hrz.tu-darmstadt.de> (ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De) Subject: Re: gettext pretest available References: <2D628811C2A AT HRZ1 DOT hrz DOT tu-darmstadt DOT de> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Juan Manuel Guerrero" > Organization: Darmstadt University of Technology > Date: Fri, 23 Feb 2001 23:31:48 +0200 > > > This will only DTRT if this macro is called _only_ for switching > > stdin/stdout to binary mode and back. If you ever call the macro on a > > handle other than 0 or 1, it might silently do nothing without a good > > reason. > > > > It is okay to do this if you _know_ setmode will only be invoked on > > stdin/stdout, but I'd suggest a prominent comment to that effect where > > the macro is defined, lest someone forgets this caveat. > > Unfortunately I do not understand this objection. > The goal of the macro is to *inhibit* the switching of *every* file handle > conected to a console. The key to unlock this puzzle is in setmode's source: it treats handle 0 specially, and its test for which handles to put into raw (as opposed to cooked) mode is different from the test in isatty. The result is that isatty and setmode don't really agree except for stdin/stdout. The danger of using isatty for anything other than stdin/stdout is that it might cause the call to setmode to be bypassed when you don't want that. Whether this side effect (of never switching any handle connected to the console into binary mode) is okay or not can only be answered by someone who knows what the application needs to do; that's not me. In addition, even if today the application doesn't need that, those needs could change in the future. That is why I suggested a comment near the macro's definition to that effect.