Add conforming interfaces of standard streams

This commit is contained in:
Xavier Del Campo Romero 2021-10-24 02:46:24 +02:00
parent ac37834fe6
commit fdf8c18335
2 changed files with 6 additions and 4 deletions

View File

@ -72,6 +72,8 @@ typedef struct
unsigned int error; unsigned int error;
}FILE; }FILE;
extern FILE *const stdin, *const stdout, *const stderr;
/* Console functions */ /* Console functions */
int putchar(int c); int putchar(int c);

View File

@ -26,7 +26,7 @@ static unsigned int __sio_cr_mapped = 0;
#define NUM_OF_FILE_STRUCTS 259 #define NUM_OF_FILE_STRUCTS 259
FILE file_structs[NUM_OF_FILE_STRUCTS] = static FILE file_structs[NUM_OF_FILE_STRUCTS] =
{ {
[0] = // stdin [0] = // stdin
{ {
@ -63,9 +63,9 @@ FILE file_structs[NUM_OF_FILE_STRUCTS] =
}, },
}; };
FILE *stdin = &file_structs[0]; FILE *const stdin = &file_structs[0];
FILE *stdout = &file_structs[1]; FILE *const stdout = &file_structs[1];
FILE *stderr = &file_structs[2]; FILE *const stderr = &file_structs[2];
#define IS_CONS_IN(f) (f->fildes == 0) #define IS_CONS_IN(f) (f->fildes == 0)
#define IS_CONS_OUT(f) (f->fildes == 1 || f->fildes == 2) #define IS_CONS_OUT(f) (f->fildes == 1 || f->fildes == 2)