stdio.h 5.0 KB

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