From 217e398585984539142aca07b977915968cb9593 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 17 Jan 1996 20:13:01 +0000 Subject: 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. --- c/src/lib/libc/syscalls.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'c') diff --git a/c/src/lib/libc/syscalls.c b/c/src/lib/libc/syscalls.c index 1b70ea8d11..1ffd586d79 100644 --- a/c/src/lib/libc/syscalls.c +++ b/c/src/lib/libc/syscalls.c @@ -23,22 +23,38 @@ #include #include -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 ) -- cgit v1.2.3