diff options
Diffstat (limited to 'newlib/libc/posix/_isatty.c')
-rw-r--r-- | newlib/libc/posix/_isatty.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/newlib/libc/posix/_isatty.c b/newlib/libc/posix/_isatty.c new file mode 100644 index 000000000..7260211ef --- /dev/null +++ b/newlib/libc/posix/_isatty.c @@ -0,0 +1,17 @@ +/* isatty.c */ + +/* Dumb implementation so programs will at least run. */ + +#include <sys/stat.h> + +int +_DEFUN(_isatty, (fd), int fd) +{ + struct stat buf; + + if (fstat (fd, &buf) < 0) + return 0; + if (S_ISCHR (buf.st_mode)) + return 1; + return 0; +} |