source: trunk/libs/newlib/src/libgloss/riscv/sys_isatty.c @ 668

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

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

File size: 464 bytes
Line 
1#include <machine/syscall.h>
2#include <sys/stat.h>
3#include "internal_syscall.h"
4
5extern int _fstat(int file, struct stat *st);
6
7/* Query whether output stream is a terminal. For consistency with the
8   other minimal implementations, which only support output to stdout,
9   this minimal implementation is suggested by the newlib docs.  */
10
11int
12_isatty(int file)
13{
14  struct stat s;
15  int ret = _fstat (file, &s);
16  return ret == -1 ? 0 : !!(s.st_mode & S_IFCHR);
17}
Note: See TracBrowser for help on using the repository browser.