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