diff options
author | June McEnroe <june@causal.agency> | 2020-07-27 21:55:29 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-30 19:02:22 -0400 |
commit | 4bb261b015d382a567563571ae4d399a16caebe2 (patch) | |
tree | 19862c3060f67c92df964ed948084e234e7a4952 /include/compat/stdio.h | |
parent | import: Add script to extract libtls from libressl-portable (diff) | |
download | libretls-4bb261b015d382a567563571ae4d399a16caebe2.tar.gz libretls-4bb261b015d382a567563571ae4d399a16caebe2.zip |
Import LibreSSL 3.2.0
Diffstat (limited to '')
-rw-r--r-- | include/compat/stdio.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/compat/stdio.h b/include/compat/stdio.h new file mode 100644 index 0000000..d5725c9 --- /dev/null +++ b/include/compat/stdio.h @@ -0,0 +1,51 @@ +/* + * Public domain + * stdio.h compatibility shim + */ + +#ifndef LIBCRYPTOCOMPAT_STDIO_H +#define LIBCRYPTOCOMPAT_STDIO_H + +#ifdef _MSC_VER +#if _MSC_VER >= 1900 +#include <../ucrt/stdlib.h> +#include <../ucrt/corecrt_io.h> +#include <../ucrt/stdio.h> +#else +#include <../include/stdio.h> +#endif +#else +#include_next <stdio.h> +#endif + +#ifndef HAVE_ASPRINTF +#include <stdarg.h> +int vasprintf(char **str, const char *fmt, va_list ap); +int asprintf(char **str, const char *fmt, ...); +#endif + +#ifdef _WIN32 + +#if defined(_MSC_VER) +#define __func__ __FUNCTION__ +#endif + +void posix_perror(const char *s); +FILE * posix_fopen(const char *path, const char *mode); +char * posix_fgets(char *s, int size, FILE *stream); +int posix_rename(const char *oldpath, const char *newpath); + +#ifndef NO_REDEF_POSIX_FUNCTIONS +#define perror(errnum) posix_perror(errnum) +#define fopen(path, mode) posix_fopen(path, mode) +#define fgets(s, size, stream) posix_fgets(s, size, stream) +#define rename(oldpath, newpath) posix_rename(oldpath, newpath) +#endif + +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + +#endif + +#endif |