stdio.h 5.1 KB

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