Mercurial > hg > octave-jordi > gnulib-hg
changeset 17699:36e26a0e7826
isatty: fix to work on windows 8
* lib/isatty.c (IsConsoleHandle): Change from testing the lower
2 bits of the handle to the more expensive but accurate syscall.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 09 Jun 2014 17:07:44 +0100 |
parents | 0749cf1f5d22 |
children | a2f13d7d07b3 |
files | ChangeLog lib/isatty.c |
diffstat | 2 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-06-09 Michael Goffioul <michael.goffioul@gmail.com> + + isatty: fix to work on windows 8 + * lib/isatty.c (IsConsoleHandle): Change from testing the lower + 2 bits of the handle to the more expensive but accurate syscall. + 2014-06-07 Paul Eggert <eggert@cs.ucla.edu> maint: fix typo in fdl.texi
--- a/lib/isatty.c +++ b/lib/isatty.c @@ -32,9 +32,11 @@ /* Get _get_osfhandle(). */ #include "msvc-nothrow.h" -/* Optimized test whether a HANDLE refers to a console. - See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */ -#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3) +static BOOL IsConsoleHandle (HANDLE h) +{ + DWORD mode; + return GetConsoleMode (h, &mode) != 0; +} #if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int