#ifndef GFLAGS_WINDOWS_PORT_H_
#define GFLAGS_WINDOWS_PORT_H_
#include "config.h"
# if !defined(_WIN32_WINNT) && !(defined( __MINGW32__) || defined(__MINGW64__))
# define _WIN32_WINNT 0x0400
# endif
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#if !defined(__MINGW32__) && !defined(__MINGW64__)
#if !(defined(_MSC_VER) && _MSC_VER >= 1900)
extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
const char *format, ...);
extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
#define va_copy(dst, src) (dst) = (src)
#endif
#endif
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4996)
#endif
inline void setenv(const char* name, const char* value, int) {
static const char* const kFakeZero = "0";
if (*value == '\0')
value = kFakeZero;
const size_t nameval_len = strlen(name) + 1 + strlen(value) + 1;
char* nameval = reinterpret_cast<char*>(malloc(nameval_len));
snprintf(nameval, nameval_len, "%s=%s", name, value);
_putenv(nameval);
if (value == kFakeZero) {
nameval[nameval_len - 2] = '\0'; if (*getenv(name) != '\0')
*getenv(name) = '\0'; }
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#define strcasecmp _stricmp
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define strdup _strdup
#define unlink _unlink
#endif
#if !(defined(_MSC_VER) && _MSC_VER >= 1900)
#define PRId32 "d"
#define PRIu32 "u"
#define PRId64 "I64d"
#define PRIu64 "I64u"
#endif
#if !defined(__MINGW32__) && !defined(__MINGW64__)
#define strtoq _strtoi64
#define strtouq _strtoui64
#define strtoll _strtoi64
#define strtoull _strtoui64
#define atoll _atoi64
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#endif