2014-11-19 07:43:07 -06:00
|
|
|
/*
|
|
|
|
* Public domain
|
|
|
|
* stdio.h compatibility shim
|
|
|
|
*/
|
|
|
|
|
2014-07-28 19:26:15 -05:00
|
|
|
#ifndef LIBCRYPTOCOMPAT_STDIO_H
|
|
|
|
#define LIBCRYPTOCOMPAT_STDIO_H
|
|
|
|
|
2014-07-10 22:06:10 -05:00
|
|
|
#ifdef _MSC_VER
|
2015-09-08 15:00:09 -05:00
|
|
|
#if _MSC_VER >= 1900
|
|
|
|
#include <../ucrt/stdlib.h>
|
|
|
|
#include <../ucrt/corecrt_io.h>
|
|
|
|
#include <../ucrt/stdio.h>
|
|
|
|
#else
|
2014-07-10 22:06:10 -05:00
|
|
|
#include <../include/stdio.h>
|
2015-09-08 15:00:09 -05:00
|
|
|
#endif
|
2014-07-10 22:06:10 -05:00
|
|
|
#else
|
|
|
|
#include_next <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
2014-10-29 15:44:36 -05:00
|
|
|
#ifndef HAVE_ASPRINTF
|
2014-08-12 17:21:48 +09:00
|
|
|
#include <stdarg.h>
|
2014-07-28 19:26:15 -05:00
|
|
|
int vasprintf(char **str, const char *fmt, va_list ap);
|
|
|
|
int asprintf(char **str, const char *fmt, ...);
|
|
|
|
#endif
|
|
|
|
|
2014-11-20 07:32:15 -06:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
2017-01-16 10:36:05 -06:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define __func__ __FUNCTION__
|
|
|
|
#endif
|
|
|
|
|
2015-06-05 04:31:56 -05:00
|
|
|
void posix_perror(const char *s);
|
|
|
|
FILE * posix_fopen(const char *path, const char *mode);
|
2015-12-05 13:58:37 -06:00
|
|
|
char * posix_fgets(char *s, int size, FILE *stream);
|
2015-06-05 04:31:56 -05:00
|
|
|
int posix_rename(const char *oldpath, const char *newpath);
|
2014-11-20 07:32:15 -06:00
|
|
|
|
2015-06-05 04:31:56 -05:00
|
|
|
#ifndef NO_REDEF_POSIX_FUNCTIONS
|
2014-11-20 07:32:15 -06:00
|
|
|
#define perror(errnum) posix_perror(errnum)
|
2015-06-05 03:31:28 -05:00
|
|
|
#define fopen(path, mode) posix_fopen(path, mode)
|
2015-12-05 13:58:37 -06:00
|
|
|
#define fgets(s, size, stream) posix_fgets(s, size, stream)
|
2015-06-05 04:31:56 -05:00
|
|
|
#define rename(oldpath, newpath) posix_rename(oldpath, newpath)
|
|
|
|
#endif
|
2015-06-05 03:31:28 -05:00
|
|
|
|
2014-07-10 22:06:10 -05:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define snprintf _snprintf
|
|
|
|
#endif
|
|
|
|
|
2014-11-20 07:32:15 -06:00
|
|
|
#endif
|
|
|
|
|
2014-07-28 19:26:15 -05:00
|
|
|
#endif
|