diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 1477665b2b..1022368869 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,9 @@ +2008-06-02 Vincent Torri + + * src/lib/Evil.h: + * src/lib/evil.c: (setenv), (unsetenv): + setenv and unsetenv are already defined with cegcc + 2008-06-01 Vincent Torri * src/lib/Evil.h: diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index 4cc0e58e33..e57cb151f0 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -294,6 +294,48 @@ EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz); */ EAPI int pipe(int *fds); +/** + * @brief Create, modify, or remove environment variables. + * + * @param name The name of the environment variable. + * @param value The value of the environment variable to set. + * @return 0 on success, -1 otherwise. + * + * Add the new environment variable @p name or modify its value if it + * exists, and set it to @p value. Environment variables define the + * environment in which a process executes. If @p value is @c NULL, the + * variable is removed (unset) and that call is equivalent to unsetenv(). + * If the function succeeds, it returns 0, otherwise it returns -1. + * + * Conformity: Non applicable. + * + * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, + * Windows XP. + * + * @ingroup Evil + */ +EAPI int setenv(const char *name, const char *value); + +/** + * @brief Remove environment variables. + * + * @param name The name of the environment variable. + * @return 0 on success, -1 otherwise. + * + * Remove the new environment variable @p name if it exists. That + * function is equivalent to setenv() with its second parameter to + * @c NULL. If the function succeeds, it returns 0, otherwise it + * returns -1. + * + * Conformity: Non applicable. + * + * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, + * Windows XP. + * + * @ingroup Evil + */ +EAPI int unsetenv(const char *name); + #endif /* ! __CEGCC__ */ @@ -388,48 +430,6 @@ EAPI int evil_sockets_init(void); */ EAPI void evil_sockets_shutdown(void); -/** - * @brief Create, modify, or remove environment variables. - * - * @param name The name of the environment variable. - * @param value The value of the environment variable to set. - * @return 0 on success, -1 otherwise. - * - * Add the new environment variable @p name or modify its value if it - * exists, and set it to @p value. Environment variables define the - * environment in which a process executes. If @p value is @c NULL, the - * variable is removed (unset) and that call is equivalent to unsetenv(). - * If the function succeeds, it returns 0, otherwise it returns -1. - * - * Conformity: Non applicable. - * - * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, - * Windows XP. - * - * @ingroup Evil - */ -EAPI int setenv(const char *name, const char *value); - -/** - * @brief Remove environment variables. - * - * @param name The name of the environment variable. - * @return 0 on success, -1 otherwise. - * - * Remove the new environment variable @p name if it exists. That - * function is equivalent to setenv() with its second parameter to - * @c NULL. If the function succeeds, it returns 0, otherwise it - * returns -1. - * - * Conformity: Non applicable. - * - * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, - * Windows XP. - * - * @ingroup Evil - */ -EAPI int unsetenv(const char *name); - /** * @brief Return a dir to store temporary files. * diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c index 9761d30d84..25361b48e4 100644 --- a/legacy/evil/src/lib/evil.c +++ b/legacy/evil/src/lib/evil.c @@ -354,6 +354,38 @@ pipe(int *fds) return -1; } +int +setenv(const char *name, const char *value) +{ + char *str; + int length; + int res; + + length = strlen(name) + strlen(value) + 2; + str = (char *)malloc(length); + sprintf(str, "%s=%s", name, value); + res = _putenv(str); + free(str); + + return res; +} + +int +unsetenv(const char *name) +{ + char *str; + int length; + int res; + + length = strlen(name) + 2; + str = (char *)malloc(length); + sprintf(str, "%s=", name); + res = _putenv(str); + free(str); + + return res; +} + #endif /* ! __CEGCC__ */ char * @@ -388,38 +420,6 @@ evil_sockets_shutdown(void) WSACleanup(); } -int -setenv(const char *name, const char *value) -{ - char *str; - int length; - int res; - - length = strlen(name) + strlen(value) + 2; - str = (char *)malloc(length); - sprintf(str, "%s=%s", name, value); - res = _putenv(str); - free(str); - - return res; -} - -int -unsetenv(const char *name) -{ - char *str; - int length; - int res; - - length = strlen(name) + 2; - str = (char *)malloc(length); - sprintf(str, "%s=", name); - res = _putenv(str); - free(str); - - return res; -} - const char * evil_tmpdir_get(void) {