mingw portability, step 1

SVN revision: 11925
This commit is contained in:
tsauerbeck 2004-10-20 16:48:58 +00:00 committed by tsauerbeck
parent a84ea1ccee
commit 7fac198907
5 changed files with 22 additions and 7 deletions

View File

@ -19,6 +19,8 @@ AM_ENABLE_SHARED
AM_PROG_LIBTOOL
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(realpath)
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
AC_CHECK_FUNCS(fnmatch, res=yes, res=no)

View File

@ -136,7 +136,11 @@ main(int argc, char **argv)
}
/* check whether file_in exists */
#ifdef HAVE_REALPATH
if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
#else
if (stat(file_in, &st) || !S_ISREG(st.st_mode))
#endif
{
fprintf(stderr, "%s: Error: file not found: %s.\n", progname, file_in);
main_help();
@ -164,7 +168,11 @@ main(int argc, char **argv)
exit(-1);
}
#ifdef HAVE_REALPATH
if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
#else
if (!strcmp (file_in, file_out))
#endif
{
fprintf(stderr, "%s: Error: input file equals output file.\n", progname);
main_help();

View File

@ -12,7 +12,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>

View File

@ -571,18 +571,16 @@ compile(void)
size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
data = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (data)
{
data = malloc(size);
if (data && read(fd, data, size) == size)
parse(data, size);
munmap(data, size);
}
else
{
fprintf(stderr, "%s: Error. cannot mmap file \"%s\" for input. %s\n",
fprintf(stderr, "%s: Error. cannot read file \"%s\". %s\n",
progname, file_in, strerror(errno));
exit(-1);
}
free(data);
close(fd);
}

View File

@ -1,5 +1,6 @@
#include "edje_main.h"
#ifndef WIN32
typedef struct _Demo_Edje Demo_Edje;
struct _Demo_Edje
@ -863,4 +864,11 @@ main(int argc, char **argv)
return 0;
}
#else
int main ()
{
fprintf(stderr, "no workie on win32 yet\n");
return 0;
}
#endif