diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-09-30 18:22:48 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-09-30 18:22:48 +0400 |
commit | c18578632fd3c9e513e613a86ba2b7c4ebee6c45 (patch) | |
tree | 377f4d4e3f0a6471a5012126078fcd97f4c67242 /lib/isatty.c | |
parent | 974ab3dd887985e3aa347f3c6521f819296396a0 (diff) | |
download | coreutils-c18578632fd3c9e513e613a86ba2b7c4ebee6c45.tar.gz |
Imported Upstream version 8.23upstream/8.23
Diffstat (limited to 'lib/isatty.c')
-rw-r--r-- | lib/isatty.c | 10 |
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 |