-
-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathstdio.h
More file actions
138 lines (88 loc) · 3.38 KB
/
Copy pathstdio.h
File metadata and controls
138 lines (88 loc) · 3.38 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef _STDIO_H
#define _STDIO_H
#include <cdefs.h>
#include <stdarg.h>
#ifdef HAS_CUSTOM_FILE
#include CUSTOM_FILE_FILE
#else /* HAS_CUSTOM_FILE*/
typedef struct
{
unsigned char slot;
unsigned char eof;
unsigned char err;
} FILE;
#define FOPEN_MAX 5
#define stdin ((FILE*)1)
#define stdout ((FILE*)2)
#define stderr ((FILE*)2)
#endif /* HAS_CUSTOM_FILE */
#ifndef EOF
#define EOF (-1)
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
__BEGIN_DECLS
/* weak user-defined functions */
int inchar(void);
void outchar(char character);
void errchar(char character);
FILE *fopen(const char *__restrict filename, const char *__restrict mode);
FILE *freopen(const char *__restrict filename, const char *__restrict mode, FILE *__restrict stream);
int fclose(FILE *stream);
int fflush(FILE *stream);
int ferror(FILE *stream);
int feof(FILE *stream);
void clearerr(FILE *stream);
size_t fread(void *__restrict ptr, size_t size, size_t count, FILE *__restrict stream);
size_t fwrite(const void *__restrict ptr, size_t size, size_t count, FILE *__restrict stream);
long ftell(FILE *stream) __attribute__((__warn_unused_result__));
int fseek(FILE *stream, long offset, int origin);
void rewind(FILE *stream);
int fgetc(FILE *stream);
char *fgets(char *__restrict str, int num, FILE *__restrict stream);
int ungetc(int ch, FILE *stream);
int fputc(int c, FILE *stream);
int fputs(const char *__restrict str, FILE *__restrict stream);
int remove(const char *filename);
int rename(const char *old_filename, const char *new_filename);
int fileno(FILE *stream);
/* standard impls */
int getchar(void);
int putchar(int character);
int puts(const char *str);
int getc(FILE *stream);
int putc(int c, FILE *stream);
int printf(const char *__restrict format, ...)
__attribute__((format(__printf__, 1, 2)));
int vprintf(const char *__restrict format, va_list va)
__attribute__((format(__printf__, 1, 0)));
int sprintf(char *__restrict buffer, const char *__restrict format, ...)
__attribute__((format(__printf__, 2, 3)));
int vsprintf(char *__restrict buffer, const char *__restrict format, va_list va)
__attribute__((format(__printf__, 2, 0)));
int snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
__attribute__((format(__printf__, 3, 4)));
int vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list va)
__attribute__((format(__printf__, 3, 0)));
int fprintf(FILE *__restrict stream, const char *__restrict format, ...)
__attribute__((format(__printf__, 2, 3)));
int vfprintf(FILE *__restrict stream, const char *__restrict format, va_list va)
__attribute__((format(__printf__, 2, 0)));
int asprintf(char **__restrict p_buffer, const char *__restrict format, ...)
__attribute__((format(__printf__, 2, 3))) __attribute__((nonnull(1)));
int vasprintf(char **__restrict p_buffer, const char *__restrict format, va_list va)
__attribute__((format(__printf__, 2, 0))) __attribute__((nonnull(1)));
int sscanf(const char *__restrict buffer, const char *__restrict format, ...)
__attribute__((format(__scanf__, 2, 3)));
int vsscanf(const char *__restrict buffer, const char *__restrict format, va_list va)
__attribute__((format(__scanf__, 2, 0)));
void perror(const char *str);
__END_DECLS
#endif /* _STDIO_H */