#include<stdio.h>
/*
* stdio.h
*
* Definitions of types and prototypes of functions for operations on
* standard input and standard output streams.
*
* $Id: stdio.h,v 0fe8afb3a429 2019/10/26 09:33:12 keith $
*
* Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
* Copyright (C) 1997-2005, 2007-2010, 2014-2019, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice, this permission notice, and the following
* disclaimer shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* NOTE: The file manipulation functions provided by Microsoft seem to
* work with either slash (/) or backslash (\) as the directory separator;
* (this is consistent with Microsoft's own documentation, on MSDN).
*
*/
#ifndef _STDIO_H
#pragma GCC system_header
/* When including <wchar.h>, some of the definitions and declarations
* which are nominally provided in <stdio.h> must be duplicated. Rather
* than require duplicated maintenance effort, we provide for partial
* inclusion of <stdio.h> by <wchar.h>; only when not included in
* this partial fashion...
*/
#ifndef __WCHAR_H_SOURCED__
/* ...which is exclusive to <wchar.h>, do we assert the multiple
* inclusion guard for <stdio.h> itself.
*/
#define _STDIO_H
#endif
/* All the headers include this file.
*/
#include <_mingw.h>
#ifndef RC_INVOKED
/* POSIX stipulates that the following set of types, (as identified by
* __need_TYPENAME macros), shall be defined consistently with <stddef.h>;
* by defining the appropriate __need_TYPENAME macros, we may selectively
* obtain the required definitions by inclusion of <stddef.h>, WITHOUT
* automatic exposure of any of its additional content.
*/
#define __need_NULL
#define __need_size_t
#define __need_wchar_t
#define __need_wint_t
#include <stddef.h>
#if _POSIX_C_SOURCE >= 200809L
/* Similarly, for types defined in <sys/types.h>, (which are explicitly
* dependent on the POSIX.1-2008 feature test)...
*/
# define __need_off_t
# define __need_ssize_t
#endif
/* Although non-standard themselves, we also need either one or other
* of the following pair of data types, from <sys/types.h>, because our
* standard fpos_t is opaquely defined in terms of...
*/
#ifdef __MSVCRT__
/* ...an explicitly 64-bit file offset type, for MSVCRT.DLL users...
*/
# define __need___off64_t
#else
/* ...or a 32-bit equivalent, for pre-MSVCRT.DLL users.
*/
# define __need___off32_t
#endif
/* Note the use of the #include "..." form here, to ensure that we get
* the correct header file, relative to the location of this <stdio.h>
*/
#include "sys/types.h"
#ifndef __VALIST
/* Also similarly, for the va_list type, defined in "stdarg.h"
*/
# if defined __GNUC__ && __GNUC__ >= 3
# define __need___va_list
# include "stdarg.h"
# define __VALIST __builtin_va_list
# else
# define __VALIST char *
# endif
#endif
#endif /* ! RC_INVOKED */
#ifdef _STDIO_H
/* Flags for the iobuf structure
*/
#define _IOREAD 1 /* currently reading */
#define _IOWRT 2 /* currently writing */
#define _IORW 0x0080 /* opened as "r+w" */
/* The three standard file pointers provided by the run time library.
* NOTE: These will go to the bit-bucket silently in GUI applications!
*/
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
/* Returned by various functions on end of file condition or error.
*/
#define EOF (-1)
#endif /* _STDIO_H */
/* The maximum length of a file name. It may be better to use the Windows'
* GetVolumeInformation() function in preference to this constant, but hey,
* this works! Note that <io.h> also defines it, but we don't guard it, so
* that the compiler has a chance to catch inconsistencies.
*
* FIXME: Right now, we define this unconditionally for both full <stdio.h>
* inclusion, and for partial inclusion on behalf of <wchar.h>, (which needs
* it for some non-ANSI structure declarations). The conditions under which
* <wchar.h> needs this require review, because defining it as a consequence
* of including <wchar.h> alone may violate strict ANSI conformity.
*/
#define FILENAME_MAX (260)
#ifdef _STDIO_H
/* The maximum number of files that may be open at once. I have set this to
* a conservative number. The actual value may be higher.
*/
#define FOPEN_MAX (20)
/* After creating this many names, tmpnam and tmpfile return NULL
*/
#define TMP_MAX 32767
/* Tmpnam, tmpfile and, sometimes, _tempnam try to create
* temp files in the root directory of the current drive
* (not in pwd, as suggested by some older MS doc's).
* Redefining these macros does not effect the CRT functions.
*/
#define _P_tmpdir "\\"
#ifndef __STRICT_ANSI__
#define P_tmpdir _P_tmpdir
#endif
#define _wP_tmpdir L"\\"
/* The maximum size of name (including NUL) that will be put in the user
* supplied buffer caName for tmpnam.
* Inferred from the size of the static buffer returned by tmpnam
* when passed a NULL argument. May actually be smaller.
*/
#define L_tmpnam (16)
#define _IOFBF 0x0000 /* full buffered */
#define _IOLBF 0x0040 /* line buffered */
#define _IONBF 0x0004 /* not buffered */
#define _IOMYBUF 0x0008 /* stdio malloc()'d buffer */
#define _IOEOF 0x0010 /* EOF reached on read */
#define _IOERR 0x0020 /* I/O error from system */
#define _IOSTRG 0x0040 /* Strange or no file descriptor */
#ifdef _POSIX_SOURCE
# define _IOAPPEND 0x0200
#endif
/* The buffer size as used by setbuf such that it is equivalent to
* (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ).
*/
#define BUFSIZ 512
/* Constants for nOrigin indicating the position relative to which fseek
* sets the file position. Defined unconditionally since ISO and POSIX
* say they are defined here.
*/
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif /* _STDIO_H */
#ifndef RC_INVOKED
#if ! (defined _STDIO_H && defined _WCHAR_H)
/* The structure underlying the FILE type; this should be defined when
* including either <stdio.h> or <wchar.h>. If both header include guards
* are now in place, then we must currently be including <stdio.h> in its
* own right, having already processed this block during a prior partial
* inclusion by <wchar.h>; there is no need to process it a second time.
*
* Some believe that nobody in their right mind should make use of the
* internals of this structure. Provided by Pedro A. Aranda Gutiirrez
* <paag@tid.es>.
*/
typedef struct _iobuf
{
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
} FILE;
#endif /* ! (_STDIO_H && _WCHAR_H) */
#ifdef _STDIO_H
/* Content to be exposed only when including <stdio.h> in its own right;
* these will not be exposed when __WCHAR_H_SOURCE__ is defined, as will
* be the case when <stdio.h> is included indirectly, by <wchar.h>
*
*
* The standard file handles
*/
#ifndef __DECLSPEC_SUPPORTED
extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */
#define _iob (*_imp___iob) /* An array of FILE */
#else /* __DECLSPEC_SUPPORTED */
__MINGW_IMPORT FILE _iob[]; /* An array of FILE imported from DLL. */
#endif /* __DECLSPEC_SUPPORTED */
#define stdin (&_iob[STDIN_FILENO])
#define stdout (&_iob[STDOUT_FILENO])
#define stderr (&_iob[STDERR_FILENO])
/* Need to close the current _STDIO_H specific block here...
*/
#endif
/* ...because, we need this regardless of the inclusion mode...
*/
_BEGIN_C_DECLS
#ifdef _STDIO_H
/* ...then revert to _STDIO_H specific mode, to declare...
*
*
* File Operations
*/
_CRTIMP __cdecl __MINGW_NOTHROW FILE * fopen (const char *, const char *);
_CRTIMP __cdecl __MINGW_NOTHROW FILE * freopen (const char *, const char *, FILE *);
_CRTIMP __cdecl __MINGW_NOTHROW int fflu