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