On Tue, Jan 3, 2012 at 9:36 AM, Eli Zaretskii <e...@gnu.org> wrote: >> From: Bruno Haible <br...@clisp.org> >> Cc: bastien ROUCARIES <roucaries.bast...@gmail.com>, Eli Zaretskii >> <e...@gnu.org>, Eric Blake <ebl...@redhat.com>, bonz...@gnu.org, >> bug-g...@gnu.org >> Date: Tue, 03 Jan 2012 03:56:56 +0100 >> >> I'm adding this new module. Feel free to use it in 'grep'. > > Thanks > >> #define IsConsoleHandle(h) (((long) (h) & 3) == 3) > > Where does this magic come from, and can we be sure it will always > hold? If there's some documentation about this, I would suggest to > mention it here.
Agreee here, it really magic. I practice GetConsoleMode could call csr like for instance in reactos (or perhaps wine I have not checked) >> HANDLE h = (HANDLE) _get_osfhandle (fd); > > Why not use intptr_t instead of HANDLE and get rid of the cast, both > here and in IsConsoleHandle above? > >> dnl On native Windows, the system's isatty() returns true for pipes and >> dnl for the NUL device. > > This could perhaps mislead, because it is TRT to return false for > pipes on Windows. Also, I'd replace "NUL device" with a more accurate > "all character devices such as the null device", similar to what you > wrote in the manual. Thanks Bastien