diff options
author | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-02-18 16:48:11 +0000 |
---|---|---|
committer | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-02-18 16:48:11 +0000 |
commit | 8182e7cfe7d9c60567e48b876282594395062530 (patch) | |
tree | bb743948c6e926539b030102b804b5708222e8d4 /mdk-stage1/dietlibc/libstdio/fflush.c | |
parent | c93f95560d3fde9eaefcc62c454c67b8b5626fa7 (diff) | |
download | drakx-8182e7cfe7d9c60567e48b876282594395062530.tar drakx-8182e7cfe7d9c60567e48b876282594395062530.tar.gz drakx-8182e7cfe7d9c60567e48b876282594395062530.tar.bz2 drakx-8182e7cfe7d9c60567e48b876282594395062530.tar.xz drakx-8182e7cfe7d9c60567e48b876282594395062530.zip |
Merge in CVS dietlibc 0.21 for IA-64 and X86-64 support. However, drop the
following architectures we currently don't support: arm, mips, mipsel, parisc,
s390, sparc64.
Diffstat (limited to 'mdk-stage1/dietlibc/libstdio/fflush.c')
-rw-r--r-- | mdk-stage1/dietlibc/libstdio/fflush.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/mdk-stage1/dietlibc/libstdio/fflush.c b/mdk-stage1/dietlibc/libstdio/fflush.c index 7078e04f4..6f2003702 100644 --- a/mdk-stage1/dietlibc/libstdio/fflush.c +++ b/mdk-stage1/dietlibc/libstdio/fflush.c @@ -1,21 +1,16 @@ -#include "dietstdio.h" #include <unistd.h> #include <stdlib.h> #include "dietwarning.h" +#include "dietstdio.h" FILE *__stdio_root; -#ifdef WANT_BUFFERED_STDIO int __stdio_atexit=0; -void __stdio_flushall() { +void __stdio_flushall(void) { fflush(0); } -extern int __fflush_stdin(); -extern int __fflush_stdout(); -extern int __fflush_stderr(); - int fflush(FILE *stream) { if (stream==0) { int res; @@ -28,15 +23,20 @@ int fflush(FILE *stream) { res=-1; return res; } +// if (stream->flags&NOBUF) return 0; if (stream->flags&BUFINPUT) { register int tmp; - if ((tmp=stream->bm-stream->bs)) lseek(stream->fd,tmp,SEEK_CUR); - } else - if (stream->bm && write(stream->fd,stream->buf,stream->bm)!=stream->bm) { + if ((tmp=stream->bm-stream->bs)) { + lseek(stream->fd,tmp,SEEK_CUR); + } + stream->bs=stream->bm=0; + } else { + if (stream->bm && write(stream->fd,stream->buf,stream->bm)!=(int)stream->bm) { stream->flags|=ERRORINDICATOR; return -1; } - stream->bm=0; + stream->bm=0; + } return 0; } @@ -50,13 +50,15 @@ int __fflush4(FILE *stream,int next) { stream->flags=(stream->flags&~BUFINPUT)|next; return res; } + if (stream->fd==0) __fflush_stdout(); return 0; } -#else -int fflush(FILE *stream) { - return 0; +/* Internal function, has no prototype. + * This is defined here because of the weak symbol ELF semantics */ +int __stdio_outs(const char *s,size_t len); +int __stdio_outs(const char *s,size_t len) { + return fwrite(s,1,(size_t)len,stdout); } -#endif -link_warning("fflush","warning: your code uses stdio (several kilobytes of bloat).") +link_warning("fflush","warning: your code uses stdio (7+k bloat).") |