Introduced new function type GEqualFunc to return TRUE for equal params.
[platform/upstream/glib.git] / gfileutils.c
index 1176852..20a8d37 100644 (file)
  *   Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
+
 #include "glib.h"
 
 #include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#ifdef G_OS_WIN32
+#include <io.h>
+#ifndef F_OK
+#define        F_OK 0
+#define        X_OK 1
+#define        W_OK 2
+#define        R_OK 4
+#endif /* !F_OK */
+
+#ifndef S_ISREG
+#define S_ISREG(mode) ((mode)&_S_IFREG)
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode)&_S_IFDIR)
+#endif
+
+#endif /* G_OS_WIN32 */
+
+#ifndef S_ISLNK
+#define S_ISLNK(x) 0
+#endif
 
 #define _(x) x
 
@@ -279,6 +305,8 @@ get_contents_stdio (const gchar *filename,
   return TRUE;  
 }
 
+#ifndef G_OS_WIN32
+
 static gboolean
 get_contents_regfile (const gchar *filename,
                       struct stat *stat_buf,
@@ -401,7 +429,8 @@ get_contents_posix (const gchar *filename,
     }
 }
 
-#ifdef G_OS_WIN32
+#else  /* G_OS_WIN32 */
+
 static gboolean
 get_contents_win32 (const gchar *filename,
                     gchar      **contents,
@@ -426,6 +455,7 @@ get_contents_win32 (const gchar *filename,
   
   return get_contents_stdio (filename, f, contents, length, error);
 }
+
 #endif
 
 /**
@@ -467,4 +497,3 @@ g_file_get_contents (const gchar *filename,
   return get_contents_posix (filename, contents, length, error);
 #endif
 }
-