7441cae4a58017542c3c51e86a8a2b551a56dd1f
[musl] / include / stdio.h
1 #ifndef _STDIO_H
2 #define _STDIO_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #define __NEED_FILE
9 #define __NEED_va_list
10 #define __NEED_size_t
11
12 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
13  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
14 #define __NEED_ssize_t
15 #define __NEED_off_t
16 #endif
17
18 #include <bits/alltypes.h>
19
20 #undef NULL
21 #ifdef __cplusplus
22 #define NULL 0
23 #else
24 #define NULL ((void*)0)
25 #endif
26
27 #undef EOF
28 #define EOF (-1)
29
30 #undef SEEK_SET
31 #undef SEEK_CUR
32 #undef SEEK_END
33 #define SEEK_SET 0
34 #define SEEK_CUR 1
35 #define SEEK_END 2
36
37 #define _IOFBF 0
38 #define _IOLBF 1
39 #define _IONBF 2
40
41 #include <bits/stdio.h>
42
43 typedef union {
44         char __opaque[16];
45         double __align;
46 } fpos_t;
47
48 extern FILE *const stdin;
49 extern FILE *const stdout;
50 extern FILE *const stderr;
51
52 #define stdin  (stdin)
53 #define stdout (stdout)
54 #define stderr (stderr)
55
56 FILE *fopen(const char *, const char *);
57 FILE *freopen(const char *, const char *, FILE *);
58 int fclose(FILE *);
59
60 int remove(const char *);
61 int rename(const char *, const char *);
62
63 int feof(FILE *);
64 int ferror(FILE *);
65 int fflush(FILE *);
66 void clearerr(FILE *);
67
68 int fseek(FILE *, long, int);
69 long ftell(FILE *);
70 void rewind(FILE *);
71
72 int fgetpos(FILE *, fpos_t *);
73 int fsetpos(FILE *, const fpos_t *);
74
75 size_t fread(void *, size_t, size_t, FILE *);
76 size_t fwrite(const void *, size_t, size_t, FILE *);
77
78 int fgetc(FILE *);
79 int getc(FILE *);
80 int getchar(void);
81 int ungetc(int, FILE *);
82
83 int fputc(int, FILE *);
84 int putc(int, FILE *);
85 int putchar(int);
86
87 char *fgets(char *, int, FILE *);
88 char *gets(char *);
89
90 int fputs(const char *, FILE *);
91 int puts(const char *);
92
93 int printf(const char *, ...);
94 int fprintf(FILE *, const char *, ...);
95 int sprintf(char *, const char *, ...);
96 int snprintf(char *, size_t, const char *, ...);
97
98 int vprintf(const char *, va_list);
99 int vfprintf(FILE *, const char *, va_list);
100 int vsprintf(char *, const char *, va_list);
101 int vsnprintf(char *, size_t, const char *, va_list);
102
103 int scanf(const char *, ...);
104 int fscanf(FILE *, const char *, ...);
105 int sscanf(const char *, const char *, ...);
106 int vscanf(const char *, va_list);
107 int vfscanf(FILE *, const char *, va_list);
108 int vsscanf(const char *, const char *, va_list);
109
110 void perror(const char *);
111
112 int setvbuf(FILE *, char *, int, size_t);
113 void setbuf(FILE *, char *);
114
115 char *tmpnam(char *);
116 FILE *tmpfile(void);
117
118 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
119  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
120 FILE *fdopen(int, const char *);
121 FILE *popen(const char *, const char *);
122 int pclose(FILE *);
123 int fileno(FILE *);
124 int fseeko(FILE *, off_t, int);
125 off_t ftello(FILE *);
126 int dprintf(int, const char *, ...);
127 int vdprintf(int, const char *, va_list);
128 void flockfile(FILE *);
129 int ftrylockfile(FILE *);
130 void funlockfile(FILE *);
131 int getc_unlocked(FILE *);
132 int getchar_unlocked(void);
133 int putc_unlocked(int, FILE *);
134 int putchar_unlocked(int);
135 ssize_t getdelim(char **, size_t *, int, FILE *);
136 ssize_t getline(char **, size_t *, FILE *);
137 int renameat(int, const char *, int, const char *);
138 char *ctermid(char *);
139 #endif
140
141
142 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
143 char *tempnam(const char *, const char *);
144 #endif
145
146 #if defined(_GNU_SOURCE)
147 #undef off64_t
148 #define off64_t off_t
149 #endif
150
151 #ifdef __cplusplus
152 }
153 #endif
154
155 #endif