* $Id$
*
* Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Copyright (C) 1997-2005, 2007-2010, 2014-2016, MinGW.org Project.
+ * Copyright (C) 1997-2005, 2007-2010, 2014-2017, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* preceding groups...
*/
#if defined __need_off_t || defined __need___off64_t
- /* ...to identify a requirement for selective inclusion from...
+ /* ...to identify a requirement for selective inclusion of one or more
+ * of these type definitions from "sys/types.h"; (note that we use 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>
+# include "sys/types.h"
#endif
#ifndef __VALIST
- /* Also similarly, for the va_list type, defined in <stdarg.h>
+ /* Also similarly, for the va_list type, defined in "stdarg.h"
*/
# if defined __GNUC__ && __GNUC__ >= 3
# define __need___va_list
-# include <stdarg.h>
+# include "stdarg.h"
# define __VALIST __builtin_va_list
# else
# define __VALIST char *
_CRTIMP __cdecl __MINGW_NOTHROW int _rmtmp (void);
_CRTIMP __cdecl __MINGW_NOTHROW int _unlink (const char *);
+#if __MSVCRT_VERSION__>=__MSVCR80_DLL
+/* The following pair of non-ANSI functions require a non-free version of
+ * the Microsoft runtime; neither is provided by any MSVCRT.DLL variant.
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW void _lock_file(FILE *);
+_CRTIMP __cdecl __MINGW_NOTHROW void _unlock_file(FILE *);
+#endif
+
#ifndef NO_OLDNAMES
_CRTIMP __cdecl __MINGW_NOTHROW char * tempnam (const char *, const char *);
_CRTIMP __cdecl __MINGW_NOTHROW int rmtmp (void);
}
__mingw_stdio_redirect__
+int snprintf (char *__stream, size_t __len, const char *__format, ...)
+{
+ register int __retval;
+ __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
+ __retval = __mingw_vsnprintf( __stream, __len, __format, __local_argv );
+ __builtin_va_end( __local_argv );
+ return __retval;
+}
+
+__mingw_stdio_redirect__
int vfprintf (FILE *__stream, const char *__format, __VALIST __local_argv)
{
return __mingw_vfprintf( __stream, __format, __local_argv );
return __mingw_vsprintf( __stream, __format, __local_argv );
}
+__mingw_stdio_redirect__
+int vsnprintf (char *__stream, size_t __len, const char *__format, __VALIST __local_argv)
+{
+ return __mingw_vsnprintf( __stream, __len, __format, __local_argv );
+}
+
#else
/* Default configuration: simply direct all calls to MSVCRT...
*/
int vsscanf (const char * __restrict__, const char * __restrict__, __VALIST);
#endif /* _ISOC99_SOURCE */
+#endif /* <stdio.h> included in its own right */
+
#if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
/*
* In MSVCR80.DLL, (and its descendants), Microsoft introduced variants
* instead; this is both portable to many non-Windows platforms, and it
* offers better compatibility with earlier Windows versions.
*/
+#ifndef __have_typedef_locale_t
+/* Note that some of the following require the opaque locale_t data type,
+ * which we may obtain, by selective inclusion, from <locale.h>
+ */
+#define __need_locale_t
+#include <locale.h>
+#endif
+
+#ifdef _STDIO_H
+/* The following are to be declared only when <stdio.h> is explicitly
+ * included; the first six are NOT dependent on locale_t...
+ */
_CRTIMP __cdecl __MINGW_NOTHROW
int _printf_p (const char *, ...);
_CRTIMP __cdecl __MINGW_NOTHROW
int _vsprintf_p (char *, size_t, const char *, __VALIST);
+/* ...whereas the following six DO depend on locale_t.
+ *
+ * CAVEAT: unless you are linking with non-free MSVCR80.DLL, or one
+ * of its later derivatives, good luck trying to use these; see the
+ * explanation in <locale.t>, as to why you may be unable to create,
+ * or otherwise acquire a reference to, a locale_t object.
+ */
_CRTIMP __cdecl __MINGW_NOTHROW
int _printf_p_l (const char *, locale_t, ...);
_CRTIMP __cdecl __MINGW_NOTHROW
int _vsprintf_p_l (char *, size_t, const char *, locale_t, __VALIST);
-#endif /* MSVCR80.DLL and descendants, or MSVCRT.DLL since Vista */
#endif /* <stdio.h> included in its own right */
-#if ! (defined _STDIO_H && defined _WCHAR_H) \
- && __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
+#endif /* MSVCR80.DLL and descendants, or MSVCRT.DLL since Vista */
+
+#if ! (defined _STDIO_H && defined _WCHAR_H)
+#if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
/*
* Wide character variants of the foregoing "positional parameter" printf()
* functions; MSDN says that these should be declared when either <stdio.h>, or
_CRTIMP __cdecl __MINGW_NOTHROW
int _vswprintf_p_l (wchar_t *, size_t, const wchar_t *, locale_t, __VALIST);
+#endif /* MSVCR80.DLL and descendants, or MSVCRT.DLL since Vista */
#endif /* ! (defined _STDIO_H && defined _WCHAR_H) */
#ifdef _STDIO_H
/* Once again, back to <stdio.h> specific declarations.
*/
+#if _POSIX_C_SOURCE >= 200809L
+/* POSIX standard IEEE 1003.1-2008 added getdelim() and getline()
+ */
+__cdecl __MINGW_NOTHROW ssize_t
+getdelim (char ** __restrict__, size_t * __restrict__, int, FILE * __restrict__);
+
+__cdecl __MINGW_NOTHROW ssize_t
+getline (char ** __restrict__, size_t * __restrict__, FILE * __restrict__);
+
+#ifndef __NO_INLINE__
+/* getline() is a trivial specialization of getdelim(), which may
+ * be readily expressed by inline expansion.
+ */
+__CRT_ALIAS __LIBIMPL__(( FUNCTION = getline ))
+__cdecl __MINGW_NOTHROW ssize_t getline
+( char **__restrict__ __l, size_t *__restrict__ __n, FILE *__restrict__ __s )
+{ return getdelim( __l, __n, '\n', __s ); }
+
+#endif /* !__NO_INLINE__ */
+#endif /* POSIX.1-2008 */
/* Formatted Input
*/
#if !defined _MT
+__CRT_INLINE __cdecl __MINGW_NOTHROW int getc (FILE *);
__CRT_INLINE __cdecl __MINGW_NOTHROW int getc (FILE * __F)
{
return (--__F->_cnt >= 0)
: _filbuf (__F);
}
+__CRT_INLINE __cdecl __MINGW_NOTHROW int putc (int, FILE *);
__CRT_INLINE __cdecl __MINGW_NOTHROW int putc (int __c, FILE * __F)
{
return (--__F->_cnt >= 0)
: _flsbuf (__c, __F);
}
+__CRT_INLINE __cdecl __MINGW_NOTHROW int getchar (void);
__CRT_INLINE __cdecl __MINGW_NOTHROW int getchar (void)
{
return (--stdin->_cnt >= 0)
: _filbuf (stdin);
}
+__CRT_INLINE __cdecl __MINGW_NOTHROW int putchar(int);
__CRT_INLINE __cdecl __MINGW_NOTHROW int putchar(int __c)
{
return (--stdout->_cnt >= 0)
#endif
#if defined (__MSVCRT__) && ! defined (__NO_MINGW_LFS)
-__CRT_INLINE __JMPSTUB__(( FUNCTION = fopen64, REMAPPED = fopen ))
+__CRT_ALIAS FILE * __cdecl __MINGW_NOTHROW fopen64 (const char *, const char *);
+__CRT_ALIAS __JMPSTUB__(( FUNCTION = fopen64, REMAPPED = fopen ))
FILE * __cdecl __MINGW_NOTHROW fopen64 (const char * filename, const char * mode)
{ return fopen (filename, mode); }
#define fseeko64(fp, offset, whence) __mingw_fseeko64(fp, offset, whence)
#endif
-__CRT_INLINE __LIBIMPL__(( FUNCTION = ftello64 ))
+__CRT_ALIAS __off64_t __cdecl __MINGW_NOTHROW ftello64 (FILE *);
+__CRT_ALIAS __LIBIMPL__(( FUNCTION = ftello64 ))
__off64_t __cdecl __MINGW_NOTHROW ftello64 (FILE * stream)
{ fpos_t __pos; return (fgetpos(stream, &__pos)) ? -1LL : (__off64_t)(__pos); }
#endif /* __MSVCRT__ */
#ifdef _ISOC99_SOURCE
+__JMPSTUB__(( FUNCTION = snwprintf, DLLENTRY = _snwprintf ))
__cdecl __MINGW_NOTHROW int snwprintf (wchar_t *, size_t, const wchar_t *, ...);
__cdecl __MINGW_NOTHROW int vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
#ifndef __NO_INLINE__
__CRT_INLINE __cdecl __MINGW_NOTHROW
-__JMPSTUB__(( FUNCTION = vsnwprintf, REMAPPED = _vsnwprintf ))
+__JMPSTUB__(( FUNCTION = vsnwprintf, DLLENTRY = _vsnwprintf ))
int vsnwprintf (wchar_t *__s, size_t __n, const wchar_t *__fmt, __VALIST __arg)
{ return _vsnwprintf ( __s, __n, __fmt, __arg); }
#endif