1
0

stdio.h 5.6 KB

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