From 253a32e2f9ff1cbb8edbe7c79834a678daebeb93 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 9 Feb 2019 13:14:01 -0500 Subject: merge POSIX.1-1988/1990 --- src/unistd/isatty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/unistd/isatty.c (limited to 'src/unistd/isatty.c') 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 +#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) +*/ -- cgit v1.2.1