From 2e2f0e326235c9bca9ee3855f012ab74cc4a56ed Mon Sep 17 00:00:00 2001 From: Laurence Kedward Date: Tue, 23 Nov 2021 14:50:52 +0000 Subject: Fix for checking isatty in MSYS2 mintty. --- src/ptycheck/isatty.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/ptycheck/isatty.c (limited to 'src/ptycheck/isatty.c') diff --git a/src/ptycheck/isatty.c b/src/ptycheck/isatty.c new file mode 100644 index 0000000..61acee6 --- /dev/null +++ b/src/ptycheck/isatty.c @@ -0,0 +1,26 @@ +#include //for isatty() +#include //for fileno() + +#ifdef __MINGW64__ +#include "iscygpty.h" +#endif + +int c_isatty(void) +{ + + if (isatty(fileno(stdout))){ + return 1; + } else { + + #ifdef __MINGW64__ + if (is_cygpty(fileno(stdout))){ + return 1; + } else { + return 0; + } + #endif + + return 0; + } + +} \ No newline at end of file -- cgit v1.2.3