stdio.h 5.4 KB

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