Import LibreSSL v2.4.2 to vendor branch
[dragonfly.git] / crypto / libressl / include / compat / stdio.h
bloba0dda6f11bdc2786212764d4020a3fb949a393db
1 /*
2 * Public domain
3 * stdio.h compatibility shim
4 */
6 #ifndef LIBCRYPTOCOMPAT_STDIO_H
7 #define LIBCRYPTOCOMPAT_STDIO_H
9 #ifdef _MSC_VER
10 #if _MSC_VER >= 1900
11 #include <../ucrt/stdlib.h>
12 #include <../ucrt/corecrt_io.h>
13 #include <../ucrt/stdio.h>
14 #else
15 #include <../include/stdio.h>
16 #endif
17 #else
18 #include_next <stdio.h>
19 #endif
21 #ifndef HAVE_ASPRINTF
22 #include <stdarg.h>
23 int vasprintf(char **str, const char *fmt, va_list ap);
24 int asprintf(char **str, const char *fmt, ...);
25 #endif
27 #ifdef _WIN32
29 void posix_perror(const char *s);
30 FILE * posix_fopen(const char *path, const char *mode);
31 char * posix_fgets(char *s, int size, FILE *stream);
32 int posix_rename(const char *oldpath, const char *newpath);
34 #ifndef NO_REDEF_POSIX_FUNCTIONS
35 #define perror(errnum) posix_perror(errnum)
36 #define fopen(path, mode) posix_fopen(path, mode)
37 #define fgets(s, size, stream) posix_fgets(s, size, stream)
38 #define rename(oldpath, newpath) posix_rename(oldpath, newpath)
39 #endif
41 #ifdef _MSC_VER
42 #define snprintf _snprintf
43 #endif
45 #endif
47 #endif