summaryrefslogtreecommitdiffstats
path: root/include/stdio.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-02-12 02:50:30 +0000
committerpeter <peter@FreeBSD.org>2001-02-12 02:50:30 +0000
commit06fa9251928cf6d03b94f299b9da94f0b504fbee (patch)
tree42990fbd4d5ef4bda5e2555a6b0df3786cb8686f /include/stdio.h
parent74ebcffc621e62b347e441ee161f014c4f4b0bf7 (diff)
downloadFreeBSD-src-06fa9251928cf6d03b94f299b9da94f0b504fbee.zip
FreeBSD-src-06fa9251928cf6d03b94f299b9da94f0b504fbee.tar.gz
Take advantage of the current libc sizeof(FILE) breakage (__sF[]) and
try a hopefully more robust stdin/stdout/stderr. This costs an indirect pointer fetch, but saves us from changes in 'FILE'. The __stdin stuff is there to not pollute application name space if the application does not use <stdio.h> and also in case something depended on the current behavior where stdin etc was a #define. Reviewed by: eischen, dillon
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 3b1edaa..7551b62 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -132,6 +132,9 @@ typedef struct __sFILE {
__BEGIN_DECLS
extern FILE __sF[];
+extern FILE *__stdin;
+extern FILE *__stdout;
+extern FILE *__stderr;
__END_DECLS
#define __SLBF 0x0001 /* line buffered */
@@ -194,9 +197,9 @@ __END_DECLS
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
-#define stdin (&__sF[0])
-#define stdout (&__sF[1])
-#define stderr (&__sF[2])
+#define stdin (__stdin)
+#define stdout (__stdout)
+#define stderr (__stderr)
/*
* Functions defined in ANSI C standard.
OpenPOWER on IntegriCloud