summaryrefslogtreecommitdiff
path: root/lib/libc/unistd/isatty.c
blob: c253e14a7003a34fe242373c30d42f55162d5804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include "asm/unistd_64.h" // for __NR_ioctl

#include <asm-generic/ioctls.h> // for TIOCGWINSZ
#include <syscall.h>		// for __syscall_3, syscall
#include <termios.h>		// for winsize
#include <unistd.h>		// for isatty

int isatty(int fildes)
{
	struct winsize winsize;
	return 1 + syscall(ioctl, fildes, TIOCGWINSZ, &winsize);
}