1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
46:
47: 48: 49: 50:
51:
52: #ifndef __STDIO_H__
53: #define __STDIO_H__
54:
55: #include <stdtype.h>
56: #include <stdarg.h>
57: #include <stdint.h>
58: #include <errno.h>
59: #include <tk/typedef.h>
60: #include <sys/types.h>
61:
62: typedef struct _FILE {
63: int opaque[23];
64: } FILE;
65:
66: typedef off_t fpos_t;
67: typedef off64_t fpos64_t;
68:
69: #define EOF (-1)
70:
71: #define _IOFBF 0
72: #define _IOLBF 1
73: #define _IONBF 2
74:
75: #define BUFSIZ 1024
76: #define FILENAME_MAX 256
77:
78: #define TMP_MAX 25
79: #define L_tmpnam 16
80:
81: #define SEEK_SET 0
82: #define SEEK_CUR 1
83: #define SEEK_END 2
84:
85: #if 1
86: IMPORT FILE __sF[];
87: #define stdin (&__sF[0])
88: #define stdout (&__sF[1])
89: #define stderr (&__sF[2])
90: #else
91: IMPORT FILE *__stdin, *__stdout, *__stderr;
92: #define stdin __stdin
93: #define stdout __stdout
94: #define stderr __stderr
95: #endif
96:
97: #ifdef __cplusplus
98: extern "C" {
99: #endif
100:
101:
102: IMPORT FILE *fopen(const char *path, const char *mode);
103: IMPORT FILE *fopen_eno(const char *path, const char *mode, errno_t *eno);
104: IMPORT FILE *freopen(const char *path, const char *mode, FILE *stream);
105: IMPORT FILE *freopen_eno(const char *path, const char *mode, FILE *stream, errno_t *eno);
106: IMPORT int fclose(FILE *stream);
107: IMPORT int fclose_eno(FILE *stream, errno_t *eno);
108: IMPORT int fflush(FILE *stream);
109: IMPORT void setbuf(FILE *stream, char *buf);
110: IMPORT int setvbuf(FILE *stream, char *buf, int mode, size_t size);
111:
112:
113: IMPORT int fileno(FILE *stream);
114: IMPORT FILE *fdopen(int fd, const char *mode);
115: IMPORT FILE *fdopen_eno(int fd, const char *mode, errno_t *eno);
116:
117:
118: IMPORT int fputc(int c, FILE *stream);
119: #define putc(c, fp) fputc(c, fp)
120: #define putchar(c) fputc(c, stdout)
121: IMPORT int fputs(const char *s, FILE *stream);
122: IMPORT int puts(const char *s);
123: IMPORT int fgetc(FILE *stream);
124: #define getc(fp) fgetc(fp)
125: #define getchar() fgetc(stdin)
126: IMPORT char *fgets(char *s, int size, FILE *stream);
127: IMPORT int ungetc(int c, FILE *stream);
128:
129:
130: IMPORT size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
131: IMPORT size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
132:
133:
134: IMPORT int fseek(FILE *stream, off_t offset, int whence);
135: IMPORT int fseek64(FILE *stream, off64_t offset, int whence);
136: IMPORT int fgetpos(FILE *stream, fpos_t *pos);
137: IMPORT int fgetpos64(FILE *stream, fpos64_t *pos);
138: IMPORT int fsetpos(FILE *stream, const fpos_t *pos);
139: IMPORT int fsetpos64(FILE *stream, const fpos64_t *pos);
140: IMPORT long ftell(FILE *stream);
141: IMPORT int64_t ftell64(FILE *stream);
142: IMPORT void rewind(FILE *stream);
143:
144:
145: IMPORT void clearerr(FILE *stream);
146: IMPORT int feof(FILE *stream);
147: IMPORT errno_t ferror(FILE *stream);
148:
149:
150: IMPORT ER libc_stdio_init(void);
151: IMPORT ER libc_stdio_cleanup(void);
152:
153:
154: IMPORT int fprintf(FILE *stream, const char *format, ...);
155: IMPORT int printf(const char *format, ...);
156: IMPORT int snprintf(char *str, size_t size, const char *format, ...);
157: IMPORT int sprintf(char *str, const char *format, ...);
158: IMPORT int vfprintf(FILE *stream, const char *format, va_list ap);
159: IMPORT int vprintf(const char *format, va_list ap);
160: IMPORT int vsnprintf(char *str, size_t size, const char *format, va_list ap);
161: IMPORT int vsprintf(char *str, const char *format, va_list ap);
162: IMPORT int fscanf(FILE *stream, const char *format, ...);
163: IMPORT int scanf(const char *format, ...);
164: IMPORT int sscanf(const char *str, const char *format, ...);
165: IMPORT int vfscanf(FILE *stream, const char *format, va_list ap);
166: IMPORT int vscanf(const char *format, va_list ap);
167: IMPORT int vsscanf(const char *str, const char *format, va_list ap);
168:
169: #ifdef __cplusplus
170: }
171: #endif
172: #endif
173: