chiark / gitweb /
[PATCH] fix bug in klibc's isspace function.
[elogind.git] / klibc / klibc / isatty.c
1 /*
2  * isatty.c
3  */
4
5 #include <unistd.h>
6 #include <termios.h>
7 #include <errno.h>
8
9 int isatty(int fd)
10 {
11   int old_errno = errno;
12   int istty;
13   pid_t dummy;
14
15   /* All ttys support TIOCGPGRP */
16   istty = !ioctl(fd, TIOCGPGRP, &dummy);
17   errno = old_errno;
18
19   return istty;
20 }
21