Skip to content
Myr

Mingw-w64 on windows doesn't have `setenv`, fix that.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by HE, Tao · committed by Nico Williams · parent fb1c635 · Browse files · 2 files+22 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: HE, Tao <sighingnow@gmail.com>

Diff stats

2 files+22 added−0 removed

  • other:+22 added−0 removed

2 files+22 added−0 removed

modified:src/builtin.c+21 added
1184 unmodified lines
1185 jv_number(tm->tm_wday),1186 jv_number(tm->tm_yday));1187}11881189#if defined(WIN32) && !defined(HAVE_SETENV)1190static int setenv(const char *var, const char *val, int ovr)1191{1192 BOOL b;1193 char c[2];1194 if (!ovr)1195 {1196 DWORD d;1197 d = GetEnvironmentVariableA (var, c, 2);1198 if (0 != d && GetLastError () != ERROR_ENVVAR_NOT_FOUND) {1199 return d;1200 }1201 }1202 b = SetEnvironmentVariableA (var, val);1203 if (b) {1204 return 0;1205 }1206 return 1;1207}1208#endif12091210/*1211 * mktime() has side-effects and anyways, returns time in the local1212 * timezone, not UTC. We want timegm(), which isn't standard.1213 *
597 unmodified lines
modified:configure.ac+1 added
122 unmodified lines
123AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])124AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])125AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])126AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])127AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0])128AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])129AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])130AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])131AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])
153 unmodified lines