diff options
-rw-r--r-- | src/include/stdio.h | 18 | ||||
-rw-r--r-- | src/stdio/stderr.c | 8 | ||||
-rw-r--r-- | src/stdio/stdin.c | 8 | ||||
-rw-r--r-- | src/stdio/stdout.c | 8 |
4 files changed, 33 insertions, 9 deletions
diff --git a/src/include/stdio.h b/src/include/stdio.h new file mode 100644 index 00000000..534c6907 --- /dev/null +++ b/src/include/stdio.h @@ -0,0 +1,18 @@ +#ifndef STDIO_H +#define STDIO_H + +#include "../../include/stdio.h" + +#undef stdin +#undef stdout +#undef stderr + +extern hidden FILE __stdin_FILE; +extern hidden FILE __stdout_FILE; +extern hidden FILE __stderr_FILE; + +#define stdin (&__stdin_FILE) +#define stdout (&__stdout_FILE) +#define stderr (&__stderr_FILE) + +#endif diff --git a/src/stdio/stderr.c b/src/stdio/stderr.c index 229c8651..f2bc4648 100644 --- a/src/stdio/stderr.c +++ b/src/stdio/stderr.c @@ -1,7 +1,9 @@ #include "stdio_impl.h" +#undef stderr + static unsigned char buf[UNGET]; -static FILE f = { +hidden FILE __stderr_FILE = { .buf = buf+UNGET, .buf_size = 0, .fd = 2, @@ -12,5 +14,5 @@ static FILE f = { .close = __stdio_close, .lock = -1, }; -FILE *const stderr = &f; -FILE *volatile __stderr_used = &f; +FILE *const stderr = &__stderr_FILE; +FILE *volatile __stderr_used = &__stderr_FILE; diff --git a/src/stdio/stdin.c b/src/stdio/stdin.c index 171ff22a..5aa5262c 100644 --- a/src/stdio/stdin.c +++ b/src/stdio/stdin.c @@ -1,7 +1,9 @@ #include "stdio_impl.h" +#undef stdin + static unsigned char buf[BUFSIZ+UNGET]; -static FILE f = { +hidden FILE __stdin_FILE = { .buf = buf+UNGET, .buf_size = sizeof buf-UNGET, .fd = 0, @@ -11,5 +13,5 @@ static FILE f = { .close = __stdio_close, .lock = -1, }; -FILE *const stdin = &f; -FILE *volatile __stdin_used = &f; +FILE *const stdin = &__stdin_FILE; +FILE *volatile __stdin_used = &__stdin_FILE; diff --git a/src/stdio/stdout.c b/src/stdio/stdout.c index 6b188942..4985a417 100644 --- a/src/stdio/stdout.c +++ b/src/stdio/stdout.c @@ -1,7 +1,9 @@ #include "stdio_impl.h" +#undef stdout + static unsigned char buf[BUFSIZ+UNGET]; -static FILE f = { +hidden FILE __stdout_FILE = { .buf = buf+UNGET, .buf_size = sizeof buf-UNGET, .fd = 1, @@ -12,5 +14,5 @@ static FILE f = { .close = __stdio_close, .lock = -1, }; -FILE *const stdout = &f; -FILE *volatile __stdout_used = &f; +FILE *const stdout = &__stdout_FILE; +FILE *volatile __stdout_used = &__stdout_FILE; |