16f7c2dc6SAxel Dörfler /* 26f7c2dc6SAxel Dörfler ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3b6f76ebeSAugustin Cavalier ** Distributed under the terms of the MIT License. 46f7c2dc6SAxel Dörfler */ 56f7c2dc6SAxel Dörfler #ifndef _STDIO_H_ 66f7c2dc6SAxel Dörfler #define _STDIO_H_ 76f7c2dc6SAxel Dörfler // must match the one of the real stdio.h 86f7c2dc6SAxel Dörfler 96f7c2dc6SAxel Dörfler #include <stdarg.h> 106f7c2dc6SAxel Dörfler 11189156a0SJérôme Duval typedef off_t fpos_t; 12189156a0SJérôme Duval 136f7c2dc6SAxel Dörfler #ifdef __cplusplus 146f7c2dc6SAxel Dörfler extern "C" { 156f7c2dc6SAxel Dörfler #endif 166f7c2dc6SAxel Dörfler 176f7c2dc6SAxel Dörfler typedef struct FILE FILE; 186f7c2dc6SAxel Dörfler // dummy definition of FILE 196f7c2dc6SAxel Dörfler // In the boot loader, it really is a ConsoleNode 206f7c2dc6SAxel Dörfler 216f7c2dc6SAxel Dörfler extern FILE *stdin; 226f7c2dc6SAxel Dörfler extern FILE *stdout; 236f7c2dc6SAxel Dörfler extern FILE *stderr; 246f7c2dc6SAxel Dörfler 256f7c2dc6SAxel Dörfler #ifndef SEEK_SET 266f7c2dc6SAxel Dörfler # define SEEK_SET 0 276f7c2dc6SAxel Dörfler #endif 286f7c2dc6SAxel Dörfler #ifndef SEEK_CUR 296f7c2dc6SAxel Dörfler # define SEEK_CUR 1 306f7c2dc6SAxel Dörfler #endif 316f7c2dc6SAxel Dörfler #ifndef SEEK_END 326f7c2dc6SAxel Dörfler # define SEEK_END 2 336f7c2dc6SAxel Dörfler #endif 346f7c2dc6SAxel Dörfler 35*f1d43776SAdrien Destugues #ifndef EOF 36*f1d43776SAdrien Destugues # define EOF (-1) 37*f1d43776SAdrien Destugues #endif 386f7c2dc6SAxel Dörfler 396f7c2dc6SAxel Dörfler #define __PRINTFLIKE(a, b) 406f7c2dc6SAxel Dörfler 416f7c2dc6SAxel Dörfler extern int printf(char const *format, ...) __PRINTFLIKE(1,2); 426f7c2dc6SAxel Dörfler extern int fprintf(FILE *stream, char const *format, ...) __PRINTFLIKE(2,3); 436f7c2dc6SAxel Dörfler extern int sprintf(char *str, char const *format, ...) __PRINTFLIKE(2,3); 446f7c2dc6SAxel Dörfler extern int snprintf(char *str, size_t size, char const *format, ...) __PRINTFLIKE(3,4); 456f7c2dc6SAxel Dörfler extern int asprintf(char **ret, char const *format, ...) __PRINTFLIKE(2,3); 466f7c2dc6SAxel Dörfler extern int vprintf(char const *format, va_list ap); 476f7c2dc6SAxel Dörfler extern int vfprintf(FILE *stream, char const *format, va_list ap); 486f7c2dc6SAxel Dörfler extern int vsprintf(char *str, char const *format, va_list ap); 496f7c2dc6SAxel Dörfler extern int vsnprintf(char *str, size_t size, char const *format, va_list ap); 506f7c2dc6SAxel Dörfler extern int vasprintf(char **ret, char const *format, va_list ap); 516f7c2dc6SAxel Dörfler 526f7c2dc6SAxel Dörfler // ToDo: not everything is or should be implemented here 53189156a0SJérôme Duval extern void clearerr(FILE *stream); 54189156a0SJérôme Duval extern int fclose(FILE *stream); 55189156a0SJérôme Duval extern int feof(FILE *stream); 56189156a0SJérôme Duval extern int ferror(FILE *stream); 57189156a0SJérôme Duval extern int fflush(FILE *stream); 58189156a0SJérôme Duval extern int fgetpos(FILE *stream, fpos_t *position); 59189156a0SJérôme Duval extern FILE *fopen(const char *name, const char *mode); 60189156a0SJérôme Duval extern size_t fread(void *buffer, size_t size, size_t numItems, FILE *stream); 61189156a0SJérôme Duval extern FILE *freopen(const char *name, const char *mode, FILE *stream); 62189156a0SJérôme Duval extern int fscanf(FILE *stream, char const *format, ...); 63189156a0SJérôme Duval extern int fseek(FILE *stream, long offset, int seekType); 64189156a0SJérôme Duval extern int fsetpos(FILE *stream, const fpos_t *position); 65189156a0SJérôme Duval extern long ftell(FILE *stream); 66189156a0SJérôme Duval extern size_t fwrite(const void *buffer, size_t size, size_t numItems, FILE *stream); 67189156a0SJérôme Duval extern void perror(const char *errorPrefix); 68189156a0SJérôme Duval extern int rename(const char *from, const char *to); 69189156a0SJérôme Duval extern void rewind(FILE *stream); 70189156a0SJérôme Duval extern int scanf(char const *format, ...); 71189156a0SJérôme Duval extern void setbuf (FILE *file, char *buff); 72189156a0SJérôme Duval extern int setvbuf(FILE *file, char *buff, int mode, size_t size); 73189156a0SJérôme Duval extern int sscanf(char const *str, char const *format, ...); 74189156a0SJérôme Duval extern FILE *tmpfile(void); 75d2f7af0eSAugustin Cavalier extern char *tmpnam(char *nameBuffer); 76189156a0SJérôme Duval extern int ungetc(int c, FILE *stream); 77189156a0SJérôme Duval extern int vscanf(char const *format, va_list ap); 78189156a0SJérôme Duval extern int vsscanf(char const *str, char const *format, va_list ap); 79189156a0SJérôme Duval extern int vfscanf(FILE *stream, char const *format, va_list ap); 80189156a0SJérôme Duval 816f7c2dc6SAxel Dörfler extern int fgetc(FILE *); 826f7c2dc6SAxel Dörfler extern char *fgets(char *, int, FILE *); 836f7c2dc6SAxel Dörfler extern int fputc(int, FILE *); 846f7c2dc6SAxel Dörfler extern int fputs(const char *, FILE*); 856f7c2dc6SAxel Dörfler extern int getc(FILE *); 86d2f7af0eSAugustin Cavalier extern char *gets(char *); 876f7c2dc6SAxel Dörfler extern int getw(FILE *); 886f7c2dc6SAxel Dörfler extern int getchar(void); 896f7c2dc6SAxel Dörfler extern int putc(int, FILE *); 906f7c2dc6SAxel Dörfler extern int putchar(int); 916f7c2dc6SAxel Dörfler extern int puts(const char *); 926f7c2dc6SAxel Dörfler extern int putw(int, FILE *); 936f7c2dc6SAxel Dörfler 946f7c2dc6SAxel Dörfler #ifdef __cplusplus 956f7c2dc6SAxel Dörfler } 966f7c2dc6SAxel Dörfler #endif 976f7c2dc6SAxel Dörfler 986f7c2dc6SAxel Dörfler #endif /* _STDIO_H_ */ 99