summaryrefslogtreecommitdiff
path: root/src/unistd/isatty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd/isatty.c')
-rw-r--r--src/unistd/isatty.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/unistd/isatty.c b/src/unistd/isatty.c
new file mode 100644
index 00000000..baafa508
--- /dev/null
+++ b/src/unistd/isatty.c
@@ -0,0 +1,19 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+int isatty(int fildes)
+{
+ SCNO(scno, "isatty", 0);
+ int r = __libc.syscall(scno, fildes);
+ if (r < 0) {
+ errno = -r;
+ return 0;
+ }
+ return r;
+}
+/*
+POSIX(1)
+*/