summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-12-12 17:31:23 +0000
committerEric Andersen <andersen@codepoet.org>2000-12-12 17:31:23 +0000
commit469cdfc504836ec2e6ac4cfc8cc0a388dac149a4 (patch)
tree4e4db87c9b33cb2b851f05865e148e231b1efcb0 /libc/stdio/stdio.c
parent778e928992a8ba8334c34680e501f76d2ef2f868 (diff)
A few cleanups. Fix fflush so it remembers to init stdio.
Diffstat (limited to 'libc/stdio/stdio.c')
-rw-r--r--libc/stdio/stdio.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index f6fecd9c5..fbec9d5a9 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -28,7 +28,7 @@
#undef STUB_FWRITE
-void __io_init_vars(void);
+void __init_stdio(void);
extern FILE *__IO_list; /* For fflush at exit */
@@ -40,8 +40,6 @@ struct fixed_buffer {
extern struct fixed_buffer _fixed_buffers[2];
-#define Inline_init __io_init_vars()
-
#ifdef L__stdio_init
#define buferr (stderr->unbuf) /* Stderr is unbuffered */
@@ -103,7 +101,7 @@ static int first_time = 0;
struct fixed_buffer _fixed_buffers[2];
-void __io_init_vars(void)
+void __init_stdio(void)
{
if (first_time)
return;
@@ -154,7 +152,7 @@ FILE *fp;
{
register int v;
- Inline_init;
+ __init_stdio();
v = fp->mode;
/* If last op was a read ... */
@@ -201,7 +199,7 @@ FILE *fp;
{
int ch;
- Inline_init;
+ __init_stdio();
if (fp->mode & __MODE_WRITING)
fflush(fp);
@@ -245,6 +243,8 @@ FILE *fp;
int len, cc, rv = 0;
char *bstart;
+ __init_stdio();
+
if (fp == NULL) { /* On NULL flush the lot. */
if (fflush(stdin))
return EOF;
@@ -406,7 +406,7 @@ FILE *fp;
int len, v;
unsigned bytes, got = 0;
- Inline_init;
+ __init_stdio();
v = fp->mode;
@@ -611,7 +611,7 @@ const char *mode;
int fopen_mode = 0;
FILE *nfp = 0;
- Inline_init;
+ __init_stdio();
/* If we've got an fp close the old one (freopen) */
if (fp) {
@@ -733,6 +733,8 @@ FILE *fp;
{
int rv = 0;
+ __init_stdio();
+
if (fp == 0) {
errno = EINVAL;
return EOF;