summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/isatty.c
blob: b3160972083c26bc61e7ec8b310e1d25415d7905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#define ioctl libc_ioctl
#include <termios.h>
#undef ioctl
#include <sys/ioctl.h>

extern int errno;

int isatty(int fd)
{
  int save;
  int is_tty;
  struct termios term;

  save = errno;
  is_tty = ioctl(fd, TCGETS, &term) == 0;
  errno = save;

  return is_tty;
}