aboutsummaryrefslogtreecommitdiff
path: root/tests/unistd/isatty.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unistd/isatty.c')
-rw-r--r--tests/unistd/isatty.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unistd/isatty.c b/tests/unistd/isatty.c
new file mode 100644
index 00000000..cc1ff641
--- /dev/null
+++ b/tests/unistd/isatty.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+int main() {
+ printf("read: %d\n", isatty(open("/read", O_RDONLY)));
+ printf("errno: %d\n", errno);
+ errno = 0;
+
+ printf("write: %d\n", isatty(open("/write", O_WRONLY)));
+ printf("errno: %d\n", errno);
+ errno = 0;
+
+ printf("all: %d\n", isatty(open("/all", O_RDONLY)));
+ printf("errno: %d\n", errno);
+ errno = 0;
+
+ printf("folder: %d\n", isatty(open("/folder", O_RDONLY)));
+ printf("errno: %d\n", errno);
+ errno = 0;
+
+ printf("file: %d\n", isatty(open("/file", O_RDONLY)));
+ printf("errno: %d\n", errno);
+ errno = 0;
+
+ return 0;
+}