1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 #ifndef _INC_STDIO
7 #define _INC_STDIO
8
9 #include <crtdefs.h>
10
11 #pragma pack(push,_CRT_PACKING)
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #define BUFSIZ 512
18 #define _NFILE _NSTREAM_
19 #define _NSTREAM_ 512
20 #define _IOB_ENTRIES 20
21 #define EOF (-1)
22
23 #ifndef _FILE_DEFINED
24 struct _iobuf {
25 char *_ptr;
26 int _cnt;
27 char *_base;
28 int _flag;
29 int _file;
30 int _charbuf;
31 int _bufsiz;
32 char *_tmpfname;
33 };
34 typedef struct _iobuf FILE;
35 #define _FILE_DEFINED
36 #endif
37
38 #ifdef _POSIX_
39 #define _P_tmpdir "/"
40 #define _wP_tmpdir L"/"
41 #else
42 #define _P_tmpdir "\\"
43 #define _wP_tmpdir L"\\"
44 #endif
45
46 #define L_tmpnam (sizeof(_P_tmpdir) + 12)
47
48 #ifdef _POSIX_
49 #define L_ctermid 9
50 #define L_cuserid 32
51 #endif
52
53 #define SEEK_CUR 1
54 #define SEEK_END 2
55 #define SEEK_SET 0
56
57 #define STDIN_FILENO 0
58 #define STDOUT_FILENO 1
59 #define STDERR_FILENO 2
60
61 #define FILENAME_MAX 260
62 #define FOPEN_MAX 20
63 #define _SYS_OPEN 20
64 #define TMP_MAX 32767
65
66 #ifndef NULL
67 #ifdef __cplusplus
68 #ifndef _WIN64
69 #define NULL 0
70 #else
71 #define NULL 0LL
72 #endif /* W64 */
73 #else
74 #define NULL ((void *)0)
75 #endif
76 #endif
77
78 #include <_mingw_off_t.h>
79
80 _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index);
81 #ifndef _STDIO_DEFINED
82 #ifdef _WIN64
83 _CRTIMP FILE *__cdecl __iob_func(void);
84 #define _iob __iob_func()
85 #else
86 #ifdef _MSVCRT_
87 extern FILE _iob[]; /* A pointer to an array of FILE */
88 #define __iob_func() (_iob)
89 #else
90 extern FILE (* __MINGW_IMP_SYMBOL(_iob))[]; /* A pointer to an array of FILE */
91 #define __iob_func() (* __MINGW_IMP_SYMBOL(_iob))
92 #define _iob __iob_func()
93 #endif
94 #endif
95 #endif
96
97 #ifndef _FPOS_T_DEFINED
98 #define _FPOS_T_DEFINED
99 #undef _FPOSOFF
100
101 #if (!defined(NO_OLDNAMES) || defined(__GNUC__))
102 __MINGW_EXTENSION typedef __int64 fpos_t;
103 #define _FPOSOFF(fp) ((long)(fp))
104 #else
105 __MINGW_EXTENSION typedef long long fpos_t;
106 #define _FPOSOFF(fp) ((long)(fp))
107 #endif
108
109 #endif
110
111 #ifndef _STDSTREAM_DEFINED
112 #define _STDSTREAM_DEFINED
113
114 #define stdin (__acrt_iob_func(0))
115 #define stdout (__acrt_iob_func(1))
116 #define stderr (__acrt_iob_func(2))
117 #endif
118
119 #define _IOREAD 0x0001
120 #define _IOWRT 0x0002
121
122 #define _IOFBF 0x0000
123 #define _IOLBF 0x0040
124 #define _IONBF 0x0004
125
126 #define _IOMYBUF 0x0008
127 #define _IOEOF 0x0010
128 #define _IOERR 0x0020
129 #define _IOSTRG 0x0040
130 #define _IORW 0x0080
131 #ifdef _POSIX_
132 #define _IOAPPEND 0x0200
133 #endif
134
135 #define _TWO_DIGIT_EXPONENT 0x1
136
137 #if !defined(_UCRTBASE_STDIO_DEFINED) && __MSVCRT_VERSION__ >= 0x1400
138 #define _UCRTBASE_STDIO_DEFINED
139
140 #define UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION (0x0001)
141 #define UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR (0x0002)
142 #define UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS (0x0004)
143 #define UCRTBASE_PRINTF_LEGACY_MSVCRT_COMPATIBILITY (0x0008)
144 #define UCRTBASE_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS (0x0010)
145
146 #define UCRTBASE_SCANF_SECURECRT (0x0001)
147 #define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002)
148 #define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004)
149
150 // Default wide printfs and scanfs to the standard mode
151 #ifndef UCRTBASE_PRINTF_DEFAULT_WIDE
152 #define UCRTBASE_PRINTF_DEFAULT_WIDE 0
153 #endif
154 #ifndef UCRTBASE_SCANF_DEFAULT_WIDE
155 #define UCRTBASE_SCANF_DEFAULT_WIDE 0
156 #endif
157 #endif
158
159 #ifndef _STDIO_DEFINED
160 extern
161 __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
162 int __cdecl __mingw_sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...);
163 extern
164 __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
165 int __cdecl __mingw_vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp);
166 extern
167 __attribute__((__format__ (gnu_scanf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
168 int __cdecl __mingw_scanf(const char * __restrict__ _Format,...);
169 extern
170 __attribute__((__format__ (gnu_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
171 int __cdecl __mingw_vscanf(const char * __restrict__ Format, va_list argp);
172 extern
173 __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
174 int __cdecl __mingw_fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
175 extern
176 __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
177 int __cdecl __mingw_vfscanf (FILE * __restrict__ fp, const char * __restrict__ Format,va_list argp);
178
179 extern
180 __attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
181 int __cdecl __mingw_vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format,
182 va_list _ArgList);
183 extern
184 __attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
185 int __cdecl __mingw_snprintf(char * __restrict__ s, size_t n, const char * __restrict__ format, ...);
186 extern
187 __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
188 int __cdecl __mingw_printf(const char * __restrict__ , ... ) __MINGW_NOTHROW;
189 extern
190 __attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
191 int __cdecl __mingw_vprintf (const char * __restrict__ , va_list) __MINGW_NOTHROW;
192 extern
193 __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
194 int __cdecl __mingw_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
195 extern
196 __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
197 int __cdecl __mingw_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
198 extern
199 __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
200 int __cdecl __mingw_sprintf (char * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
201 extern
202 __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
203 int __cdecl __mingw_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
204 extern
205 __attribute__((__format__ (gnu_printf, 2, 3))) __attribute__((nonnull (1,2)))
206 int __cdecl __mingw_asprintf(char ** __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
207 extern
208 __attribute__((__format__ (gnu_printf, 2, 0))) __attribute__((nonnull (1,2)))
209 int __cdecl __mingw_vasprintf(char ** __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
210
211 #if __MSVCRT_VERSION__ >= 0x1400
212 int __cdecl __stdio_common_vsprintf(unsigned __int64 options, char *str, size_t len, const char *format, _locale_t locale, va_list valist);
213 int __cdecl __stdio_common_vfprintf(unsigned __int64 options, FILE *file, const char *format, _locale_t locale, va_list valist);
214 int __cdecl __stdio_common_vsscanf(unsigned __int64 options, const char *input, size_t length, const char *format, _locale_t locale, va_list valist);
215 int __cdecl __stdio_common_vfscanf(unsigned __int64 options, FILE *file, const char *format, _locale_t locale, va_list valist);
216 #endif
217
218 #undef __MINGW_PRINTF_FORMAT
219 #undef __MINGW_SCANF_FORMAT
220
221 #if defined(__clang__)
222 #define __MINGW_PRINTF_FORMAT printf
223 #define __MINGW_SCANF_FORMAT scanf
224 #elif __MSVCRT_VERSION__ >= 0x1400 || __USE_MINGW_ANSI_STDIO
225 #define __MINGW_PRINTF_FORMAT gnu_printf
226 #define __MINGW_SCANF_FORMAT gnu_scanf
227 #else
228 #define __MINGW_PRINTF_FORMAT ms_printf
229 #define __MINGW_SCANF_FORMAT ms_scanf
230 #endif
231
232 #if __USE_MINGW_ANSI_STDIO
233 /*
234 * User has expressed a preference for C99 conformance...
235 */
236
237 #ifdef _GNU_SOURCE
238 __mingw_ovr
239 __attribute__ ((__format__ (gnu_printf, 2, 3))) __attribute__((nonnull (1,2)))
asprintf(char ** __ret,const char * __format,...)240 int asprintf(char **__ret, const char *__format, ...)
241 {
242 int __retval;
243 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
244 __retval = __mingw_vasprintf( __ret, __format, __local_argv );
245 __builtin_va_end( __local_argv );
246 return __retval;
247 }
248
249 __mingw_ovr
250 __attribute__ ((__format__ (gnu_printf, 2, 0))) __attribute__((nonnull (1,2)))
vasprintf(char ** __ret,const char * __format,__builtin_va_list __local_argv)251 int vasprintf(char **__ret, const char *__format, __builtin_va_list __local_argv)
252 {
253 return __mingw_vasprintf( __ret, __format, __local_argv );
254 }
255 #endif /* _GNU_SOURCE */
256
257 /* There seems to be a bug about builtins and static overrides of them
258 in g++. So we need to do here some trickery. */
259 #ifdef __cplusplus
260 extern "C++" {
261 #endif
262
263 __mingw_ovr
264 __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
sscanf(const char * __source,const char * __format,...)265 int sscanf(const char *__source, const char *__format, ...)
266 {
267 int __retval;
268 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
269 __retval = __mingw_vsscanf( __source, __format, __local_argv );
270 __builtin_va_end( __local_argv );
271 return __retval;
272 }
273
274 __mingw_ovr
275 __attribute__((__format__ (gnu_scanf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
scanf(const char * __format,...)276 int scanf(const char *__format, ...)
277 {
278 int __retval;
279 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
280 __retval = __mingw_vfscanf( stdin, __format, __local_argv );
281 __builtin_va_end( __local_argv );
282 return __retval;
283 }
284
285 __mingw_ovr
286 __attribute__((__format__ (gnu_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
fscanf(FILE * __stream,const char * __format,...)287 int fscanf(FILE *__stream, const char *__format, ...)
288 {
289 int __retval;
290 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
291 __retval = __mingw_vfscanf( __stream, __format, __local_argv );
292 __builtin_va_end( __local_argv );
293 return __retval;
294 }
295
296 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
297 #ifdef __GNUC__
298 #pragma GCC diagnostic push
299 #pragma GCC diagnostic ignored "-Wshadow"
300 #endif
301
302 __mingw_ovr
303 __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vsscanf(const char * __source,const char * __format,__builtin_va_list __local_argv)304 int vsscanf (const char *__source, const char *__format, __builtin_va_list __local_argv)
305 {
306 return __mingw_vsscanf( __source, __format, __local_argv );
307 }
308
309 __mingw_ovr
310 __attribute__((__format__ (gnu_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
vscanf(const char * __format,__builtin_va_list __local_argv)311 int vscanf(const char *__format, __builtin_va_list __local_argv)
312 {
313 return __mingw_vfscanf( stdin, __format, __local_argv );
314 }
315
316 __mingw_ovr
317 __attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vfscanf(FILE * __stream,const char * __format,__builtin_va_list __local_argv)318 int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv)
319 {
320 return __mingw_vfscanf( __stream, __format, __local_argv );
321 }
322
323 #ifdef __GNUC__
324 #pragma GCC diagnostic pop
325 #endif
326 #endif /* __NO_ISOCEXT */
327
328
329
330 __mingw_ovr
331 __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
fprintf(FILE * __stream,const char * __format,...)332 int fprintf (FILE *__stream, const char *__format, ...)
333 {
334 int __retval;
335 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
336 __retval = __mingw_vfprintf( __stream, __format, __local_argv );
337 __builtin_va_end( __local_argv );
338 return __retval;
339 }
340
341 __mingw_ovr
342 __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
printf(const char * __format,...)343 int printf (const char *__format, ...)
344 {
345 int __retval;
346 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
347 __retval = __mingw_vfprintf( stdout, __format, __local_argv );
348 __builtin_va_end( __local_argv );
349 return __retval;
350 }
351
352 __mingw_ovr
353 __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
sprintf(char * __stream,const char * __format,...)354 int sprintf (char *__stream, const char *__format, ...)
355 {
356 int __retval;
357 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
358 __retval = __mingw_vsprintf( __stream, __format, __local_argv );
359 __builtin_va_end( __local_argv );
360 return __retval;
361 }
362
363 __mingw_ovr
364 __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vfprintf(FILE * __stream,const char * __format,__builtin_va_list __local_argv)365 int vfprintf (FILE *__stream, const char *__format, __builtin_va_list __local_argv)
366 {
367 return __mingw_vfprintf( __stream, __format, __local_argv );
368 }
369
370 __mingw_ovr
371 __attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
vprintf(const char * __format,__builtin_va_list __local_argv)372 int vprintf (const char *__format, __builtin_va_list __local_argv)
373 {
374 return __mingw_vfprintf( stdout, __format, __local_argv );
375 }
376
377 __mingw_ovr
378 __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vsprintf(char * __stream,const char * __format,__builtin_va_list __local_argv)379 int vsprintf (char *__stream, const char *__format, __builtin_va_list __local_argv)
380 {
381 return __mingw_vsprintf( __stream, __format, __local_argv );
382 }
383 /* #ifndef __NO_ISOCEXT */ /* externs in libmingwex.a */
384 __mingw_ovr
385 __attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
snprintf(char * __stream,size_t __n,const char * __format,...)386 int snprintf (char *__stream, size_t __n, const char *__format, ...)
387 {
388 int __retval;
389 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
390 __retval = __mingw_vsnprintf( __stream, __n, __format, __local_argv );
391 __builtin_va_end( __local_argv );
392 return __retval;
393 }
394
395 __mingw_ovr
396 __attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
vsnprintf(char * __stream,size_t __n,const char * __format,__builtin_va_list __local_argv)397 int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_list __local_argv)
398 {
399 return __mingw_vsnprintf( __stream, __n, __format, __local_argv );
400 }
401
402 /* Override __builtin_printf-routines ... Kludge for libstdc++ ...*/
403 #define __builtin_vsnprintf __mingw_vsnprintf
404 #define __builtin_vsprintf __mingw_vsprintf
405
406 /* #endif */ /* __NO_ISOCEXT */
407
408 #ifdef __cplusplus
409 }
410 #endif
411
412 #else /* !__USE_MINGW_ANSI_STDIO */
413
414 #undef __builtin_vsnprintf
415 #undef __builtin_vsprintf
416
417 /*
418 * Default configuration: simply direct all calls to MSVCRT...
419 */
420 #if __MSVCRT_VERSION__ >= 0x1400
421 #ifdef __GNUC__
422 #pragma GCC diagnostic push
423 #pragma GCC diagnostic ignored "-Wshadow"
424 #endif
425 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
426 int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
427 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
428 int __cdecl printf(const char * __restrict__ _Format,...);
429 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
430 int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
431
432 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
433 int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList);
434 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
435 int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList);
436 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
437 int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
438
439 __mingw_ovr
440 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...)441 int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
442 {
443 __builtin_va_list ap;
444 int ret;
445 __builtin_va_start(ap, _Format);
446 ret = __stdio_common_vfscanf(0, _File, _Format, NULL, ap);
447 __builtin_va_end(ap);
448 return ret;
449 }
450 __mingw_ovr
451 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
scanf(const char * __restrict__ _Format,...)452 int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
453 {
454 __builtin_va_list ap;
455 int ret;
456 __builtin_va_start(ap, _Format);
457 ret = __stdio_common_vfscanf(0, stdin, _Format, NULL, ap);
458 __builtin_va_end(ap);
459 return ret;
460 }
461 __mingw_ovr
462 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...)463 int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
464 {
465 __builtin_va_list ap;
466 int ret;
467 __builtin_va_start(ap, _Format);
468 ret = __stdio_common_vsscanf(0, _Src, (size_t)-1, _Format, NULL, ap);
469 __builtin_va_end(ap);
470 return ret;
471 }
472 #ifdef _GNU_SOURCE
473 __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, 2, 0)))
474 int __cdecl vasprintf(char ** __restrict__ _Ret,const char * __restrict__ _Format,va_list _Args);
475 __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, 2, 3)))
476 int __cdecl asprintf(char ** __restrict__ _Ret,const char * __restrict__ _Format,...);
477 #endif /*_GNU_SOURCE*/
478
479 __mingw_ovr
480 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vfscanf(FILE * __stream,const char * __format,__builtin_va_list __local_argv)481 int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv)
482 {
483 return __stdio_common_vfscanf(0, __stream, __format, NULL, __local_argv);
484 }
485
486 __mingw_ovr
487 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vsscanf(const char * __restrict__ __source,const char * __restrict__ __format,__builtin_va_list __local_argv)488 int vsscanf (const char * __restrict__ __source, const char * __restrict__ __format, __builtin_va_list __local_argv)
489 {
490 return __stdio_common_vsscanf(0, __source, (size_t)-1, __format, NULL, __local_argv);
491 }
492 __mingw_ovr
493 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
vscanf(const char * __format,__builtin_va_list __local_argv)494 int vscanf(const char *__format, __builtin_va_list __local_argv)
495 {
496 return __stdio_common_vfscanf(0, stdin, __format, NULL, __local_argv);
497 }
498
499 #ifdef __GNUC__
500 #pragma GCC diagnostic pop
501 #endif
502
503 #else
504 __attribute__((__format__ (ms_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
505 int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
506 __attribute__((__format__ (ms_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
507 int __cdecl printf(const char * __restrict__ _Format,...);
508 __attribute__((__format__ (ms_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
509 int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
510
511 __attribute__((__format__ (ms_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
512 int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList);
513 __attribute__((__format__ (ms_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
514 int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList);
515 __attribute__((__format__ (ms_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
516 int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
517
518 __attribute__((__format__ (ms_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
519 int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
520 __attribute__((__format__ (ms_scanf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
521 int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
522 __attribute__((__format__ (ms_scanf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
523 int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
524 #ifdef _GNU_SOURCE
525 int __cdecl vasprintf(char ** __restrict__ ret,const char * __restrict__ format,va_list ap) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 0)));
526 int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)));
527 #endif /*_GNU_SOURCE*/
528 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
529 #ifdef __GNUC__
530 #pragma GCC diagnostic push
531 #pragma GCC diagnostic ignored "-Wshadow"
532 #endif
533
534 __attribute__((__format__ (ms_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
535 int __cdecl __ms_vscanf(const char * __restrict__ Format, va_list argp);
536 __attribute__((__format__ (ms_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
537 int __cdecl __ms_vfscanf (FILE * __restrict__ fp, const char * __restrict__ Format,va_list argp);
538 __attribute__((__format__ (ms_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
539 int __cdecl __ms_vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp);
540
541 __mingw_ovr
542 __attribute__((__format__ (ms_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vfscanf(FILE * __stream,const char * __format,__builtin_va_list __local_argv)543 int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv)
544 {
545 return __ms_vfscanf (__stream, __format, __local_argv);
546 }
547
548 __mingw_ovr
549 __attribute__((__format__ (ms_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
vsscanf(const char * __restrict__ __source,const char * __restrict__ __format,__builtin_va_list __local_argv)550 int vsscanf (const char * __restrict__ __source, const char * __restrict__ __format, __builtin_va_list __local_argv)
551 {
552 return __ms_vsscanf( __source, __format, __local_argv );
553 }
554 __mingw_ovr
555 __attribute__((__format__ (ms_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
vscanf(const char * __format,__builtin_va_list __local_argv)556 int vscanf(const char *__format, __builtin_va_list __local_argv)
557 {
558 return __ms_vscanf (__format, __local_argv);
559 }
560
561 #ifdef __GNUC__
562 #pragma GCC diagnostic pop
563 #endif
564
565 #endif /* __NO_ISOCEXT */
566 #endif /* __MSVCRT_VERSION__ >= 0x1400 */
567 #endif /* __USE_MINGW_ANSI_STDIO */
568
569 _CRTIMP int __cdecl _filbuf(FILE *_File);
570 _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File);
571 #ifdef _POSIX_
572 _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode);
573 #else
574 _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag);
575 #endif
576 void __cdecl clearerr(FILE *_File);
577 int __cdecl fclose(FILE *_File);
578 _CRTIMP int __cdecl _fcloseall(void);
579 #ifdef _POSIX_
580 FILE *__cdecl fdopen(int _FileHandle,const char *_Mode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
581 #else
582 _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode);
583 #endif
584 int __cdecl feof(FILE *_File);
585 int __cdecl ferror(FILE *_File);
586 int __cdecl fflush(FILE *_File);
587 int __cdecl fgetc(FILE *_File);
588 _CRTIMP int __cdecl _fgetchar(void);
589 int __cdecl fgetpos(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos); /* 64bit only, no 32bit version */
590 int __cdecl fgetpos64(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos); /* fgetpos already 64bit */
591 char *__cdecl fgets(char * __restrict__ _Buf,int _MaxCount,FILE * __restrict__ _File);
592 _CRTIMP int __cdecl _fileno(FILE *_File);
593 #ifdef _POSIX_
594 int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
595 #endif
596 _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix);
597 _CRTIMP int __cdecl _flushall(void);
598 FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
599 FILE *fopen64(const char * __restrict__ filename,const char * __restrict__ mode);
600 int __cdecl fputc(int _Ch,FILE *_File);
601 _CRTIMP int __cdecl _fputchar(int _Ch);
602 int __cdecl fputs(const char * __restrict__ _Str,FILE * __restrict__ _File);
603 size_t __cdecl fread(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File);
604 FILE *__cdecl freopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode,FILE * __restrict__ _File) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
605 int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos);
606 int __cdecl fsetpos64(FILE *_File,const fpos_t *_Pos); /* fsetpos already 64bit */
607 int __cdecl fseek(FILE *_File,long _Offset,int _Origin);
608 long __cdecl ftell(FILE *_File);
609
610 /* Shouldn't be any fseeko32 in glibc, 32bit to 64bit casting should be fine */
611 /* int fseeko32(FILE* stream, _off_t offset, int whence);*/ /* fseeko32 redirects to fseeko64 */
612 _CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
613 _CRTIMP __int64 __cdecl _ftelli64(FILE *_File);
614 #if __MSVCRT_VERSION__ >= 0x1400
fseeko(FILE * _File,_off_t _Offset,int _Origin)615 __mingw_static_ovr int fseeko(FILE *_File, _off_t _Offset, int _Origin) {
616 return fseek(_File, _Offset, _Origin);
617 }
fseeko64(FILE * _File,_off64_t _Offset,int _Origin)618 __mingw_static_ovr int fseeko64(FILE *_File, _off64_t _Offset, int _Origin) {
619 return _fseeki64(_File, _Offset, _Origin);
620 }
ftello(FILE * _File)621 __mingw_static_ovr _off_t ftello(FILE *_File) {
622 return ftell(_File);
623 }
ftello64(FILE * _File)624 __mingw_static_ovr _off64_t ftello64(FILE *_File) {
625 return _ftelli64(_File);
626 }
627 #else
628 int fseeko64(FILE* stream, _off64_t offset, int whence);
629 int fseeko(FILE* stream, _off_t offset, int whence);
630 /* Returns truncated 64bit off_t */
631 _off_t ftello(FILE * stream);
632 _off64_t ftello64(FILE * stream);
633 #endif
634
635 #ifndef _FILE_OFFSET_BITS_SET_FSEEKO
636 #define _FILE_OFFSET_BITS_SET_FSEEKO
637 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
638 #define fseeko fseeko64
639 #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */
640 #endif /* _FILE_OFFSET_BITS_SET_FSEEKO */
641
642 #ifndef _FILE_OFFSET_BITS_SET_FTELLO
643 #define _FILE_OFFSET_BITS_SET_FTELLO
644 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
645 #define ftello ftello64
646 #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */
647 #endif /* _FILE_OFFSET_BITS_SET_FTELLO */
648
649 size_t __cdecl fwrite(const void * __restrict__ _Str,size_t _Size,size_t _Count,FILE * __restrict__ _File);
650 int __cdecl getc(FILE *_File);
651 int __cdecl getchar(void);
652 _CRTIMP int __cdecl _getmaxstdio(void);
653 char *__cdecl gets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
654 int __cdecl _getw(FILE *_File);
655 #ifndef _CRT_PERROR_DEFINED
656 #define _CRT_PERROR_DEFINED
657 void __cdecl perror(const char *_ErrMsg);
658 #endif
659 _CRTIMP int __cdecl _pclose(FILE *_File);
660 _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode);
661 #if !defined(NO_OLDNAMES) && !defined(popen)
662 #define popen _popen
663 #define pclose _pclose
664 #endif
665 int __cdecl putc(int _Ch,FILE *_File);
666 int __cdecl putchar(int _Ch);
667 int __cdecl puts(const char *_Str);
668 _CRTIMP int __cdecl _putw(int _Word,FILE *_File);
669 #ifndef _CRT_DIRECTORY_DEFINED
670 #define _CRT_DIRECTORY_DEFINED
671 int __cdecl remove(const char *_Filename);
672 int __cdecl rename(const char *_OldFilename,const char *_NewFilename);
673 _CRTIMP int __cdecl _unlink(const char *_Filename);
674 #ifndef NO_OLDNAMES
675 int __cdecl unlink(const char *_Filename) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
676 #endif
677 #endif
678 void __cdecl rewind(FILE *_File);
679 _CRTIMP int __cdecl _rmtmp(void);
680 void __cdecl setbuf(FILE * __restrict__ _File,char * __restrict__ _Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
681 _CRTIMP int __cdecl _setmaxstdio(int _Max);
682 _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format);
683 _CRTIMP unsigned int __cdecl _get_output_format(void);
684 int __cdecl setvbuf(FILE * __restrict__ _File,char * __restrict__ _Buf,int _Mode,size_t _Size);
685 #if __MSVCRT_VERSION__ >= 0x1400
686 __mingw_ovr
_scprintf(const char * __restrict__ _Format,...)687 int __cdecl _scprintf(const char * __restrict__ _Format,...)
688 {
689 __builtin_va_list ap;
690 int ret;
691 __builtin_va_start(ap, _Format);
692 ret = __stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, ap);
693 __builtin_va_end(ap);
694 return ret;
695 }
696 __mingw_ovr
_snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...)697 int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
698 {
699 __builtin_va_list ap;
700 int ret;
701 __builtin_va_start(ap, _Format);
702 ret = __stdio_common_vsscanf(0, _Src, _MaxCount, _Format, NULL, ap);
703 __builtin_va_end(ap);
704 return ret;
705 }
706 #else
707 _CRTIMP int __cdecl _scprintf(const char * __restrict__ _Format,...);
708 _CRTIMP int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
709 #endif
710 FILE *__cdecl tmpfile(void) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
711 char *__cdecl tmpnam(char *_Buffer);
712 int __cdecl ungetc(int _Ch,FILE *_File);
713
714 #if __MSVCRT_VERSION__ >= 0x1400
715 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
716 int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
717 __mingw_ovr
718 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
_snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...)719 int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
720 {
721 __builtin_va_list ap;
722 int ret;
723 __builtin_va_start(ap, _Format);
724 ret = _vsnprintf(_Dest, _Count, _Format, ap);
725 __builtin_va_end(ap);
726 return ret;
727 }
728 #else
729 __attribute__((__format__ (ms_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
730 _CRTIMP int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
731 __attribute__((__format__ (ms_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
732 _CRTIMP int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
733 #endif
734
735 #if __USE_MINGW_ANSI_STDIO == 0
736
737 #if __MSVCRT_VERSION__ >= 0x1400
738 #ifdef __GNUC__
739 #pragma GCC diagnostic push
740 #pragma GCC diagnostic ignored "-Wshadow"
741 #endif
742 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
743 int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv);
744
745 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
746 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...);
747 #ifdef __GNUC__
748 #pragma GCC diagnostic pop
749 #endif
750 #else
751
752 /* this is here to deal with software defining
753 * vsnprintf as _vsnprintf, eg. libxml2. */
754
755 #ifdef __GNUC__
756 #pragma GCC diagnostic push
757 #pragma GCC diagnostic ignored "-Wshadow"
758 #endif
759
760 #pragma push_macro("snprintf")
761 #pragma push_macro("vsnprintf")
762 # undef snprintf
763 # undef vsnprintf
764 __attribute__((__format__ (ms_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
765 int __cdecl __ms_vsnprintf(char * __restrict__ d,size_t n,const char * __restrict__ format,va_list arg)
766 __MINGW_ATTRIB_DEPRECATED_MSVC2005 __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
767
768 __mingw_ovr
769 __attribute__((__format__ (ms_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
vsnprintf(char * __restrict__ __stream,size_t __n,const char * __restrict__ __format,va_list __local_argv)770 int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv)
771 {
772 return __ms_vsnprintf (__stream, __n, __format, __local_argv);
773 }
774
775 __attribute__((__format__ (ms_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
776 int __cdecl __ms_snprintf(char * __restrict__ s, size_t n, const char * __restrict__ format, ...);
777
778 #ifndef __NO_ISOCEXT
779 __mingw_ovr
780 __attribute__((__format__ (ms_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
snprintf(char * __restrict__ __stream,size_t __n,const char * __restrict__ __format,...)781 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...)
782 {
783 int __retval;
784 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
785 __retval = __ms_vsnprintf (__stream, __n, __format, __local_argv);
786 __builtin_va_end( __local_argv );
787 return __retval;
788 }
789 #endif /* !__NO_ISOCEXT */
790
791 #pragma pop_macro ("vsnprintf")
792 #pragma pop_macro ("snprintf")
793 #ifdef __GNUC__
794 #pragma GCC diagnostic pop
795 #endif
796 #endif /* __MSVCRT_VERSION__ >= 0x1400 */
797 #endif /* __USE_MINGW_ANSI_STDIO */
798
799 #if __MSVCRT_VERSION__ >= 0x1400
800 __mingw_ovr
_vscprintf(const char * __restrict__ _Format,va_list _ArgList)801 int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList)
802 {
803 return __stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, _ArgList);
804 }
805 #else
806 _CRTIMP int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList);
807 #endif /* __MSVCRT_VERSION__ >= 0x1400 */
808
809 _CRTIMP int __cdecl _set_printf_count_output(int _Value);
810 _CRTIMP int __cdecl _get_printf_count_output(void);
811
812 #ifndef _WSTDIO_DEFINED
813 #define _WSTDIO_DEFINED
814
815 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
816 int __cdecl __mingw_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...);
817 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
818 int __cdecl __mingw_vswscanf (const wchar_t * __restrict__ _Str,const wchar_t * __restrict__ Format,va_list argp);
819 /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
820 int __cdecl __mingw_wscanf(const wchar_t * __restrict__ _Format,...);
821 /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
822 int __cdecl __mingw_vwscanf(const wchar_t * __restrict__ Format, va_list argp);
823 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
824 int __cdecl __mingw_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
825 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
826 int __cdecl __mingw_vfwscanf (FILE * __restrict__ fp, const wchar_t * __restrict__ Format,va_list argp);
827
828 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
829 int __cdecl __mingw_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
830 /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
831 int __cdecl __mingw_wprintf(const wchar_t * __restrict__ _Format,...);
832 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2)
833 int __cdecl __mingw_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList);
834 /*__attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
835 int __cdecl __mingw_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
836 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3)
837 int __cdecl __mingw_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...);
838 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3)
839 int __cdecl __mingw_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list);
840 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
841 int __cdecl __mingw_swprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...);
842 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
843 int __cdecl __mingw_vswprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ ,va_list);
844
845 #if __MSVCRT_VERSION__ >= 0x1400
846 int __cdecl __stdio_common_vswprintf(unsigned __int64 options, wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist);
847 int __cdecl __stdio_common_vfwprintf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist);
848 int __cdecl __stdio_common_vswscanf(unsigned __int64 options, const wchar_t *input, size_t length, const wchar_t *format, _locale_t locale, va_list valist);
849 int __cdecl __stdio_common_vfwscanf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist);
850 #endif
851
852 #if __USE_MINGW_ANSI_STDIO
853 /*
854 * User has expressed a preference for C99 conformance...
855 */
856
857 __mingw_ovr
858 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
swscanf(const wchar_t * __source,const wchar_t * __format,...)859 int swscanf(const wchar_t *__source, const wchar_t *__format, ...)
860 {
861 int __retval;
862 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
863 __retval = __mingw_vswscanf( __source, __format, __local_argv );
864 __builtin_va_end( __local_argv );
865 return __retval;
866 }
867
868 __mingw_ovr
869 /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
wscanf(const wchar_t * __format,...)870 int wscanf(const wchar_t *__format, ...)
871 {
872 int __retval;
873 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
874 __retval = __mingw_vfwscanf( stdin, __format, __local_argv );
875 __builtin_va_end( __local_argv );
876 return __retval;
877 }
878
879 __mingw_ovr
880 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
fwscanf(FILE * __stream,const wchar_t * __format,...)881 int fwscanf(FILE *__stream, const wchar_t *__format, ...)
882 {
883 int __retval;
884 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
885 __retval = __mingw_vfwscanf( __stream, __format, __local_argv );
886 __builtin_va_end( __local_argv );
887 return __retval;
888 }
889
890 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
891 __mingw_ovr
892 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
vswscanf(const wchar_t * __restrict__ __source,const wchar_t * __restrict__ __format,__builtin_va_list __local_argv)893 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv)
894 {
895 return __mingw_vswscanf( __source, __format, __local_argv );
896 }
897
898 __mingw_ovr
899 /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
vwscanf(const wchar_t * __format,__builtin_va_list __local_argv)900 int vwscanf(const wchar_t *__format, __builtin_va_list __local_argv)
901 {
902 return __mingw_vfwscanf( stdin, __format, __local_argv );
903 }
904
905 __mingw_ovr
906 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
vfwscanf(FILE * __stream,const wchar_t * __format,__builtin_va_list __local_argv)907 int vfwscanf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv)
908 {
909 return __mingw_vfwscanf( __stream, __format, __local_argv );
910 }
911 #endif /* __NO_ISOCEXT */
912
913
914
915 __mingw_ovr
916 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
fwprintf(FILE * __stream,const wchar_t * __format,...)917 int fwprintf (FILE *__stream, const wchar_t *__format, ...)
918 {
919 int __retval;
920 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
921 __retval = __mingw_vfwprintf( __stream, __format, __local_argv );
922 __builtin_va_end( __local_argv );
923 return __retval;
924 }
925
926 __mingw_ovr
927 /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1)
wprintf(const wchar_t * __format,...)928 int wprintf (const wchar_t *__format, ...)
929 {
930 int __retval;
931 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
932 __retval = __mingw_vfwprintf( stdout, __format, __local_argv );
933 __builtin_va_end( __local_argv );
934 return __retval;
935 }
936
937 __mingw_ovr
938 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
vfwprintf(FILE * __stream,const wchar_t * __format,__builtin_va_list __local_argv)939 int vfwprintf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv)
940 {
941 return __mingw_vfwprintf( __stream, __format, __local_argv );
942 }
943
944 __mingw_ovr
945 /* __attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1)
vwprintf(const wchar_t * __format,__builtin_va_list __local_argv)946 int vwprintf (const wchar_t *__format, __builtin_va_list __local_argv)
947 {
948 return __mingw_vfwprintf( stdout, __format, __local_argv );
949 }
950
951 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
952 __mingw_ovr
953 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3)
snwprintf(wchar_t * __stream,size_t __n,const wchar_t * __format,...)954 int snwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...)
955 {
956 int __retval;
957 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
958 __retval = __mingw_vsnwprintf( __stream, __n, __format, __local_argv );
959 __builtin_va_end( __local_argv );
960 return __retval;
961 }
962
963 __mingw_ovr
964 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3)
vsnwprintf(wchar_t * __stream,size_t __n,const wchar_t * __format,__builtin_va_list __local_argv)965 int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builtin_va_list __local_argv)
966 {
967 return __mingw_vsnwprintf( __stream, __n, __format, __local_argv );
968 }
969 #endif /* __NO_ISOCEXT */
970
971 #else /* !__USE_MINGW_ANSI_STDIO */
972
973 #if __MSVCRT_VERSION__ >= 0x1400
974 __mingw_ovr
fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...)975 int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
976 {
977 __builtin_va_list ap;
978 int ret;
979 __builtin_va_start(ap, _Format);
980 ret = __stdio_common_vfwscanf(UCRTBASE_SCANF_DEFAULT_WIDE, _File, _Format, NULL, ap);
981 __builtin_va_end(ap);
982 return ret;
983 }
984 __mingw_ovr
swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...)985 int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
986 {
987 __builtin_va_list ap;
988 int ret;
989 __builtin_va_start(ap, _Format);
990 ret = __stdio_common_vswscanf(UCRTBASE_SCANF_DEFAULT_WIDE, _Src, (size_t)-1, _Format, NULL, ap);
991 __builtin_va_end(ap);
992 return ret;
993 }
994 __mingw_ovr
wscanf(const wchar_t * __restrict__ _Format,...)995 int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
996 {
997 __builtin_va_list ap;
998 int ret;
999 __builtin_va_start(ap, _Format);
1000 ret = __stdio_common_vfwscanf(UCRTBASE_SCANF_DEFAULT_WIDE, stdin, _Format, NULL, ap);
1001 __builtin_va_end(ap);
1002 return ret;
1003 }
1004 __mingw_ovr
1005 __MINGW_ATTRIB_NONNULL(2)
vfwscanf(FILE * __stream,const wchar_t * __format,va_list __local_argv)1006 int vfwscanf (FILE *__stream, const wchar_t *__format, va_list __local_argv)
1007 {
1008 return __stdio_common_vfwscanf(UCRTBASE_SCANF_DEFAULT_WIDE, __stream, __format, NULL, __local_argv);
1009 }
1010
1011 __mingw_ovr
1012 __MINGW_ATTRIB_NONNULL(2)
vswscanf(const wchar_t * __restrict__ __source,const wchar_t * __restrict__ __format,va_list __local_argv)1013 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, va_list __local_argv)
1014 {
1015 return __stdio_common_vswscanf(UCRTBASE_SCANF_DEFAULT_WIDE, __source, (size_t)-1, __format, NULL, __local_argv);
1016 }
1017 __mingw_ovr
1018 __MINGW_ATTRIB_NONNULL(1)
vwscanf(const wchar_t * __format,va_list __local_argv)1019 int vwscanf(const wchar_t *__format, va_list __local_argv)
1020 {
1021 return __stdio_common_vfwscanf(UCRTBASE_SCANF_DEFAULT_WIDE, stdin, __format, NULL, __local_argv);
1022 }
1023
1024 __mingw_static_ovr
fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...)1025 int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...)
1026 {
1027 __builtin_va_list ap;
1028 int ret;
1029 __builtin_va_start(ap, _Format);
1030 ret = __stdio_common_vfwprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, _File, _Format, NULL, ap);
1031 __builtin_va_end(ap);
1032 return ret;
1033 }
1034 __mingw_ovr
wprintf(const wchar_t * __restrict__ _Format,...)1035 int __cdecl wprintf(const wchar_t * __restrict__ _Format,...)
1036 {
1037 __builtin_va_list ap;
1038 int ret;
1039 __builtin_va_start(ap, _Format);
1040 ret = __stdio_common_vfwprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, stdout, _Format, NULL, ap);
1041 __builtin_va_end(ap);
1042 return ret;
1043 }
1044 __mingw_ovr
vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList)1045 int __cdecl vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList)
1046 {
1047 return __stdio_common_vfwprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, _File, _Format, NULL, _ArgList);
1048 }
1049 __mingw_ovr
vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList)1050 int __cdecl vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList)
1051 {
1052 return __stdio_common_vfwprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, stdout, _Format, NULL, _ArgList);
1053 }
1054 #else
1055
1056 int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1057 int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1058 int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1059 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
1060 int __cdecl __ms_vwscanf (const wchar_t * __restrict__ , va_list);
1061 int __cdecl __ms_vfwscanf (FILE * __restrict__ ,const wchar_t * __restrict__ ,va_list);
1062 int __cdecl __ms_vswscanf (const wchar_t * __restrict__ ,const wchar_t * __restrict__ ,va_list);
1063
1064 __mingw_ovr
1065 __MINGW_ATTRIB_NONNULL(2)
vfwscanf(FILE * __stream,const wchar_t * __format,__builtin_va_list __local_argv)1066 int vfwscanf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv)
1067 {
1068 return __ms_vfwscanf (__stream, __format, __local_argv);
1069 }
1070
1071 __mingw_ovr
1072 __MINGW_ATTRIB_NONNULL(2)
vswscanf(const wchar_t * __restrict__ __source,const wchar_t * __restrict__ __format,__builtin_va_list __local_argv)1073 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv)
1074 {
1075 return __ms_vswscanf( __source, __format, __local_argv );
1076 }
1077 __mingw_ovr
1078 __MINGW_ATTRIB_NONNULL(1)
vwscanf(const wchar_t * __format,__builtin_va_list __local_argv)1079 int vwscanf(const wchar_t *__format, __builtin_va_list __local_argv)
1080 {
1081 return __ms_vwscanf (__format, __local_argv);
1082 }
1083
1084 #endif /* __NO_ISOCEXT */
1085
1086 int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...);
1087 int __cdecl wprintf(const wchar_t * __restrict__ _Format,...);
1088 int __cdecl vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList);
1089 int __cdecl vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
1090 #endif /* __MSVCRT_VERSION__ >= 0x1400 */
1091 #endif /* __USE_MINGW_ANSI_STDIO */
1092
1093 #ifndef WEOF
1094 #define WEOF (wint_t)(0xFFFF)
1095 #endif
1096
1097 #ifdef _POSIX_
1098 _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode);
1099 #else
1100 _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag);
1101 #endif
1102
1103 wint_t __cdecl fgetwc(FILE *_File);
1104 _CRTIMP wint_t __cdecl _fgetwchar(void);
1105 wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
1106 _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
1107 wint_t __cdecl getwc(FILE *_File);
1108 wint_t __cdecl getwchar(void);
1109 wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
1110 wint_t __cdecl putwchar(wchar_t _Ch);
1111 wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
1112 wchar_t *__cdecl fgetws(wchar_t * __restrict__ _Dst,int _SizeInWords,FILE * __restrict__ _File);
1113 int __cdecl fputws(const wchar_t * __restrict__ _Str,FILE * __restrict__ _File);
1114 _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1115 _CRTIMP int __cdecl _putws(const wchar_t *_Str);
1116
1117 #if __MSVCRT_VERSION__ >= 0x1400
1118 __mingw_ovr
_scwprintf(const wchar_t * __restrict__ _Format,...)1119 int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...)
1120 {
1121 __builtin_va_list ap;
1122 int ret;
1123 __builtin_va_start(ap, _Format);
1124 ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, ap);
1125 __builtin_va_end(ap);
1126 return ret;
1127 }
1128 __mingw_static_ovr
_snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...)1129 int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
1130 {
1131 __builtin_va_list ap;
1132 int ret;
1133 __builtin_va_start(ap, _Format);
1134 ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, ap);
1135 __builtin_va_end(ap);
1136 return ret;
1137 }
1138 int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1139
1140 #if __USE_MINGW_ANSI_STDIO == 0
1141 __mingw_ovr
snwprintf(wchar_t * __restrict__ s,size_t n,const wchar_t * __restrict__ format,...)1142 int snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...)
1143 {
1144 __builtin_va_list ap;
1145 int ret;
1146 __builtin_va_start(ap, format);
1147 ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, s, n, format, NULL, ap);
1148 __builtin_va_end(ap);
1149 return ret;
1150 }
1151 __mingw_ovr
vsnwprintf(wchar_t * __restrict__ s,size_t n,const wchar_t * __restrict__ format,va_list arg)1152 int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg)
1153 {
1154 return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, s, n, format, NULL, arg);
1155 }
1156 #endif
1157
1158 __mingw_ovr
_swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...)1159 int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...)
1160 {
1161 __builtin_va_list ap;
1162 int ret;
1163 __builtin_va_start(ap, _Format);
1164 ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, _Dest, (size_t)-1, _Format, NULL, ap);
1165 __builtin_va_end(ap);
1166 return ret;
1167 }
1168 __mingw_ovr
_vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args)1169 int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args)
1170 {
1171 return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, _Dest, (size_t)-1, _Format, NULL, _Args);
1172 }
1173
1174 __mingw_ovr
_vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList)1175 int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format, va_list _ArgList)
1176 {
1177 int _Result = __stdio_common_vswprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, _ArgList);
1178 return _Result < 0 ? -1 : _Result;
1179 }
1180 #else
1181 _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...);
1182 _CRTIMP int __cdecl _swprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,...);
1183 _CRTIMP int __cdecl _vswprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,va_list _ArgList);
1184 _CRTIMP int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1185 _CRTIMP int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1186 _CRTIMP int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
1187
1188 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
1189
1190 #if __USE_MINGW_ANSI_STDIO == 0
1191 #pragma push_macro("snwprintf")
1192 #pragma push_macro("vsnwprintf")
1193 # undef snwprintf
1194 # undef vsnwprintf
1195 int __cdecl __ms_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...);
1196 int __cdecl __ms_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list);
1197 __mingw_ovr
snwprintf(wchar_t * __restrict__ s,size_t n,const wchar_t * __restrict__ format,...)1198 int snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...)
1199 {
1200 int r;
1201 va_list argp;
1202 __builtin_va_start (argp, format);
1203 r = _vsnwprintf (s, n, format, argp);
1204 __builtin_va_end (argp);
1205 return r;
1206 }
1207 __mingw_ovr
vsnwprintf(wchar_t * __restrict__ s,size_t n,const wchar_t * __restrict__ format,va_list arg)1208 int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg)
1209 {
1210 return _vsnwprintf(s,n,format,arg);
1211 }
1212 #pragma pop_macro ("vsnwprintf")
1213 #pragma pop_macro ("snwprintf")
1214 #endif
1215
1216 #endif /* ! __NO_ISOCEXT */
1217 _CRTIMP int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...);
1218 _CRTIMP int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args);
1219 #endif /* __MSVCRT_VERSION__ >= 0x1400 */
1220
1221 #ifndef RC_INVOKED
1222 #include <swprintf.inl>
1223 #endif
1224
1225 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
1226 #ifndef __cplusplus
1227 #define _swprintf_l __swprintf_l
1228 #define _vswprintf_l __vswprintf_l
1229 #endif
1230 #endif
1231
1232 _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix);
1233 _CRTIMP int __cdecl _snwscanf(const wchar_t * __restrict__ _Src,size_t _MaxCount,const wchar_t * __restrict__ _Format,...);
1234 _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode);
1235 _CRTIMP FILE *__cdecl _wfopen(const wchar_t * __restrict__ _Filename,const wchar_t *__restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1236 _CRTIMP FILE *__cdecl _wfreopen(const wchar_t * __restrict__ _Filename,const wchar_t * __restrict__ _Mode,FILE * __restrict__ _OldFile) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
1237
1238 #ifndef _CRT_WPERROR_DEFINED
1239 #define _CRT_WPERROR_DEFINED
1240 _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
1241 #endif
1242 _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode);
1243 #if !defined(NO_OLDNAMES) && !defined(wpopen)
1244 #define wpopen _wpopen
1245 #endif
1246
1247 _CRTIMP int __cdecl _wremove(const wchar_t *_Filename);
1248 _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer);
1249 _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File);
1250 _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File);
1251 _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File);
1252
1253 #undef _CRT_GETPUTWCHAR_NOINLINE
1254
1255 #if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) || defined (__CRT__NO_INLINE)
1256 #define getwchar() fgetwc(stdin)
1257 #define putwchar(_c) fputwc((_c),stdout)
1258 #else
getwchar()1259 __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); }
putwchar(wchar_t _C)1260 __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); }
1261 #endif
1262
1263 #define getwc(_stm) fgetwc(_stm)
1264 #define putwc(_c,_stm) fputwc(_c,_stm)
1265 #define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
1266 #define _getwc_nolock(_c) _fgetwc_nolock(_c)
1267 #endif
1268
1269 #define _STDIO_DEFINED
1270 #endif
1271
1272 #if __MSVCRT_VERSION__ >= 0x1400
1273 _CRTIMP int __cdecl _fgetc_nolock(FILE *_File);
1274 _CRTIMP int __cdecl _fputc_nolock(int _Char, FILE *_File);
1275 _CRTIMP int __cdecl _getc_nolock(FILE *_File);
1276 _CRTIMP int __cdecl _putc_nolock(int _Char, FILE *_File);
1277 #else
1278 #define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
1279 #define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
1280 #define _getc_nolock(_stream) _fgetc_nolock(_stream)
1281 #define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream)
1282 #endif
1283 #define _getchar_nolock() _getc_nolock(stdin)
1284 #define _putchar_nolock(_c) _putc_nolock((_c),stdout)
1285 #define _getwchar_nolock() _getwc_nolock(stdin)
1286 #define _putwchar_nolock(_c) _putwc_nolock((_c),stdout)
1287
1288 _CRTIMP void __cdecl _lock_file(FILE *_File);
1289 _CRTIMP void __cdecl _unlock_file(FILE *_File);
1290 _CRTIMP int __cdecl _fclose_nolock(FILE *_File);
1291 _CRTIMP int __cdecl _fflush_nolock(FILE *_File);
1292 _CRTIMP size_t __cdecl _fread_nolock(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File);
1293 _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin);
1294 _CRTIMP long __cdecl _ftell_nolock(FILE *_File);
1295 __MINGW_EXTENSION _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin);
1296 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File);
1297 _CRTIMP size_t __cdecl _fwrite_nolock(const void * __restrict__ _DstBuf,size_t _Size,size_t _Count,FILE * __restrict__ _File);
1298 _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File);
1299
1300 #if !defined(NO_OLDNAMES) || !defined(_POSIX)
1301 #define P_tmpdir _P_tmpdir
1302 #define SYS_OPEN _SYS_OPEN
1303
1304 char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1305 int __cdecl fcloseall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1306 FILE *__cdecl fdopen(int _FileHandle,const char *_Format) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1307 int __cdecl fgetchar(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1308 int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1309 int __cdecl flushall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1310 int __cdecl fputchar(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1311 int __cdecl getw(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1312 int __cdecl putw(int _Ch,FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1313 int __cdecl rmtmp(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
1314 #endif
1315
1316 #ifndef __MINGW_MBWC_CONVERT_DEFINED
1317 #define __MINGW_MBWC_CONVERT_DEFINED
1318
1319 /**
1320 * __mingw_str_wide_utf8
1321 * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent.
1322 * Caller is supposed to free allocated buffer with __mingw_str_free().
1323 * @param[in] wptr Pointer to wide string.
1324 * @param[out] mbptr Pointer to multibyte string.
1325 * @param[out] buflen Optional parameter for length of allocated buffer.
1326 * @return Number of characters converted, 0 for failure.
1327 *
1328 * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx
1329 */
1330 int __cdecl __mingw_str_wide_utf8 (const wchar_t * const wptr, char **mbptr, size_t * buflen);
1331
1332 /**
1333 * __mingw_str_utf8_wide
1334 * Converts a null terminated UTF-8 string to a UCS-2 equivalent.
1335 * Caller is supposed to free allocated buffer with __mingw_str_free().
1336 * @param[out] mbptr Pointer to multibyte string.
1337 * @param[in] wptr Pointer to wide string.
1338 * @param[out] buflen Optional parameter for length of allocated buffer.
1339 * @return Number of characters converted, 0 for failure.
1340 *
1341 * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx
1342 */
1343
1344 int __cdecl __mingw_str_utf8_wide (const char *const mbptr, wchar_t ** wptr, size_t * buflen);
1345
1346 /**
1347 * __mingw_str_free
1348 * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide.
1349 * @param[in] ptr memory block to free.
1350 *
1351 */
1352
1353 void __cdecl __mingw_str_free(void *ptr);
1354
1355 #endif /* __MINGW_MBWC_CONVERT_DEFINED */
1356
1357 #ifndef _WSPAWN_DEFINED
1358 #define _WSPAWN_DEFINED
1359 _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
1360 _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
1361 _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
1362 _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
1363 _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
1364 _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
1365 _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
1366 _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
1367 #endif
1368
1369 #ifndef _P_WAIT
1370 #define _P_WAIT 0
1371 #define _P_NOWAIT 1
1372 #define _OLD_P_OVERLAY 2
1373 #define _P_NOWAITO 3
1374 #define _P_DETACH 4
1375 #define _P_OVERLAY 2
1376
1377 #define _WAIT_CHILD 0
1378 #define _WAIT_GRANDCHILD 1
1379 #endif
1380
1381 #ifndef _SPAWNV_DEFINED
1382 #define _SPAWNV_DEFINED
1383 _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList);
1384 _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env);
1385 _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList);
1386 _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env);
1387 #endif
1388
1389 #ifdef __cplusplus
1390 }
1391 #endif
1392
1393 #pragma pack(pop)
1394
1395 #include <sec_api/stdio_s.h>
1396
1397 #endif
1398