diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-05-06 10:17:59 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-05-06 10:17:59 +0000 |
commit | ffcbc2d7ba03067492045e4cbead519a3b3c27ef (patch) | |
tree | df436f4253158a7d5a4875e54cd7d273dd5334a6 /programs/platform.h | |
parent | ab984b3e51d32af796fe89e130f57bf58b8a14b2 (diff) |
Diffstat (limited to 'programs/platform.h')
-rw-r--r-- | programs/platform.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/programs/platform.h b/programs/platform.h index 89a9f6cd42a01..74412cde332ea 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -100,9 +100,18 @@ extern "C" { #if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 1)) || (PLATFORM_POSIX_VERSION >= 200112L) || defined(__DJGPP__) # include <unistd.h> /* isatty */ # define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) -#elif defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) +#elif defined(MSDOS) || defined(OS2) || defined(__CYGWIN__) # include <io.h> /* _isatty */ # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) +#elif defined(WIN32) || defined(_WIN32) +# include <io.h> /* _isatty */ +# include <windows.h> /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ +# include <stdio.h> /* FILE */ +static __inline int IS_CONSOLE(FILE* stdStream) +{ + DWORD dummy; + return _isatty(_fileno(stdStream)) && GetConsoleMode((HANDLE)_get_osfhandle(_fileno(stdStream)), &dummy); +} #else # define IS_CONSOLE(stdStream) 0 #endif @@ -129,6 +138,14 @@ extern "C" { #endif +#ifndef ZSTD_SPARSE_DEFAULT +# if (defined(__APPLE__) && defined(__MACH__)) +# define ZSTD_SPARSE_DEFAULT 0 +# else +# define ZSTD_SPARSE_DEFAULT 1 +# endif +#endif + #if defined (__cplusplus) } |