Enlightenment CVS committal Author : doursse Project : e17 Module : proto/evil
Dir : e17/proto/evil/src/lib Modified Files: Evil.h evil.c Log Message: * src/lib/Evil.h: * src/lib/evil.c: (setenv), (unsetenv): setenv and unsetenv are already defined with cegcc =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/Evil.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- Evil.h 1 Jun 2008 17:09:14 -0000 1.12 +++ Evil.h 2 Jun 2008 04:53:41 -0000 1.13 @@ -294,6 +294,48 @@ */ 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__ */ @@ -387,48 +429,6 @@ * @ingroup Evil */ 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. =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/evil.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- evil.c 1 Jun 2008 17:09:14 -0000 1.9 +++ evil.c 2 Jun 2008 04:53:41 -0000 1.10 @@ -354,6 +354,38 @@ 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 * @@ -386,38 +418,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 * ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs