stdio.h 5.1 KB

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