On Tue, Jan 3, 2012 at 9:36 AM, Eli Zaretskii <[email protected]> wrote: >> From: Bruno Haible <[email protected]> >> Cc: bastien ROUCARIES <[email protected]>, Eli Zaretskii >> <[email protected]>, Eric Blake <[email protected]>, [email protected], >> [email protected] >> 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
