From: inikep Date: Wed, 25 May 2016 10:41:41 +0000 (+0200) Subject: usage of fileno() only on POSIX and Windows X-Git-Tag: v0.7.0^2~54^2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f1acdd15890cea8cfba011ef470a905a3963d60;p=thirdparty%2Fzstd.git usage of fileno() only on POSIX and Windows --- diff --git a/programs/zbufftest.c b/programs/zbufftest.c index fce0ab275..c780b8f4e 100644 --- a/programs/zbufftest.c +++ b/programs/zbufftest.c @@ -262,8 +262,6 @@ static size_t FUZ_randomLength(U32* seed, U32 maxLog) return FUZ_rLogLength(seed, logLength); } -#define MIN(a,b) ( (a) < (b) ? (a) : (b) ) - #define CHECK(cond, ...) if (cond) { DISPLAY("Error => "); DISPLAY(__VA_ARGS__); \ DISPLAY(" (seed %u, test nb %u) \n", seed, testNb); goto _output_error; } diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 13ff7955d..215157873 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -52,9 +52,12 @@ # include /* _isatty */ # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) #else - extern int fileno(FILE *stream); /* triggers fileno() within on POSIX */ +#if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE # include /* isatty */ # define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) +#else +# define IS_CONSOLE(stdStream) 0 +#endif #endif