]>
Commit | Line | Data |
---|---|---|
45569d72 | 1 | # include<string.h> |
2 | # include<stdlib.h> | |
3 | ||
4 | void updateEnv (char * str) | |
5 | { | |
6 | char * tmp; | |
7 | tmp = getenv("MYENV"); | |
8 | if (tmp != NULL) | |
9 | strcpy (str, tmp); | |
10 | } | |
11 | ||
12 | void updateEnvSafe (char * str, size_t strSize) | |
13 | /*@requires maxSet(str) >= (strSize -1)@*/ | |
14 | { | |
15 | char * tmp; | |
16 | tmp = getenv("MYENV"); | |
17 | if (tmp != NULL) | |
18 | { | |
19 | strncpy (str, tmp, strSize -1); | |
20 | str[strSize -1] = '/0'; | |
21 | } | |
22 | } | |
23 | ||
24 |