source: trunk/libs/newlib/src/newlib/libc/posix/_isatty.c @ 577

Last change on this file since 577 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 302 bytes
Line 
1/* isatty.c */
2
3/* Dumb implementation so programs will at least run.  */
4
5#include <sys/stat.h>
6#include <errno.h>
7
8int
9_isatty (int fd)
10{
11  struct stat buf;
12
13  if (fstat (fd, &buf) < 0) {
14    errno = EBADF;
15    return 0;
16  }
17  if (S_ISCHR (buf.st_mode))
18    return 1;
19  errno = ENOTTY;
20  return 0;
21}
Note: See TracBrowser for help on using the repository browser.