summaryrefslogtreecommitdiff
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
parent778e928992a8ba8334c34680e501f76d2ef2f868 (diff)
A few cleanups. Fix fflush so it remembers to init stdio.
-rw-r--r--include/features.h5
-rw-r--r--include/stdlib.h6
-rw-r--r--libc/stdio/stdio.c18
3 files changed, 18 insertions, 11 deletions
diff --git a/include/features.h b/include/features.h
index 5a3a25e57..44a4f55ac 100644
--- a/include/features.h
+++ b/include/features.h
@@ -55,6 +55,11 @@
#define __USE_POSIX2
#define __USE_XOPEN
+#undef __KERNEL_STRICT_NAMES
+#ifndef _LOOSE_KERNEL_NAMES
+# define __KERNEL_STRICT_NAMES
+#endif
+
#include <sys/cdefs.h>
diff --git a/include/stdlib.h b/include/stdlib.h
index 581c8cce7..20261bdc1 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,11 +1,11 @@
/* stdlib.h */
+#ifndef __STDLIB_H
+#define __STDLIB_H
+
#include <features.h>
#include <sys/types.h>
#include <limits.h>
-#ifndef __STDLIB_H
-#define __STDLIB_H
-
/* Don't overwrite user definitions of NULL */
#ifndef NULL
#define NULL ((void *) 0)
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;