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

2012-01-03 Thread Bastien ROUCARIES
On Tue, Jan 3, 2012 at 9:36 AM, Eli Zaretskii wrote: >> From: Bruno Haible >> Cc: bastien ROUCARIES , Eli Zaretskii >> , Eric Blake , 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 > >> #d

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

2012-01-03 Thread Eli Zaretskii
> From: Bruno Haible > Cc: bastien ROUCARIES , Eli Zaretskii > , Eric Blake , 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

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

2012-01-02 Thread Bruno Haible
bastien ROUCARIES wrote: > The right fix is : > DWORD st; > /* note use _ version for porting to vc */ > if(!_isattty(fd)) > return 0; > if (!GetConsoleMode(_get_osfhandle(fd), &st)) > return 0; > return 1; > > This is the idea Thanks for the idea. > it is a little bit more complic

Re: MS-Windows build of Grep [2/4]

2011-12-30 Thread Paul Eggert
On 12/30/11 07:43, Jim Meyering wrote: > Without useful stat.st_ino, there are some important tasks (e.g., dir > traversal) that simply cannot be performed safely/reliably. In general that's true, and on further thought I agree we should leave that part of grep's st_ino code alone. I proposed that

Re: MS-Windows build of Grep [2/4]

2011-12-30 Thread Eli Zaretskii
> From: bastien ROUCARIES > Date: Fri, 30 Dec 2011 12:36:07 +0100 > Cc: bonz...@gnu.org, > bug-gnulib@gnu.org, > bug-g...@gnu.org > > > > In fact isatty under windows is equivalent to test if a file is a char > > > device. > > > > That is true. But unless a Windows user goes out of their way,

Re: MS-Windows build of Grep [2/4]

2011-12-30 Thread bastien ROUCARIES
Le Wednesday 28 December 2011 18:12:06, Eli Zaretskii a écrit : > > Date: Wed, 28 Dec 2011 17:06:05 +0100 > > From: Bastien ROUCARIES > > Cc: Eli Zaretskii , bug-gnulib , > > bug-g...@gnu.org > > > > Isatty is broken under windows but this not the right fix. > > What's wrong about it? If it fai

Re: RE : Re: MS-Windows build of Grep [2/4]

2011-12-28 Thread Eli Zaretskii
> Date: Wed, 28 Dec 2011 17:06:05 +0100 > From: Bastien ROUCARIES > Cc: Eli Zaretskii , bug-gnulib , > bug-g...@gnu.org > > Isatty is broken under windows but this not the right fix. What's wrong about it? If it fails under some conditions, please describe them. > In fact isatty under windows

Re: RE : Re: MS-Windows build of Grep [2/4]

2011-12-28 Thread Eric Blake
[Can you please fix your mailer to use In-Reply-To so as to preserve threading? Also, top-posting tends to be frowned on for technical lists.] On 12/28/2011 09:06 AM, Bastien ROUCARIES wrote: > Isatty is broken under windows but this not the right fix. > > In fact isatty under windows is equival

RE : Re: MS-Windows build of Grep [2/4]

2011-12-28 Thread Bastien ROUCARIES
Isatty is broken under windows but this not the right fix. In fact isatty under windows is equivalent to test if a file is a char device. Gnat has a better work arround Bastien Le 28 déc. 2011 14:20, "Paolo Bonzini" a écrit : On 12/24/2011 01:59 PM, Eli Zaretskii wrote: > + return > +is

Re: MS-Windows build of Grep [2/4]

2011-12-28 Thread Paolo Bonzini
On 12/24/2011 01:59 PM, Eli Zaretskii wrote: + return +isatty (fd) +#ifdef __MINGW32__ +/* Without the lseek call, Windows isatty returns non-zero for the + null device as well. */ +&& lseek (fd, SEEK_CUR, 0) == -1 +#endif This fix to isatty should be done in gnulib. Otherwise