aboutsummaryrefslogtreecommitdiff
path: root/src/ptycheck/isatty.c
diff options
context:
space:
mode:
authorLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-11-23 14:50:52 +0000
committerLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-11-25 12:03:29 +0000
commit2e2f0e326235c9bca9ee3855f012ab74cc4a56ed (patch)
tree1c723fefadf4def765c211c6babf2be298b48783 /src/ptycheck/isatty.c
parent778763233905a7a27d34b066793dc3fc12366ec5 (diff)
downloadfpm-2e2f0e326235c9bca9ee3855f012ab74cc4a56ed.tar.gz
fpm-2e2f0e326235c9bca9ee3855f012ab74cc4a56ed.zip
Fix for checking isatty in MSYS2 mintty.
Diffstat (limited to 'src/ptycheck/isatty.c')
-rw-r--r--src/ptycheck/isatty.c26
1 files changed, 26 insertions, 0 deletions
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 <unistd.h> //for isatty()
+#include <stdio.h> //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