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