diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/setenv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/setenv.c Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,26 @@ + +#ifndef HAVE_SETENV +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include +#include + +int setenv(const char *kszName, const char *kszValue, int nOverwrite) +{ + char *szPair = NULL; + + if (nOverwrite == 0 && getenv(kszName) != 0) + return 0; + szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1); + if (szPair == NULL) + return -1; + strcpy(szPair, kszName); + strcat(szPair, "="); + strcat(szPair, kszValue); + putenv(szPair); + return 0; +} +#endif /* !HAVE_SETENV */ +