]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/isatty.c.patch
Libc-320.tar.gz
[apple/libc.git] / gen / FreeBSD / isatty.c.patch
1 --- isatty.c.orig Thu Jan 31 16:57:29 2002
2 +++ isatty.c Sun May 18 00:50:20 2003
3 @@ -39,14 +39,19 @@
4
5 #include <termios.h>
6 #include <unistd.h>
7 +#include <sys/filio.h>
8 +#include <sys/conf.h>
9
10 int
11 isatty(fd)
12 int fd;
13 {
14 - int retval;
15 + int retval, type;
16 struct termios t;
17
18 - retval = (tcgetattr(fd, &t) != -1);
19 + if(ioctl(fd, FIODTYPE, &type) != -1)
20 + retval = (type == D_TTY);
21 + else
22 + retval = (tcgetattr(fd, &t) != -1);
23 return(retval);
24 }