summaryrefslogtreecommitdiff
path: root/lib/libc/unistd/isatty.c
blob: 46a952e49165e4fe361e029de9fb561c0fbcdfef (plain)
1
2
3
4
5
6
7
8
9
10
#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 (int)(1 + syscall(ioctl, fildes, TIOCGWINSZ, &winsize));
}