summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2001-01-17 17:40:47 +0000
committerManuel Novoa III <mjn3@codepoet.org>2001-01-17 17:40:47 +0000
commit8960c2a5edce96b5ea8e6db942b73e6649441f90 (patch)
tree297d8e5eef1e9dd32db299577808ee3a77623d8c /libc/stdio/stdio.c
parentbb303cab91a164b972dfeca589c2092d874defdf (diff)
Fix static buffer used initialization for FIXED_BUFFERS > 2.
Diffstat (limited to 'libc/stdio/stdio.c')
-rw-r--r--libc/stdio/stdio.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index 32f4b925b..840bcf6ec 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -33,7 +33,7 @@ extern FILE *__IO_list; /* For fflush at exit */
#define FIXED_BUFFERS 2
struct fixed_buffer {
unsigned char data[BUFSIZ];
- int used;
+ unsigned char used;
};
extern struct fixed_buffer _fixed_buffers[FIXED_BUFFERS];
@@ -96,7 +96,7 @@ FILE _stdio_streams[3] = {
};
/*
- * Note: the following forces lining of the __init_stdio function if
+ * Note: the following forces linking of the __init_stdio function if
* any of the stdio functions are used (except perror) since they all
* call fflush directly or indirectly.
*/
@@ -121,13 +121,22 @@ void __stdio_close_all(void)
void __init_stdio(void)
{
+#if FIXED_BUFFERS > 2
+ int i;
+
+ for ( i = 2 ; i < FIXED_BUFFERS ; i++ ) {
+ _fixed_buffers[i].used = 0;
+ }
+#endif
+
_fixed_buffers[0].used = 1;
_fixed_buffers[1].used = 1;
- if (isatty(1))
+ if (isatty(1)) {
stdout->mode |= _IOLBF;
+ }
#if 0
- /* taken care of in _start.c and exit.c now*/
+ /* Taken care of in _start.S and atexit.c now. */
atexit(__stdio_close_all);
#endif
}