#ifndef _STDIO_H_
#define _STDIO_H_
#include <_types.h>
#ifndef _VA_LIST
#define _VA_LIST
typedef __darwin_va_list va_list;
#endif
#ifndef _OFF_T
#define _OFF_T
typedef __darwin_off_t off_t;
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef __darwin_size_t size_t;
#endif
#ifndef NULL
#define NULL __DARWIN_NULL
#endif
typedef __darwin_off_t fpos_t;
#define _FSTDIO
struct __sbuf {
unsigned char *_base;
int _size;
};
struct __sFILEX;
typedef struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void *_cookie;
int (*_close)(void *);
int (*_read) (void *, char *, int);
fpos_t (*_seek) (void *, fpos_t, int);
int (*_write)(void *, const char *, int);
struct __sbuf _ub;
struct __sFILEX *_extra;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
fpos_t _offset;
} FILE;
__BEGIN_DECLS
#if __DARWIN_UNIX03
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
#else
extern FILE __sF[];
#endif
__END_DECLS
#define __SLBF 0x0001
#define __SNBF 0x0002
#define __SRD 0x0004
#define __SWR 0x0008
#define __SRW 0x0010
#define __SEOF 0x0020
#define __SERR 0x0040
#define __SMBF 0x0080
#define __SAPP 0x0100
#define __SSTR 0x0200
#define __SOPT 0x0400
#define __SNPT 0x0800
#define __SOFF 0x1000
#define __SMOD 0x2000
#define __SALC 0x4000
#define __SIGN 0x8000
#define _IOFBF 0
#define _IOLBF 1
#define _IONBF 2
#define BUFSIZ 1024
#define EOF (-1)
#define FOPEN_MAX 20
#define FILENAME_MAX 1024
#ifndef _ANSI_SOURCE
#define P_tmpdir "/var/tmp/"
#endif
#define L_tmpnam 1024
#define TMP_MAX 308915776
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif
#if __DARWIN_UNIX03
#define stdin __stdinp
#define stdout __stdoutp
#define stderr __stderrp
#else
#define stdin (&__sF[0])
#define stdout (&__sF[1])
#define stderr (&__sF[2])
#endif
__BEGIN_DECLS
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE * __restrict, fpos_t *);
char *fgets(char * __restrict, int, FILE *);
#if defined(__DARWIN_10_6_AND_LATER) && (defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE))
FILE *fopen(const char * __restrict, const char * __restrict) __DARWIN_EXTSN(fopen);
#else
#ifndef LIBC_ALIAS_FOPEN
FILE *fopen(const char * __restrict, const char * __restrict) __DARWIN_10_6_AND_LATER_ALIAS(__DARWIN_ALIAS(fopen));
#else
FILE *fopen(const char * __restrict, const char * __restrict) LIBC_ALIAS(fopen);
#endif
#endif
int fprintf(FILE * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(fprintf);
int fputc(int, FILE *);
#ifndef LIBC_ALIAS_FPUTS
int fputs(const char * __restrict, FILE * __restrict) __DARWIN_ALIAS(fputs);
#else
int fputs(const char * __restrict, FILE * __restrict) LIBC_ALIAS(fputs);
#endif
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
#ifndef LIBC_ALIAS_FREOPEN
FILE *freopen(const char * __restrict, const char * __restrict,
FILE * __restrict) __DARWIN_ALIAS(freopen);
#else
FILE *freopen(const char * __restrict, const char * __restrict,
FILE * __restrict) LIBC_ALIAS(freopen);
#endif
int fscanf(FILE * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(fscanf);
int fseek(FILE *, long, int);
int fsetpos(FILE *, const fpos_t *);
long ftell(FILE *);
#ifndef LIBC_ALIAS_FWRITE
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict) __DARWIN_ALIAS(fwrite);
#else
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict) LIBC_ALIAS(fwrite);
#endif
int getc(FILE *);
int getchar(void);
char *gets(char *);
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
extern __const int sys_nerr;
extern __const char *__const sys_errlist[];
#endif
void perror(const char *);
int printf(const char * __restrict, ...) __DARWIN_LDBL_COMPAT(printf);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename (const char *, const char *);
void rewind(FILE *);
int scanf(const char * __restrict, ...) __DARWIN_LDBL_COMPAT(scanf);
void setbuf(FILE * __restrict, char * __restrict);
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
int sprintf(char * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(sprintf);
int sscanf(const char * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(sscanf);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vfprintf);
int vprintf(const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vprintf);
int vsprintf(char * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vsprintf);
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
int asprintf(char **, const char *, ...) __DARWIN_LDBL_COMPAT(asprintf);
int vasprintf(char **, const char *, va_list) __DARWIN_LDBL_COMPAT(vasprintf);
#endif
__END_DECLS
#ifndef _ANSI_SOURCE
#define L_ctermid 1024
__BEGIN_DECLS
char *ctermid(char *);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
char *ctermid_r(char *);
#endif
#if defined(__DARWIN_10_6_AND_LATER) && (defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE))
FILE *fdopen(int, const char *) __DARWIN_EXTSN(fdopen);
#else
#ifndef LIBC_ALIAS_FDOPEN
FILE *fdopen(int, const char *) __DARWIN_10_6_AND_LATER_ALIAS(__DARWIN_ALIAS(fdopen));
#else
FILE *fdopen(int, const char *) LIBC_ALIAS(fdopen);
#endif
#endif
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
char *fgetln(FILE *, size_t *);
#endif
int fileno(FILE *);
void flockfile(FILE *);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
__const char
*fmtcheck(const char *, const char *);
int fpurge(FILE *);
#endif
int fseeko(FILE *, off_t, int);
off_t ftello(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
int getc_unlocked(FILE *);
int getchar_unlocked(void);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
int getw(FILE *);
#endif
int pclose(FILE *);
#if defined(__DARWIN_10_6_AND_LATER) && (defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE))
FILE *popen(const char *, const char *) __DARWIN_EXTSN(popen);
#else
#ifndef LIBC_ALIAS_POPEN
FILE *popen(const char *, const char *) __DARWIN_10_6_AND_LATER_ALIAS(__DARWIN_ALIAS(popen));
#else
FILE *popen(const char *, const char *) LIBC_ALIAS(popen);
#endif
#endif
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
int putw(int, FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
#endif
int snprintf(char * __restrict, size_t, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(snprintf);
#ifndef LIBC_ALIAS_TEMPNAM
char *tempnam(const char *, const char *) __DARWIN_ALIAS(tempnam);
#else
char *tempnam(const char *, const char *) LIBC_ALIAS(tempnam);
#endif
int vfscanf(FILE * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vfscanf);
int vscanf(const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vscanf);
int vsnprintf(char * __restrict, size_t, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vsnprintf);
int vsscanf(const char * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vsscanf);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
FILE *zopen(const char *, const char *, int);
#endif
__END_DECLS
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
__BEGIN_DECLS
FILE *funopen(const void *,
int (*)(void *, char *, int),
int (*)(void *, const char *, int),
fpos_t (*)(void *, fpos_t, int),
int (*)(void *));
__END_DECLS
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif
#endif
__BEGIN_DECLS
int __srget(FILE *);
int __svfscanf(FILE *, const char *, va_list) __DARWIN_LDBL_COMPAT(__svfscanf);
int __swbuf(int, FILE *);
__END_DECLS
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__) && defined(__STDC__)
static __inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
#else
#define __sputc(c, p) \
(--(p)->_w < 0 ? \
(p)->_w >= (p)->_lbfsize ? \
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
(int)*(p)->_p++ : \
__swbuf('\n', p) : \
__swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++))
#endif
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
#ifndef _ANSI_SOURCE
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define feof_unlocked(p) __sfeof(p)
#define ferror_unlocked(p) __sferror(p)
#define clearerr_unlocked(p) __sclearerr(p)
#define fileno_unlocked(p) __sfileno(p)
#endif
#ifndef lint
#define getc_unlocked(fp) __sgetc(fp)
#define putc_unlocked(x, fp) __sputc(x, fp)
#endif
#define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif
#ifdef _USE_EXTENDED_LOCALES_
#include <xlocale/_stdio.h>
#endif
#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)
#include <secure/_stdio.h>
#endif
#endif