[Top][All Lists]

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

Re: isatty fails on Windows 8

From: Eli Zaretskii
Subject: Re: isatty fails on Windows 8
Date: Sun, 23 Dec 2012 22:25:45 +0200

> Date: Thu, 20 Dec 2012 19:02:03 -0500
> From: Michael Goffioul <address@hidden>
> 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.)

reply via email to

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