* src/lib/Evil.h:

* src/lib/evil.c: (setenv), (unsetenv):
setenv and unsetenv are already defined with cegcc


SVN revision: 34723
This commit is contained in:
doursse 2008-06-02 04:53:41 +00:00 committed by doursse
parent 3b513e346e
commit c1ea673e9a
3 changed files with 80 additions and 74 deletions

View File

@ -1,3 +1,9 @@
2008-06-02 Vincent Torri <doursse at users dot sf dot net>
* src/lib/Evil.h:
* src/lib/evil.c: (setenv), (unsetenv):
setenv and unsetenv are already defined with cegcc
2008-06-01 Vincent Torri <doursse at users dot sf dot net>
* src/lib/Evil.h:

View File

@ -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.
*

View File

@ -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)
{