michael@574: michael@574: #ifndef HAVE_SETENV michael@574: #ifdef HAVE_CONFIG_H michael@574: #include "config.h" michael@574: #endif michael@574: #include michael@574: #include michael@574: #include michael@574: michael@574: int setenv(const char *kszName, const char *kszValue, int nOverwrite) michael@574: { michael@574: char *szPair = NULL; michael@574: michael@574: if (nOverwrite == 0 && getenv(kszName) != 0) michael@574: return 0; michael@574: szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1); michael@574: if (szPair == NULL) michael@574: return -1; michael@574: strcpy(szPair, kszName); michael@574: strcat(szPair, "="); michael@574: strcat(szPair, kszValue); michael@574: putenv(szPair); michael@574: return 0; michael@574: } michael@574: #endif /* !HAVE_SETENV */ michael@574: