xref: /reactos/sdk/lib/crt/printf/vfprintf_s.c (revision c2c66aff)
1 /*
2  * COPYRIGHT:       GNU GPL, see COPYING in the top level directory
3  * PROJECT:         ReactOS crt library
4  * FILE:            lib/sdk/crt/printf/vfprintf_s.c
5  * PURPOSE:         Implementation of vfprintf_s
6  * PROGRAMMER:      Samuel Serapi�n
7  */
8 
9 #define MINGW_HAS_SECURE_API 1
10 
11 #include <stdio.h>
12 #include <stdarg.h>
13 #include <internal/safecrt.h>
14 
15 int __cdecl streamout(FILE *stream, const char *format, va_list argptr);
16 
17 int
18 __cdecl
vfprintf_s(FILE * file,const char * format,va_list argptr)19 vfprintf_s(FILE* file, const char *format, va_list argptr)
20 {
21     int result;
22 
23     if(!MSVCRT_CHECK_PMT(format != NULL)) {
24         _set_errno(EINVAL);
25         return -1;
26     }
27 
28     _lock_file(file);
29     result = streamout(file, format, argptr);
30     _unlock_file(file);
31 
32     return result;
33 }
34