diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index d8f3bf7c93..9005221cba 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,8 +1,19 @@ +2008-10-14 Vincent Torri + + * src/lib/evil_fcntl.h: + don't use it with the cegcc compiler + + * src/lib/evil_fnmatch.c: + fix warning + + * src/lib/evil_stdlib.c: + fix putenv and mkstemp with cegcc and mingw32ce + 2008-10-11 Vincent Torri * configure.ac: * src/lib/Makefile.am: - readd guards suppressed in previous commit + re-add guards suppressed in previous commit * src/lib/Evil.h: include new header files diff --git a/legacy/evil/src/lib/evil_fcntl.h b/legacy/evil/src/lib/evil_fcntl.h index 1043791e39..cedeffb6e8 100644 --- a/legacy/evil/src/lib/evil_fcntl.h +++ b/legacy/evil/src/lib/evil_fcntl.h @@ -2,6 +2,8 @@ #define __EVIL_FCNTL_H__ +#ifndef __CEGCC__ + # include /** @@ -98,4 +100,7 @@ struct flock EAPI int fcntl(int fd, int cmd, ...); +#endif /* ! __CEGCC__ */ + + #endif /* __EVIL_FCNTL_H__ */ diff --git a/legacy/evil/src/lib/evil_fnmatch.c b/legacy/evil/src/lib/evil_fnmatch.c index eaeacbc26f..e1184ea8a5 100644 --- a/legacy/evil/src/lib/evil_fnmatch.c +++ b/legacy/evil/src/lib/evil_fnmatch.c @@ -181,7 +181,7 @@ fnmatch(const char *pattern, fnmatch_init_states(states); - for (c = string; *c && states->size; ++c) + for (c = (char *)string; *c && states->size; ++c) { size_t i; fnmatch_list_of_states_clear(new_states); diff --git a/legacy/evil/src/lib/evil_stdlib.c b/legacy/evil/src/lib/evil_stdlib.c index d058d2ad35..56cc69e591 100644 --- a/legacy/evil/src/lib/evil_stdlib.c +++ b/legacy/evil/src/lib/evil_stdlib.c @@ -6,7 +6,7 @@ #include #ifndef __CEGCC__ # include -#endif /* ! __CEGCC__ */ +#endif /* __CEGCC__ */ #ifdef HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ @@ -112,6 +112,25 @@ putenv(const char *string) #if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) return _putenv(string); #else + char *str; + char *egal; + char *name; + char *value; + + str = strdup(string); + if (!str) + return -1; + egal = strchr(str, '='); + if (!egal) + return -1; + + value = egal + 1; + *egal = '\0'; + name = str; + setenv(name, value, 1); + free(str); + + return 0; #endif /* __CEGCC__ || __MINGW32CE__ */ } @@ -281,7 +300,23 @@ mkstemp(char *template) suffix[5] = lookup[v % 62]; v /= 62; +#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) fd = _open(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE); +#else /* __CEGCC__ || __MINGW32CE__ */ + { + FILE *f; + + f = fopen(template, "rwb"); + if (!f) + { +#ifdef HAVE_ERRNO_H + errno = EEXIST; +#endif /* HAVE_ERRNO_H */ + return -1; + } + fd = fileno(f); + } +#endif /* __CEGCC__ || __MINGW32CE__ */ if (fd >= 0) return fd;