diff options
author | Michael Goffioul <michael.goffioul@gmail.com> | 2014-06-09 17:07:44 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-06-09 17:10:10 +0100 |
commit | a008d625b7854d2c08c6606d90f6f2f48263f973 (patch) | |
tree | 0a37d722d9612ca4e37ac148065d8ff2817572dc /lib/isatty.c | |
parent | 0a38624d37ea60bf34cee91ef7dcdb20a87bb55f (diff) | |
download | gnulib-a008d625b7854d2c08c6606d90f6f2f48263f973.tar.gz |
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.
Diffstat (limited to 'lib/isatty.c')
-rw-r--r-- | lib/isatty.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/isatty.c b/lib/isatty.c index e38bc9d9aa..7180eadd26 100644 --- 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 |