summaryrefslogtreecommitdiff
path: root/userland/libc/unistd/isatty.c
blob: 55cf4e73579e3bc1b4207d02bcd10cdbf6a1c73d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <errno.h>
#include <syscall.h>
#include <unistd.h>

int isatty(int fd) {
  int rc = syscall(SYS_ISATTY, fd, 0, 0, 0, 0);
  if (1 == rc) {
    return rc;
  }
  errno = -rc;
  return 0;
}