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