00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef _STDIO_H_
00045 #define _STDIO_H_
00046
00047 #include <sys/cdefs.h>
00048 #include <sys/_types.h>
00049
00050 typedef __off_t fpos_t;
00051
00052 #ifndef _SIZE_T_DECLARED
00053 typedef __size_t size_t;
00054 #define _SIZE_T_DECLARED
00055 #endif
00056
00057 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
00058 #include <stdarg.h>
00059 typedef va_list __va_list;
00060 #endif
00061
00062 #ifndef NULL
00063 #define NULL 0
00064 #endif
00065
00066 #define _FSTDIO
00067
00068
00069
00070
00071
00072
00073
00074
00075 struct __sbuf {
00076 unsigned char *_base;
00077 int _size;
00078 };
00079
00080
00081 struct __sFILEX;
00082 struct __File_ops;
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 typedef struct __sFILE {
00111 unsigned char *_p;
00112 int _r;
00113 int _w;
00114 short _flags;
00115 short _file;
00116 struct __sbuf _bf;
00117 int _lbfsize;
00118 const struct __File_ops* _ops;
00119
00120 struct __sbuf _ub;
00121 int _ur;
00122 char* _up;
00123 } FILE;
00124
00125 __BEGIN_DECLS
00126 extern FILE *const __stdinp;
00127 extern FILE *const __stdoutp;
00128 extern FILE *const __stderrp;
00129 __END_DECLS
00130
00131 #define __SLBF 0x0001
00132 #define __SNBF 0x0002
00133 #define __SRD 0x0004
00134 #define __SWR 0x0008
00135
00136 #define __SRW 0x0010
00137 #define __SEOF 0x0020
00138 #define __SERR 0x0040
00139 #define __SMBF 0x0080
00140 #define __SAPP 0x0100
00141 #define __SSTR 0x0200
00142 #define __SNPT 0x0800
00143 #define __SALC 0x4000
00144 #define __SIGN 0x8000
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 #define _IOFBF 0
00156 #define _IOLBF 1
00157 #define _IONBF 2
00158
00159 #define BUFSIZ 1024
00160 #define EOF (-1)
00161
00162
00163
00164
00165
00166
00167
00168 #define FOPEN_MAX 20
00169 #define FILENAME_MAX 1024
00170
00171 #ifndef SEEK_SET
00172 #define SEEK_SET 0
00173 #endif
00174 #ifndef SEEK_CUR
00175 #define SEEK_CUR 1
00176 #endif
00177 #ifndef SEEK_END
00178 #define SEEK_END 2
00179 #endif
00180
00181 #define stdin __stdinp
00182 #define stdout __stdoutp
00183 #define stderr __stderrp
00184
00185 __BEGIN_DECLS
00186
00187
00188
00189 void clearerr(FILE *);
00190 int fclose(FILE *);
00191 int feof(FILE *);
00192 int ferror(FILE *);
00193 int fflush(FILE *);
00194 int fgetc(FILE *);
00195 char *fgets(char * __restrict, int, FILE * __restrict);
00196 int fprintf(FILE * __restrict, const char * __restrict, ...);
00197 int fputc(int, FILE *);
00198 int fputs(const char * __restrict, FILE * __restrict);
00199 size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
00200 int fscanf(FILE * __restrict, const char * __restrict, ...);
00201 size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
00202 int getc(FILE *);
00203 int getchar(void);
00204 char *gets(char *);
00205 int printf(const char * __restrict, ...);
00206 int putc(int, FILE *);
00207 int putchar(int);
00208 int puts(const char *);
00209 int scanf(const char * __restrict, ...);
00210 void setbuf(FILE * __restrict, char * __restrict);
00211 int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
00212 int sprintf(char * __restrict, const char * __restrict, ...);
00213 int sscanf(const char * __restrict, const char * __restrict, ...);
00214 int ungetc(int, FILE *);
00215 int vfprintf(FILE * __restrict, const char * __restrict, __va_list);
00216 int vprintf(const char * __restrict, __va_list);
00217 int vsprintf(char * __restrict, const char * __restrict, __va_list);
00218
00219 #if __ISO_C_VISIBLE >= 1999
00220 int snprintf(char * __restrict, size_t, const char * __restrict,
00221 ...) __printflike(3, 4);
00222 int vfscanf(FILE * __restrict, const char * __restrict, __va_list)
00223 __scanflike(2, 0);
00224 int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
00225 int vsnprintf(char * __restrict, size_t, const char * __restrict,
00226 __va_list) __printflike(3, 0);
00227 int vsscanf(const char * __restrict, const char * __restrict, __va_list)
00228 __scanflike(2, 0);
00229 #endif
00230
00231
00232 #if __POSIX_VISIBLE
00233 int fileno(FILE *);
00234 #endif
00235
00236
00237
00238
00239 #if __BSD_VISIBLE
00240 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
00241 #define __ATTR_FORMAT_ARG __attribute__((__format_arg__(2)))
00242 #else
00243 #define __ATTR_FORMAT_ARG
00244 #endif
00245 void setbuffer(FILE *, char *, int);
00246 int setlinebuf(FILE *);
00247
00248
00249
00250
00251 FILE *funopen(const void *,
00252 int (*)(void *, char *, int),
00253 int (*)(void *, const char *, int),
00254 fpos_t (*)(void *, fpos_t, int),
00255 int (*)(void *));
00256 #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
00257 #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
00258
00259 #endif
00260
00261
00262
00263
00264 int __srget(FILE *);
00265 int __swbufc(char, FILE *);
00266
00267
00268
00269
00270
00271 #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
00272 #if defined(__GNUC__) && defined(__STDC__)
00273 extern int __sputc(int _c, FILE *_p);
00274
00275 extern __inline int __sputc(int _c, FILE *_p) {
00276 if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
00277 return (*_p->_p++ = _c);
00278 else
00279 return (__swbufc(_c, _p));
00280 }
00281 #else
00282
00283
00284
00285 #define __sputc(c, p) \
00286 (--(p)->_w < 0 ? \
00287 (p)->_w >= (p)->_lbfsize ? \
00288 (*(p)->_p = (c)), *(p)->_p != '\n' ? \
00289 (int)*(p)->_p++ : \
00290 __swbuf('\n', p) : \
00291 __swbuf((int)(c), p) : \
00292 (*(p)->_p = (c), (int)*(p)->_p++))
00293 #endif
00294
00295 #define __sfeof(p) (((p)->_flags & __SEOF) != 0)
00296 #define __sferror(p) (((p)->_flags & __SERR) != 0)
00297 #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
00298 #define __sfileno(p) ((p)->_file)
00299
00300 __END_DECLS
00301 #endif