blob: ffd85f8727a43ec4285ad2e367624621b1549c1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <xinesuppt.h>
#include <stdlib.h>
#include <string.h>
/* This function will leak a small amount of memory */
void setenv(const char *name, const char *val, int _xx)
{
int len = strlen(name) + strlen(val) + 2;
char *env = malloc(len);
if (env != NULL) {
strcpy(env, name);
strcat(env, "=");
strcat(env, val);
putenv(env);
}
}
|