diff --git a/lib/libc.c b/lib/libc.c index 97565c31..2819468c 100644 --- a/lib/libc.c +++ b/lib/libc.c @@ -424,7 +424,7 @@ sprintf (char *str, char const* format, ...) int isatty (int fd) { - return ioctl (fd, TCGETS, 0) == -14; // MAGIC + return ioctl (fd, TCGETS, 0) & 0xf0; } #endif //!POSIX diff --git a/src/posix.c b/src/posix.c index 2e6b3a8c..f0a020d9 100644 --- a/src/posix.c +++ b/src/posix.c @@ -199,3 +199,9 @@ force_output (SCM p) ///((arity . n)) { return cell_unspecified; } + +SCM +isatty_p (SCM port) +{ + return isatty (VALUE (port)) ? cell_t : cell_f; +}