summaryrefslogtreecommitdiff
path: root/lib/isatty.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isatty.c')
-rw-r--r--lib/isatty.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/isatty.c b/lib/isatty.c
index 36fbc36e..7180eadd 100644
--- a/lib/isatty.c
+++ b/lib/isatty.c
@@ -1,5 +1,5 @@
/* isatty() replacement.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2014 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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