aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 85f1ec2f..976525d8 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -39,6 +39,37 @@
# include <wchar.h>
#endif
+/* Wrappers for C library function that take pathname arguments. */
+#if GLIB_CHECK_VERSION(2, 6, 0)
+# include <glib/gstdio.h>
+#else
+
+#define g_open open
+#define g_rename rename
+#define g_mkdir mkdir
+#define g_stat stat
+#define g_lstat lstat
+#define g_unlink unlink
+#define g_remove remove
+#define g_rmdir rmdir
+#define g_fopen fopen
+#define g_freopen freopen
+
+#endif /* GLIB_CHECK_VERSION */
+
+#if !GLIB_CHECK_VERSION(2, 7, 0)
+
+#ifdef G_OS_UNIX
+#define g_chdir chdir
+#define g_chmod chmod
+#else
+gint g_chdir (const gchar *path);
+gint g_chmod (const gchar *path,
+ gint mode);
+#endif /* G_OS_UNIX */
+
+#endif /* !GLIB_CHECK_VERSION */
+
/* The AC_CHECK_SIZEOF() in configure fails for some machines.
* we provide some fallback values here */
#if !SIZEOF_UNSIGNED_SHORT
@@ -141,6 +172,7 @@
#define FILE_OP_ERROR(file, func) \
{ \
fprintf(stderr, "%s: ", file); \
+ fflush(stderr); \
perror(func); \
}