[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: |
Bastien ROUCARIES |
Subject: |
Re: new module 'isatty' (was: Re: MS-Windows build of Grep [2/4]) |
Date: |
Tue, 3 Jan 2012 09:41:31 +0100 |
On Tue, Jan 3, 2012 at 9:36 AM, Eli Zaretskii <address@hidden> wrote:
>> 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'.
>
> 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