[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'isatty' (was: Re: MS-Windows build of Grep [2/4])

From: Eli Zaretskii
Subject: Re: new module 'isatty' (was: Re: MS-Windows build of Grep [2/4])
Date: Tue, 03 Jan 2012 03:36:45 -0500

> From: Bruno Haible <address@hidden>
> Cc: bastien ROUCARIES <address@hidden>, Eli Zaretskii <address@hidden>, Eric 
> Blake <address@hidden>, address@hidden, address@hidden
> Date: Tue, 03 Jan 2012 03:56:56 +0100
> I'm adding this new module. Feel free to use it in 'grep'.


> #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.

>       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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]