Mingw-w64 on windows doesn't have setenv, fix that.
Signed-off-by: HE, Tao <sighingnow@gmail.com>
This commit is contained in:
1 parent
fb1c635af6
commit
b436156f5b
2 files changed
+22
No files matched your search
@@ -124,6 +124,7 @@ AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
|
|||||||
AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
|
AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
|
||||||
AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])
|
AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])
|
||||||
AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])
|
AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])
|
||||||
|
AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0])
|
||||||
AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])
|
AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])
|
||||||
AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
|
AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
|
||||||
AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
|
AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
|
||||||
|
|||||||
@@ -1186,6 +1186,27 @@ static jv tm2jv(struct tm *tm) {
|
|||||||
jv_number(tm->tm_yday));
|
jv_number(tm->tm_yday));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(WIN32) && !defined(HAVE_SETENV)
|
||||||
|
static int setenv(const char *var, const char *val, int ovr)
|
||||||
|
{
|
||||||
|
BOOL b;
|
||||||
|
char c[2];
|
||||||
|
if (!ovr)
|
||||||
|
{
|
||||||
|
DWORD d;
|
||||||
|
d = GetEnvironmentVariableA (var, c, 2);
|
||||||
|
if (0 != d && GetLastError () != ERROR_ENVVAR_NOT_FOUND) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b = SetEnvironmentVariableA (var, val);
|
||||||
|
if (b) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mktime() has side-effects and anyways, returns time in the local
|
* mktime() has side-effects and anyways, returns time in the local
|
||||||
* timezone, not UTC. We want timegm(), which isn't standard.
|
* timezone, not UTC. We want timegm(), which isn't standard.
|
||||||
|
|||||||
Reference in new issue
Block a user