From: Tim Kientzle Date: Mon, 1 Feb 2010 05:51:37 +0000 (-0500) Subject: First step towards integrating Mac OS "copyfile" extension from Apple. X-Git-Tag: v3.0.0a~1296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc3047d546d5a993c0b473d50c4b9a4642678b8d;p=thirdparty%2Flibarchive.git First step towards integrating Mac OS "copyfile" extension from Apple. This part adds probes for the copyfile.h header, and adds a new command-line option --disable-copyfile, which does nothing on non-MacOS systems. SVN-Revision: 1852 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 42dc9fee5..f844e7eb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,7 @@ LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H) LA_CHECK_INCLUDE_FILE("attr/xattr.h" HAVE_ATTR_XATTR_H) LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) +LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H) LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index 2d2a000e4..dadda8605 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -60,6 +60,9 @@ /* Define to 1 if you have the `chroot' function. */ #cmakedefine HAVE_CHROOT 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_COPYFILE_H 1 + /* Define to 1 if you have the `CreateHardLinkA' function. */ #cmakedefine HAVE_CREATEHARDLINKA 1 diff --git a/configure.ac b/configure.ac index 2dcd03fe6..e4beae79e 100644 --- a/configure.ac +++ b/configure.ac @@ -192,7 +192,7 @@ esac # Checks for header files. AC_HEADER_DIRENT AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h ctype.h errno.h]) +AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h errno.h]) AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h]) AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h linux/fs.h]) AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h]) diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 39ff453be..caa9e9763 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -32,6 +32,9 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.93 2008/11/08 04:43:24 kientzle #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_COPYFILE_H +#include +#endif #ifdef HAVE_ERRNO_H #include #endif @@ -225,6 +228,11 @@ main(int argc, char **argv) } #endif +#ifdef COPYFILE_DISABLE_VAR + if (getenv(COPYFILE_DISABLE_VAR)) + bsdtar->disable_copyfile = 1; +#endif + bsdtar->argv = argv; bsdtar->argc = argc; @@ -258,6 +266,9 @@ main(int argc, char **argv) case OPTION_CHROOT: /* NetBSD */ bsdtar->option_chroot = 1; break; + case OPTION_DISABLE_COPYFILE: /* Mac OS X */ + bsdtar->disable_copyfile = 1; + break; case OPTION_EXCLUDE: /* GNU tar */ if (lafe_exclude(&bsdtar->matching, bsdtar->optarg)) lafe_errc(1, 0, diff --git a/tar/bsdtar.h b/tar/bsdtar.h index 5e8dc7f89..a9dbd758f 100644 --- a/tar/bsdtar.h +++ b/tar/bsdtar.h @@ -74,6 +74,7 @@ struct bsdtar { char option_unlink_first; /* -U */ char option_warn_links; /* --check-links */ char day_first; /* show day before month in -tv output */ + char disable_copyfile; /* For Mac OS */ /* If >= 0, then close this when done. */ int fd; @@ -109,6 +110,7 @@ struct bsdtar { enum { OPTION_CHECK_LINKS = 1, OPTION_CHROOT, + OPTION_DISABLE_COPYFILE, OPTION_EXCLUDE, OPTION_FORMAT, OPTION_OPTIONS, diff --git a/tar/cmdline.c b/tar/cmdline.c index ba3e8a1b2..82772abc9 100644 --- a/tar/cmdline.c +++ b/tar/cmdline.c @@ -77,6 +77,7 @@ static struct option { { "create", 0, 'c' }, { "dereference", 0, 'L' }, { "directory", 1, 'C' }, + { "disable-copyfile", 0, OPTION_DISABLE_COPYFILE }, { "exclude", 1, OPTION_EXCLUDE }, { "exclude-from", 1, 'X' }, { "extract", 0, 'x' },