Enlightenment CVS committal Author : doursse Project : e17 Module : proto/evil
Dir : e17/proto/evil/src/lib Modified Files: evil.c Evil.h Log Message: * configure.ac: * src/lib/dlfcn/dlfcn.h: * src/lib/mman/sys/mman.h: define EFL_EVIL_MMAN_BUILD and EFL_EVIL_DLFCN_BUILD so that functions in Evil.h are not declared as import * src/lib/evil.c: (setenv), (unsetenv), (realpath), (evil_sockets_init), (evil_sockets_shutdown), (evil_pipe), (evil_tmpdir_get), (evil_homedir_get): rename pipe() to evil_pipe(). set tmpdir to "Temp" and homedir to "My Documents" on WinCE * src/lib/Evil.h: define pipe() as evil_pipe(). This allow to use our pipe() implementation to be usedwith cegcc, as it is broken on that platform. move the defines at the end of the file =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/evil.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- evil.c 9 Jun 2008 18:35:49 -0000 1.12 +++ evil.c 10 Jun 2008 07:16:53 -0000 1.13 @@ -245,12 +245,78 @@ 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 * +realpath(const char *file_name, char *resolved_name) +{ +#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) + return _fullpath(resolved_name, file_name, PATH_MAX); +#else + int length; + + length = strlen(file_name); + if ((length + 1) > PATH_MAX) + length = PATH_MAX - 1; + memcpy(resolved_name, file_name, length); + resolved_name[length] = '\0'; + + return resolved_name; +#endif /* __CEGCC__ || __MINGW32CE__ */ +} + +int +evil_sockets_init(void) +{ + WSADATA wsa_data; + + return (WSAStartup(MAKEWORD( 2, 2 ), &wsa_data) == 0) ? 1 : 0; +} + +void +evil_sockets_shutdown(void) +{ + WSACleanup(); +} + /* * The code of the following functions has been kindly offered * by Tor Lillqvist. */ int -pipe(int *fds) +evil_pipe(int *fds) { struct sockaddr_in saddr; struct timeval tv; @@ -355,77 +421,11 @@ 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 * -realpath(const char *file_name, char *resolved_name) -{ -#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) - return _fullpath(resolved_name, file_name, PATH_MAX); -#else - int length; - - length = strlen(file_name); - if ((length + 1) > PATH_MAX) - length = PATH_MAX - 1; - memcpy(resolved_name, file_name, length); - resolved_name[length] = '\0'; - - return resolved_name; -#endif /* __CEGCC__ || __MINGW32CE__ */ -} - -int -evil_sockets_init(void) -{ - WSADATA wsa_data; - - return (WSAStartup(MAKEWORD( 2, 2 ), &wsa_data) == 0) ? 1 : 0; -} - -void -evil_sockets_shutdown(void) -{ - WSACleanup(); -} - const char * evil_tmpdir_get(void) { #ifdef _WIN32_WCE - return "\\windows"; + return "\\temp"; #else char *tmpdir; @@ -443,7 +443,7 @@ evil_homedir_get(void) { #ifdef _WIN32_WCE - return "\\windows"; + return "\\my documents"; #else char *homedir; =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/Evil.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- Evil.h 9 Jun 2008 18:35:49 -0000 1.17 +++ Evil.h 10 Jun 2008 07:16:53 -0000 1.18 @@ -287,25 +287,6 @@ EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz); /** - * @brief Create a pair of sockets. - * - * @param fds A pointer that contains two sockets. - * - * Create a pair of sockets that can be use with select(). - * Hence, evil_sockets_init() must have been caled at least - * once before. Contrary to Unix, that functions does not - * create a pair of file descriptors. - * - * Conformity: Not applicable. - * - * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, - * Windows XP. - * - * @ingroup Evil - */ -EAPI int pipe(int *fds); - -/** * @brief Create, modify, or remove environment variables. * * @param name The name of the environment variable. @@ -349,42 +330,6 @@ #endif /* ! __CEGCC__ */ - -#if defined(__MSDOS__) || defined(__EMX__) || \ - (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__)) -# if defined(_MSC_VER) || defined(__MINGW32__) - -# ifdef S_ISDIR -# undef S_ISDIR -# endif -# ifdef S_ISREG -# undef S_ISREG -# endif -# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) -# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) - -# define S_IRUSR _S_IRUSR -# define S_IWUSR _S_IWUSR -# define S_IXUSR _S_IXUSR -# define S_IRGRP S_IRUSR -# define S_IROTH S_IRUSR -# define S_IWGRP S_IWUSR -# define S_IWOTH S_IWUSR -# define S_IXGRP S_IXUSR -# define S_IXOTH S_IXUSR -# define open(path,...) _open((path),__VA_ARGS__) -# define close(fd) _close(fd) -# define read(fd,buffer,count) _read((fd),(buffer),(count)) -# define write(fd,buffer,count) _write((fd),(buffer),(count)) -# define unlink(filename) _unlink((filename)) -# define mkdir(p,m) _mkdir(p) -# define getcwd(b,s) _getcwd((b),(s)) -# define lstat(f,s) _stat((f),(s)) -# define strdup(s) _strdup(s) - -# endif -#endif - /** * @brief Return an absolute or full path name for a specified relative path name. * @@ -443,6 +388,25 @@ EAPI void evil_sockets_shutdown(void); /** + * @brief Create a pair of sockets. + * + * @param fds A pointer that contains two sockets. + * + * Create a pair of sockets that can be use with select(). + * Hence, evil_sockets_init() must have been caled at least + * once before. Contrary to Unix, that functions does not + * create a pair of file descriptors. + * + * Conformity: Not applicable. + * + * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, + * Windows XP. + * + * @ingroup Evil + */ +EAPI int evil_pipe(int *fds); + +/** * @brief Return a dir to store temporary files. * * @return The directory to store temporary files. @@ -561,6 +525,44 @@ #endif /* UNICODE */ EAPI char *evil_last_error_get(void); + + +#if defined(__MSDOS__) || defined(__EMX__) || \ + (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__)) +# if defined(_MSC_VER) || defined(__MINGW32__) + +# ifdef S_ISDIR +# undef S_ISDIR +# endif +# ifdef S_ISREG +# undef S_ISREG +# endif +# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) +# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) + +# define S_IRUSR _S_IRUSR +# define S_IWUSR _S_IWUSR +# define S_IXUSR _S_IXUSR +# define S_IRGRP S_IRUSR +# define S_IROTH S_IRUSR +# define S_IWGRP S_IWUSR +# define S_IWOTH S_IWUSR +# define S_IXGRP S_IXUSR +# define S_IXOTH S_IXUSR +# define open(path,...) _open((path),__VA_ARGS__) +# define close(fd) _close(fd) +# define read(fd,buffer,count) _read((fd),(buffer),(count)) +# define write(fd,buffer,count) _write((fd),(buffer),(count)) +# define unlink(filename) _unlink((filename)) +# define mkdir(p,m) _mkdir(p) +# define getcwd(b,s) _getcwd((b),(s)) +# define lstat(f,s) _stat((f),(s)) +# define strdup(s) _strdup(s) + +# endif +#endif + +#define pipe(fd) evil_pipe(fd) #ifdef __cplusplus ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs