summaryrefslogtreecommitdiffstats
path: root/c/src/exec/libcsupport/src/isatty.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/exec/libcsupport/src/isatty.c')
-rw-r--r--c/src/exec/libcsupport/src/isatty.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/c/src/exec/libcsupport/src/isatty.c b/c/src/exec/libcsupport/src/isatty.c
new file mode 100644
index 0000000000..3c64647a94
--- /dev/null
+++ b/c/src/exec/libcsupport/src/isatty.c
@@ -0,0 +1,17 @@
+/* isatty.c */
+
+/* Dumb implementation so programs will at least run. */
+
+#include <sys/stat.h>
+
+int
+isatty (int fd)
+{
+ struct stat buf;
+
+ if (fstat (fd, &buf) < 0)
+ return 0;
+ if (S_ISCHR (buf.st_mode))
+ return 1;
+ return 0;
+}