isatty()

Vincent Rivière vincent.riviere@freesbee.fr
Thu Jan 3 17:09:00 GMT 2008


Jeff Johnston a wrote :
> _isatty is not one of the fundamental syscalls required by newlib.  
> Remember that newlib's historical origin was to support embedded 
> platforms and it only required a small set of syscalls to support the 
> ANSI C plus miscellaneous functions.  There is a rough isatty() 
> implementation in libc/posix that uses fstat, not _isatty.
> 
> Platforms that have wanted it have typically just done so directly in 
> their libgloss implementation or libc/sys (used before libgloss was 
> created) or they use the libc/posix implementation or they use the 
> default libgloss/isatty.c version (always returns 1) or they let 
> libnosys resolve it (always returns 0) just to allow tests to link/run.

I understand.
But there are 2 problems :

1) isatty() is currently fundamental, because without it, a simple 
printf() cannot link !
isatty() is used at the bottom of libc/stdio/makebuf.c

2) The isatty() implementation in libgloss/libnosys/isatty.c uses the 
wrong errno. It should only #include <errno.h>, without #undef errno, 
extern int errno.

-- 
Vincent Rivière



More information about the Newlib mailing list