diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 2cd00ac3d4..95854f61a1 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,13 @@ +2008-03-23 Vincent Torri + + * src/lib/Evil.h: + add POSIX definitions + + * src/lib/evil.c: + make realpath available with cegcc. The function + just copy the file name to the resolved name with + that compiler + 2008-03-13 Vincent Torri * INSTALL: diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index daff8be48f..932fd3febb 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -282,6 +282,29 @@ EAPI int pipe(int *fds); #if defined(__MSDOS__) || defined(__EMX__) || \ (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__)) # if defined(_MSC_VER) || defined(__MINGW32__) + +struct stat +{ + _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ + _ino_t st_ino; /* Always zero ? */ + _mode_t st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + short st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + _dev_t st_rdev; /* Seems useless (not even filled in) */ + _off_t st_size; /* File size in bytes */ + time_t st_atime; /* Accessed date (always 00:00 hrs local + * on FAT) */ + time_t st_mtime; /* Modified time */ + time_t st_ctime; /* Creation time */ +}; + +# 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 @@ -294,11 +317,10 @@ EAPI int pipe(int *fds); # define write(fd,buffer,count) _write((fd),(buffer),(count)) # define unlink(filename) _unlink((filename)) # define mkdir(p,m) _mkdir(p) + # endif #endif - -#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) /** * @brief Return an absolute or full path name for a specified relative path name. * @@ -325,9 +347,6 @@ EAPI int pipe(int *fds); */ EAPI char *realpath(const char *file_name, char *resolved_name); -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ - - /** * @brief Initiates the use of Windows sockets. * diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c index 26362c454c..8f2bb8ed9c 100644 --- a/legacy/evil/src/lib/evil.c +++ b/legacy/evil/src/lib/evil.c @@ -151,6 +151,7 @@ symlink(const char *oldpath, const char *newpath) if (FAILED(pISL->lpVtbl->QueryInterface(pISL, &IID_IPersistFile, (void **)persit_file))) goto no_queryinterface; + /* FIXME: is it for cegcc ??? */ mbstowcs(new_path, newpath, MB_CUR_MAX); if (FAILED(pIPF->lpVtbl->Save(pIPF, new_path, FALSE))) goto no_save; @@ -345,13 +346,23 @@ pipe(int *fds) #endif /* ! __CEGCC__ */ -#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) char * realpath(const char *file_name, char *resolved_name) { - return _fullpath(resolved_name, file_name, PATH_MAX); +#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__ */ } -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ int evil_sockets_init(void)