Modified fstat and stat to be consistent with isatty in that all three

now pretend that everything is a tty.  This insures that newlib makes
the console output line buffered.
This commit is contained in:
Joel Sherrill
1996-01-17 20:13:01 +00:00
parent 5d3e5399bb
commit 217e398585

View File

@@ -23,22 +23,38 @@
#include <sys/types.h>
#include <sys/stat.h>
int
__fstat(int _fd, struct stat* _sbuf)
/*
* check this newlib bug?:
*
* newlib/libc/stdio/makebuf.c:
*
* 2nd ifdef uses 1024 instead of BUFSIZ
* 2nd check lets fp blksize be 0
* finally look at the malloc
*/
/*
* fstat, stat, and isatty must lie consistently and report that everything
* is a tty or stdout will not be line buffered.
*/
int __fstat(int _fd, struct stat* _sbuf)
{
return -1;
_sbuf->st_mode = S_IFCHR;
#ifdef HAVE_BLKSIZE
_sbuf->st_blksize = 0;
#endif
return 0;
}
int
__isatty(int _fd)
int __isatty(int _fd)
{
return 1;
}
int stat( const char *path, struct stat *buf )
{
/* always fail */
return -1;
return __fstat( 0, buf );
}
int link( const char *existing, const char *new )