* 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



SVN revision: 36651
This commit is contained in:
Vincent Torri 2008-10-14 06:52:09 +00:00
parent 9c044c7904
commit d8fda87e83
4 changed files with 54 additions and 3 deletions

View File

@ -1,8 +1,19 @@
2008-10-14 Vincent Torri <doursse at users dot sf dot net>
* 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 <doursse at users dot sf dot net> 2008-10-11 Vincent Torri <doursse at users dot sf dot net>
* configure.ac: * configure.ac:
* src/lib/Makefile.am: * src/lib/Makefile.am:
readd guards suppressed in previous commit re-add guards suppressed in previous commit
* src/lib/Evil.h: * src/lib/Evil.h:
include new header files include new header files

View File

@ -2,6 +2,8 @@
#define __EVIL_FCNTL_H__ #define __EVIL_FCNTL_H__
#ifndef __CEGCC__
# include <sys/types.h> # include <sys/types.h>
/** /**
@ -98,4 +100,7 @@ struct flock
EAPI int fcntl(int fd, int cmd, ...); EAPI int fcntl(int fd, int cmd, ...);
#endif /* ! __CEGCC__ */
#endif /* __EVIL_FCNTL_H__ */ #endif /* __EVIL_FCNTL_H__ */

View File

@ -181,7 +181,7 @@ fnmatch(const char *pattern,
fnmatch_init_states(states); fnmatch_init_states(states);
for (c = string; *c && states->size; ++c) for (c = (char *)string; *c && states->size; ++c)
{ {
size_t i; size_t i;
fnmatch_list_of_states_clear(new_states); fnmatch_list_of_states_clear(new_states);

View File

@ -6,7 +6,7 @@
#include <stdio.h> #include <stdio.h>
#ifndef __CEGCC__ #ifndef __CEGCC__
# include <io.h> # include <io.h>
#endif /* ! __CEGCC__ */ #endif /* __CEGCC__ */
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif /* HAVE_ERRNO_H */ #endif /* HAVE_ERRNO_H */
@ -112,6 +112,25 @@ putenv(const char *string)
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) #if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
return _putenv(string); return _putenv(string);
#else #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__ */ #endif /* __CEGCC__ || __MINGW32CE__ */
} }
@ -281,7 +300,23 @@ mkstemp(char *template)
suffix[5] = lookup[v % 62]; suffix[5] = lookup[v % 62];
v /= 62; v /= 62;
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
fd = _open(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE); 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) if (fd >= 0)
return fd; return fd;