From: "Juan Manuel Guerrero" Organization: Darmstadt University of Technology To: Eli Zaretskii Date: Sat, 24 Feb 2001 19:13:37 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: gettext pretest available CC: Bruno Haible , djgpp-workers AT delorie DOT com X-mailer: Pegasus Mail for Windows (v2.54DE) Message-ID: <2E9DA485A1B@HRZ1.hrz.tu-darmstadt.de> Reply-To: djgpp-workers AT delorie DOT com Date: Sat, 24 Feb 2001 10:21:59 +0200 From: "Eli Zaretskii" > > 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. Thank you for the advice. I really did not know this. I assume that some day I must read and understand the whole libc sources. > 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. Only FYI: there are two occurrences of setmode in the whole package. 1) src/msgfmt.c. Here stdout is switched to O_BINARY and stdout is really stdout (1). 2) src/msgunftm.c. Here stdin is switched to O_BINARY. It is really stdin (0). In this case, the macro is a *must have*. The reason is the way msgunfmt evaluates the command line. On gettext 0.10.35 the user had to explicitely write a dash for stdin. On gettext 0.10.36 the user can write a dash or *nothing* for stdin. This has the concequence that a newbie that types the command: PROMPT> msgunfmt CR will have to reboot the machine. No arguments to msgunfmt always implies: read from stdin. Now, there is no way to terminate the programm. There is no other occurence of setmode in the sources *for the moment*. Now it is clear that an appropiate comment *must* and will be added to the macro in lib/system.h. Regards, Guerrero, Juan Manuel