You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
553 B

#ifndef HAVE_SETENV
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
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 */