mingw portability, step 1
authortsauerbeck <tsauerbeck>
Wed, 20 Oct 2004 16:48:58 +0000 (16:48 +0000)
committertsauerbeck <tsauerbeck@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Oct 2004 16:48:58 +0000 (16:48 +0000)
SVN revision: 11925

legacy/edje/configure.in
legacy/edje/src/bin/edje_cc.c
legacy/edje/src/bin/edje_cc.h
legacy/edje/src/bin/edje_cc_parse.c
legacy/edje/src/bin/edje_main.c

index 6ae7edb..7bf52b3 100644 (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)
index 65cb185..8a0a5f8 100644 (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();
index de2cf41..7d1377f 100644 (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>
index 08d8b59..70a6f4e 100644 (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);
 }
 
index 9c15d0a..4e0fa5c 100644 (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