summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2021-10-24 02:46:24 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2021-10-24 03:09:47 +0200
commitfdf8c183357a1c2892ab100591e257f46cdadd4c (patch)
treebcc245d18214a0574ef46c07bd33731804f06146
parentac37834fe63683619b1a0fa6692f56e419badb5e (diff)
Add conforming interfaces of standard streams
-rw-r--r--libpsx/include/stdio.h2
-rw-r--r--libpsx/src/libc.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/libpsx/include/stdio.h b/libpsx/include/stdio.h
index a790aab..6ffd4e0 100644
--- a/libpsx/include/stdio.h
+++ b/libpsx/include/stdio.h
@@ -72,6 +72,8 @@ typedef struct
unsigned int error;
}FILE;
+extern FILE *const stdin, *const stdout, *const stderr;
+
/* Console functions */
int putchar(int c);
diff --git a/libpsx/src/libc.c b/libpsx/src/libc.c
index 7f0b0f5..55ab413 100644
--- a/libpsx/src/libc.c
+++ b/libpsx/src/libc.c
@@ -26,7 +26,7 @@ static unsigned int __sio_cr_mapped = 0;
#define NUM_OF_FILE_STRUCTS 259
-FILE file_structs[NUM_OF_FILE_STRUCTS] =
+static FILE file_structs[NUM_OF_FILE_STRUCTS] =
{
[0] = // stdin
{
@@ -63,9 +63,9 @@ FILE file_structs[NUM_OF_FILE_STRUCTS] =
},
};
-FILE *stdin = &file_structs[0];
-FILE *stdout = &file_structs[1];
-FILE *stderr = &file_structs[2];
+FILE *const stdin = &file_structs[0];
+FILE *const stdout = &file_structs[1];
+FILE *const stderr = &file_structs[2];
#define IS_CONS_IN(f) (f->fildes == 0)
#define IS_CONS_OUT(f) (f->fildes == 1 || f->fildes == 2)