#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 */