1#ifndef _STDIO_H
2#define _STDIO_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_FILE
11#define __NEED___isoc_va_list
12#define __NEED_size_t
13
14#if __STDC_VERSION__ < 201112L
15#define __NEED_struct__IO_FILE
16#endif
17
18#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
19 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
20 || defined(_BSD_SOURCE)
21#define __NEED_ssize_t
22#define __NEED_off_t
23#define __NEED_va_list
24#endif
25
26#include <bits/alltypes.h>
27
28#ifdef __cplusplus
29#define NULL 0L
30#else
31#define NULL ((void*)0)
32#endif
33
34#undef EOF
35#define EOF (-1)
36
37#undef SEEK_SET
38#undef SEEK_CUR
39#undef SEEK_END
40#define SEEK_SET 0
41#define SEEK_CUR 1
42#define SEEK_END 2
43
44#define _IOFBF 0
45#define _IOLBF 1
46#define _IONBF 2
47
48#define BUFSIZ 1024
49#define FILENAME_MAX 4096
50#define FOPEN_MAX 1000
51#define TMP_MAX 10000
52#define L_tmpnam 20
53
54typedef union _G_fpos64_t {
55	char __opaque[16];
56	long long __lldata;
57	double __align;
58} fpos_t;
59
60extern FILE *const stdin;
61extern FILE *const stdout;
62extern FILE *const stderr;
63
64#define stdin  (stdin)
65#define stdout (stdout)
66#define stderr (stderr)
67
68FILE *fopen(const char *__restrict, const char *__restrict);
69FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
70int fclose(FILE *);
71
72int remove(const char *);
73int rename(const char *, const char *);
74
75int feof(FILE *);
76int ferror(FILE *);
77int fflush(FILE *);
78void clearerr(FILE *);
79
80int fseek(FILE *, long, int);
81long ftell(FILE *);
82void rewind(FILE *);
83
84int fgetpos(FILE *__restrict, fpos_t *__restrict);
85int fsetpos(FILE *, const fpos_t *);
86
87size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
88size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
89
90int fgetc(FILE *);
91int getc(FILE *);
92int getchar(void);
93int ungetc(int, FILE *);
94
95int fputc(int, FILE *);
96int putc(int, FILE *);
97int putchar(int);
98
99char *fgets(char *__restrict, int, FILE *__restrict);
100#if __STDC_VERSION__ < 201112L
101char *gets(char *);
102#endif
103
104int fputs(const char *__restrict, FILE *__restrict);
105int puts(const char *);
106
107int printf(const char *__restrict, ...);
108int fprintf(FILE *__restrict, const char *__restrict, ...);
109int sprintf(char *__restrict, const char *__restrict, ...);
110int snprintf(char *__restrict, size_t, const char *__restrict, ...);
111
112int vprintf(const char *__restrict, __isoc_va_list);
113int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
114int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
115int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
116
117int scanf(const char *__restrict, ...);
118int fscanf(FILE *__restrict, const char *__restrict, ...);
119int sscanf(const char *__restrict, const char *__restrict, ...);
120int vscanf(const char *__restrict, __isoc_va_list);
121int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
122int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
123
124void perror(const char *);
125
126int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
127void setbuf(FILE *__restrict, char *__restrict);
128
129char *tmpnam(char *);
130FILE *tmpfile(void);
131
132#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
133 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
134 || defined(_BSD_SOURCE)
135FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
136FILE *open_memstream(char **, size_t *);
137FILE *fdopen(int, const char *);
138FILE *popen(const char *, const char *);
139int pclose(FILE *);
140int fileno(FILE *);
141int fseeko(FILE *, off_t, int);
142off_t ftello(FILE *);
143int dprintf(int, const char *__restrict, ...);
144int vdprintf(int, const char *__restrict, __isoc_va_list);
145void flockfile(FILE *);
146int ftrylockfile(FILE *);
147void funlockfile(FILE *);
148int getc_unlocked(FILE *);
149int getchar_unlocked(void);
150int putc_unlocked(int, FILE *);
151int putchar_unlocked(int);
152ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
153ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
154int renameat(int, const char *, int, const char *);
155char *ctermid(char *);
156#define L_ctermid 20
157#endif
158
159
160#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
161 || defined(_BSD_SOURCE)
162#define P_tmpdir "/tmp"
163char *tempnam(const char *, const char *);
164#endif
165
166#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
167#define L_cuserid 20
168char *cuserid(char *);
169void setlinebuf(FILE *);
170void setbuffer(FILE *, char *, size_t);
171int fgetc_unlocked(FILE *);
172int fputc_unlocked(int, FILE *);
173int fflush_unlocked(FILE *);
174size_t fread_unlocked(void *, size_t, size_t, FILE *);
175size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
176void clearerr_unlocked(FILE *);
177int feof_unlocked(FILE *);
178int ferror_unlocked(FILE *);
179int fileno_unlocked(FILE *);
180int getw(FILE *);
181int putw(int, FILE *);
182char *fgetln(FILE *, size_t *);
183int asprintf(char **, const char *, ...);
184int vasprintf(char **, const char *, __isoc_va_list);
185#endif
186
187#ifdef _GNU_SOURCE
188char *fgets_unlocked(char *, int, FILE *);
189int fputs_unlocked(const char *, FILE *);
190
191typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
192typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
193typedef int (cookie_seek_function_t)(void *, off_t *, int);
194typedef int (cookie_close_function_t)(void *);
195
196typedef struct _IO_cookie_io_functions_t {
197	cookie_read_function_t *read;
198	cookie_write_function_t *write;
199	cookie_seek_function_t *seek;
200	cookie_close_function_t *close;
201} cookie_io_functions_t;
202
203FILE *fopencookie(void *, const char *, cookie_io_functions_t);
204#endif
205
206#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
207#define tmpfile64 tmpfile
208#define fopen64 fopen
209#define freopen64 freopen
210#define fseeko64 fseeko
211#define ftello64 ftello
212#define fgetpos64 fgetpos
213#define fsetpos64 fsetpos
214#define fpos64_t fpos_t
215#define off64_t off_t
216#endif
217
218#ifdef __cplusplus
219}
220#endif
221
222#endif
223