#include <features.h>
#define __NEED_FILE
-#define __NEED_va_list
+#define __NEED___isoc_va_list
#define __NEED_size_t
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|| defined(_BSD_SOURCE)
#define __NEED_ssize_t
#define __NEED_off_t
+#define __NEED_va_list
#endif
#include <bits/alltypes.h>
-#undef NULL
-#ifdef __cplusplus
-#define NULL 0
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
#else
#define NULL ((void*)0)
#endif
#define _IONBF 2
#define BUFSIZ 1024
-#define FILENAME_MAX 4095
+#define FILENAME_MAX 4096
#define FOPEN_MAX 1000
#define TMP_MAX 10000
#define L_tmpnam 20
-typedef union {
+typedef union _G_fpos64_t {
char __opaque[16];
+ long long __lldata;
double __align;
} fpos_t;
int sprintf(char *__restrict, const char *__restrict, ...);
int snprintf(char *__restrict, size_t, const char *__restrict, ...);
-int vprintf(const char *__restrict, va_list);
-int vfprintf(FILE *__restrict, const char *__restrict, va_list);
-int vsprintf(char *__restrict, const char *__restrict, va_list);
-int vsnprintf(char *__restrict, size_t, const char *__restrict, va_list);
+int vprintf(const char *__restrict, __isoc_va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
int scanf(const char *__restrict, ...);
int fscanf(FILE *__restrict, const char *__restrict, ...);
int sscanf(const char *__restrict, const char *__restrict, ...);
-int vscanf(const char *__restrict, va_list);
-int vfscanf(FILE *__restrict, const char *__restrict, va_list);
-int vsscanf(const char *__restrict, const char *__restrict, va_list);
+int vscanf(const char *__restrict, __isoc_va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
void perror(const char *);
int fseeko(FILE *, off_t, int);
off_t ftello(FILE *);
int dprintf(int, const char *__restrict, ...);
-int vdprintf(int, const char *__restrict, va_list);
+int vdprintf(int, const char *__restrict, __isoc_va_list);
void flockfile(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
int fileno_unlocked(FILE *);
int getw(FILE *);
int putw(int, FILE *);
-#endif
-
-#ifdef _BSD_SOURCE
char *fgetln(FILE *, size_t *);
+int asprintf(char **, const char *, ...);
+int vasprintf(char **, const char *, __isoc_va_list);
#endif
#ifdef _GNU_SOURCE
-int asprintf(char **, const char *, ...);
-int vasprintf(char **, const char *, va_list);
char *fgets_unlocked(char *, int, FILE *);
int fputs_unlocked(const char *, FILE *);
+
+typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
+typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
+typedef int (cookie_seek_function_t)(void *, off_t *, int);
+typedef int (cookie_close_function_t)(void *);
+
+typedef struct _IO_cookie_io_functions_t {
+ cookie_read_function_t *read;
+ cookie_write_function_t *write;
+ cookie_seek_function_t *seek;
+ cookie_close_function_t *close;
+} cookie_io_functions_t;
+
+FILE *fopencookie(void *, const char *, cookie_io_functions_t);
#endif
-#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#if defined(_LARGEFILE64_SOURCE)
#define tmpfile64 tmpfile
#define fopen64 fopen
#define freopen64 freopen