diff options
Diffstat (limited to 'include/compat/stdio.h')
-rw-r--r-- | include/compat/stdio.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/compat/stdio.h b/include/compat/stdio.h new file mode 100644 index 0000000..973faa4 --- /dev/null +++ b/include/compat/stdio.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * stdio.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef LIBCRYPTOCOMPAT_STDIO_H | ||
7 | #define LIBCRYPTOCOMPAT_STDIO_H | ||
8 | |||
9 | #ifdef _MSC_VER | ||
10 | #include <../include/stdio.h> | ||
11 | #else | ||
12 | #include_next <stdio.h> | ||
13 | #endif | ||
14 | |||
15 | #ifndef HAVE_ASPRINTF | ||
16 | #include <stdarg.h> | ||
17 | int vasprintf(char **str, const char *fmt, va_list ap); | ||
18 | int asprintf(char **str, const char *fmt, ...); | ||
19 | #endif | ||
20 | |||
21 | #ifdef _WIN32 | ||
22 | |||
23 | void posix_perror(const char *s); | ||
24 | FILE * posix_fopen(const char *path, const char *mode); | ||
25 | int posix_rename(const char *oldpath, const char *newpath); | ||
26 | |||
27 | #ifndef NO_REDEF_POSIX_FUNCTIONS | ||
28 | #define perror(errnum) posix_perror(errnum) | ||
29 | #define fopen(path, mode) posix_fopen(path, mode) | ||
30 | #define rename(oldpath, newpath) posix_rename(oldpath, newpath) | ||
31 | #endif | ||
32 | |||
33 | #ifdef _MSC_VER | ||
34 | #define snprintf _snprintf | ||
35 | #endif | ||
36 | |||
37 | #endif | ||
38 | |||
39 | #endif | ||