@@ -16,40 +16,5 @@ char* c_realpath(char* path, char* resolved_path, int maxLength) {
16
16
#endif
17
17
}
18
18
19
- /// @brief Set environment variable using the C standard library
20
- /// @param envname: points to a string containing the name of an environment variable to be added or altered.
21
- /// @param envval: points to the value the environment variable is set to
22
- /// @param overwrite: flag to determine whether an old value should be overwritten
23
- /// @return success flag, 0 on successful execution
24
- int c_setenv (const char * envname , const char * envval , int overwrite ) {
25
- #ifndef _WIN32
26
- return setenv (envname , envval , overwrite );
27
- #else
28
- int errcode = 0 ;
29
- if (!overwrite ) {
30
- size_t envsize = 0 ;
31
- errcode = getenv_s (& envsize , NULL , 0 , envname );
32
- if (errcode || envsize ) return errcode ;
33
- }
34
- return _putenv_s (envname , envval );
35
- #endif
36
- }
37
-
38
- /// @brief Delete environment variable using the C standard library
39
- /// @param envname: points to a string containing the name of an environment variable.
40
- /// @return success flag, 0 on successful execution
41
- int c_unsetenv (const char * envname ) {
42
- #ifndef _WIN32
43
- return unsetenv (envname );
44
- #else
45
- char * str = malloc (64 * sizeof (char ));
46
- * str = '\0' ;
47
- int errcode = _putenv_s (envname ,str );
48
- // Windows returns a non-0 code when setting empty variable
49
- if (errcode == -1 ) errcode = 0 ;
50
- free (str );
51
- return errcode ;
52
- #endif
53
- }
54
19
55
20
0 commit comments