summaryrefslogtreecommitdiff
path: root/libarchive/archive_entry.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2009-10-31 13:16:37 -0400
committerTim Kientzle <kientzle@gmail.com>2009-10-31 13:16:37 -0400
commit3f64eae40dc9b1c909afc75861834ba93c967148 (patch)
treef5caa7bc9bde517b33bd498ee795de3de1225d01 /libarchive/archive_entry.c
parent4c83fa6c611815a8f99d6fc74fb8c6b236c2b8ea (diff)
downloadlibarchive-3f64eae40dc9b1c909afc75861834ba93c967148.tar.gz
Shuffle the major/minor/makedev support a bit; this should work
on both Windows and Haiku. SVN-Revision: 1553
Diffstat (limited to 'libarchive/archive_entry.c')
-rw-r--r--libarchive/archive_entry.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c
index 579ae1f4..bd2c4469 100644
--- a/libarchive/archive_entry.c
+++ b/libarchive/archive_entry.c
@@ -32,12 +32,12 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.55 2008/12/23 05:01:4
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef MAJOR_IN_MKDEV
+#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
-#else
-#ifdef MAJOR_IN_SYSMACROS
+#define HAVE_MAJOR
+#elif MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
-#endif
+#define HAVE_MAJOR
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
@@ -75,6 +75,13 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.55 2008/12/23 05:01:4
#undef max
#define max(a, b) ((a)>(b)?(a):(b))
+#if !defined(HAVE_MAJOR) && !defined(major)
+/* Replacement for major/minor/makedev. */
+#define major(x) ((int)(0x00ff & ((x) >> 8)))
+#define minor(x) ((int)(0xffff00ff & (x)))
+#define makedev(maj,min) ((0xff00 & ((maj)<<8)) | (0xffff00ff & (min)))
+#endif
+
/* Play games to come up with a suitable makedev() definition. */
#ifdef __QNXNTO__
/* QNX. <sigh> */