On Sun, Dec 23, 2012 at 3:25 PM, Eli Zaretskii <e...@gnu.org> wrote: > > Date: Thu, 20 Dec 2012 19:02:03 -0500 > > From: Michael Goffioul <michael.goffi...@gmail.com> > > > > We've got a bug report in octave [1] that seems to indicate that gnulib's > > replacement of isatty is incorrect on Windows 8 (it's fine up to Windows > > 7). Looking at the implementation, it first calls the Windows _isatty > > version, then checks the last 2 bits of the handle associated with the > file > > descriptor, based on the assumption described in [2] (a console HANDLE is > > not a multiple of 4). It seems that this last assumption is not valid > > anymore on Windows 8. > > Does the following work on Windows 8? > > #define ISATTY(fd) (isatty(fd) && lseek(fd,SEEK_CUR,0) == -1) > > and then use ISATTY instead of isatty. > > (The lseek test is to reject other character devices, most prominently > the null device, with MS implementation of isatty doesn't reject.) >
I'll ask the bug reported to try it out (I don't have Windows 8). Paolo, note that there's an error in your suggested code, one should test "!= 0" instead of equality: GetConsoleMode returns non zero on success. Michael.