Import libarchive 2.8.0:

- Infrastructure:
  - Allow command line tools as fallback for missing compression
    libraries. If compiled without gzip for example, gunzip will
    be used automatically.
  - Improved support for a number of platforms like high-resolution
    timestamps and Extended Attributes on various Unix systems
  - New convience interface for creating archives based on disk content,
    complement of the archive_write_disk interface.
- Frontends:
  - bsdcpio ready for public consumption
  - hand-written date parser replaces the yacc code
- Filter system:
  - Simplified read filter chains
  - Option support for filters
  - LZMA, XZ, uudecode handled
- Format support:
  - Write support for mtree files based on file system or archive
    content
  - Basic read support for Joliet
  - Write support for zip files
  - Write support for shar archives, both text-only and binary-safe
This commit is contained in:
joerg 2010-02-20 03:48:25 +00:00
parent 93d51d48be
commit ab2f2294bc
449 changed files with 113700 additions and 34982 deletions

View file

@ -0,0 +1,746 @@
#
#
PROJECT(libarchive C)
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin)
endif()
#
# Version - read from 'version' file.
#
FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version)
STRING(REGEX REPLACE
"^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version})
STRING(REGEX REPLACE
"^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version})
STRING(REGEX REPLACE
"^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version})
STRING(REGEX REPLACE
"^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version})
SET(_version_number ${_major}${_minor}${_revision})
STRING(REGEX REPLACE "[0]*([^0][0-9]*)$" "\\1" _minor ${_minor})
STRING(REGEX REPLACE "[0]*([^0][0-9]*)$" "\\1" _revision ${_revision})
#
SET(VERSION "${_major}.${_minor}.${_revision}${_quality}")
SET(BSDCPIO_VERSION_STRING "${VERSION}")
SET(BSDTAR_VERSION_STRING "${VERSION}")
SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}")
SET(LIBARCHIVE_VERSION_STRING "${VERSION}")
# Shared library number
SET(SOVERSION 8)
# Enable CTest/CDash support
include(CTest)
# Provide ADD_TEST_28 macro to approximate CMake 2.8 ADD_TEST(NAME).
# TODO: Require CMake 2.8 and drop this workaround (perhaps late 2010).
INCLUDE(AddTest28)
OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
OPTION(ENABLE_TAR "Enable tar building" ON)
OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" OFF)
OPTION(ENABLE_CPIO "Enable cpio building" ON)
OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" OFF)
OPTION(ENABLE_XATTR "Enable extended attribute support" ON)
OPTION(ENABLE_ACL "Enable ACL support" ON)
OPTION(ENABLE_TEST "Enable unit and regression tests" ON)
IF(ENABLE_TEST)
ENABLE_TESTING()
ENDIF(ENABLE_TEST)
IF(WIN32 AND NOT CYGWIN)
# Currently, dynamic build only.
SET(ENABLE_TAR_SHARED ON)
SET(ENABLE_CPIO_SHARED ON)
ENDIF(WIN32 AND NOT CYGWIN)
IF(WIN32)
SET(_WIN32_WINNT 0x0500 CACHE INTERNAL "Setting _WIN32_WINNT to 0x0500 for Windows 2000 APIs")
SET(WINVER 0x0500 CACHE INTERNAL "Setting WINVER to 0x0500 for Windows 2000 APIs")
ENDIF(WIN32)
#
INCLUDE(CheckCSourceRuns)
INCLUDE(CheckFileOffsetBits)
INCLUDE(CheckFuncs)
INCLUDE(CheckHeaderDirent)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckStructMember)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckTypeExists)
INCLUDE(CheckTypeSize)
#
# Generate list.h
#
MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources)
SET(_argv ${ARGV})
# Remove _listfile and _cmlist from _argv
LIST(REMOVE_AT _argv 0 1)
IF (NOT EXISTS "${_listfile}" OR
${_cmlist} IS_NEWER_THAN "${_listfile}")
MESSAGE(STATUS "Generating ${_listfile}")
FILE(WRITE ${_listfile} "")
FOREACH (testfile ${_argv})
IF (testfile MATCHES "^test_[^/]+[.]c$")
FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST")
FOREACH (deftest ${testvar})
FILE(APPEND ${_listfile} "${deftest}\n")
ENDFOREACH (deftest)
ENDIF (testfile MATCHES "^test_[^/]+[.]c$")
ENDFOREACH (testfile)
ENDIF (NOT EXISTS "${_listfile}" OR
${_cmlist} IS_NEWER_THAN "${_listfile}")
ENDMACRO (GENERATE_LIST_H)
#
# Generate installation rules for man pages.
#
MACRO (INSTALL_MAN __mans)
FOREACH (_man ${ARGV})
STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man})
INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}")
ENDFOREACH (_man)
ENDMACRO (INSTALL_MAN __mans)
#
# Check compress/decompress libraries
#
IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN)
# GnuWin32 is only for Win32, not Win64.
SET(__GNUWIN32PATH "C:/Program Files/GnuWin32")
ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN)
IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}")
# You have to add a path availabel DLL file into PATH environment variable.
# Maybe DLL path is "C:/Program Files/GnuWin32/bin".
# The zlib and the bzip2 Setup program have installed programs and DLLs into
# "C:/Program Files/GnuWin32" by default.
# This is convenience setting for Windows.
SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH))
#
# If you didn't use Setup program or installed into nonstandard path,
# cmake cannot find out your zlib or bzip2 libraries and include files,
# you should execute cmake with -DCMAKE_PREFIX_PATH option.
# e.g.
# cmake -DCMAKE_PREFIX_PATH=<your-GnuWin32-path> <path-to-source>
#
# If compiling error occured in zconf.h, You may need patch to zconf.h.
#--- zconf.h.orig 2005-07-21 00:40:26.000000000
#+++ zconf.h 2009-01-19 11:39:10.093750000
#@@ -286,7 +286,7 @@
#
# #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# # include <sys/types.h> /* for off_t */
#-# include <unistd.h> /* for SEEK_* and off_t */
#+# include <stdio.h> /* for SEEK_* and off_t */
# # ifdef VMS
# # include <unixio.h> /* for off_t */
# # endif
ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}")
SET(ADDITIONAL_LIBS "")
#
# Find ZLIB
#
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(HAVE_LIBZ 1)
SET(HAVE_ZLIB_H 1)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES})
ENDIF(ZLIB_FOUND)
MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY)
#
# Find BZip2
#
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
SET(HAVE_LIBBZ2 1)
SET(HAVE_BZLIB_H 1)
INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARY)
#
# Find LZMA
#
FIND_PACKAGE(LZMA)
IF(LZMA_FOUND)
SET(HAVE_LIBLZMA 1)
SET(HAVE_LZMA_H 1)
INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES})
MARK_AS_ADVANCED(CLEAR LZMA_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR LZMA_LIBRARY)
ELSEIF(LZMADEC_FOUND)
SET(HAVE_LIBLZMADEC 1)
SET(HAVE_LZMADEC_H 1)
INCLUDE_DIRECTORIES(${LZMADEC_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${LZMADEC_LIBRARIES})
MARK_AS_ADVANCED(CLEAR LZMADEC_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR LZMADEC_LIBRARY)
ELSE(LZMA_FOUND)
MARK_AS_ADVANCED(CLEAR LZMA_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR LZMA_LIBRARY)
ENDIF(LZMA_FOUND)
#
# Check headers
#
CHECK_HEADER_DIRENT()
SET(INCLUDES "")
MACRO (LA_CHECK_INCLUDE_FILE header var)
CHECK_INCLUDE_FILES("${INCLUDES};${header}" ${var})
IF (${var})
SET(INCLUDES ${INCLUDES} ${header})
ENDIF (${var})
ENDMACRO (LA_CHECK_INCLUDE_FILE)
# Few headers that must precede other headers
# Must precede sys/extattr.h on FreeBSD
LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
# Alphabetize the rest unless there's a compelling reason
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("direct.h" HAVE_DIRECT_H)
LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H)
LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H)
LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)
LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H)
LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H)
LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H)
LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H)
LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H)
LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H)
LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H)
LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H)
LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H)
LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H)
LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H)
LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H)
LA_CHECK_INCLUDE_FILE("sys/extattr.h" HAVE_SYS_EXTATTR_H)
LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H)
LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H)
LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H)
LA_CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H)
LA_CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
LA_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H)
LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H)
LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H)
LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
#
# Some headers require extra includes when they're available.
#
#
# Find OpenSSL
#
IF(ENABLE_OPENSSL)
FIND_PACKAGE(OpenSSL)
ELSE()
SET(OPENSSL_FOUND 0)
ENDIF()
IF(OPENSSL_FOUND)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
ELSE()
# Block OpenSSL checks and override cached results.
SET(HAVE_OPENSSL_MD5_H 0)
SET(HAVE_OPENSSL_RIPEMD_H 0)
SET(HAVE_OPENSSL_SHA_H 0)
SET(HAVE_OPENSSL_SHA256_INIT 0)
SET(HAVE_OPENSSL_SHA384_INIT 0)
SET(HAVE_OPENSSL_SHA512_INIT 0)
ENDIF()
#
# Check MD5/RMD160/SHA headers
#
LA_CHECK_INCLUDE_FILE("md5.h" HAVE_MD5_H)
LA_CHECK_INCLUDE_FILE("openssl/md5.h" HAVE_OPENSSL_MD5_H)
LA_CHECK_INCLUDE_FILE("openssl/ripemd.h" HAVE_OPENSSL_RIPEMD_H)
LA_CHECK_INCLUDE_FILE("openssl/sha.h" HAVE_OPENSSL_SHA_H)
LA_CHECK_INCLUDE_FILE("ripemd.h" HAVE_RIPEMD_H)
LA_CHECK_INCLUDE_FILE("rmd160.h" HAVE_RMD160_H)
LA_CHECK_INCLUDE_FILE("sha.h" HAVE_SHA_H)
LA_CHECK_INCLUDE_FILE("sha1.h" HAVE_SHA1_H)
LA_CHECK_INCLUDE_FILE("sha2.h" HAVE_SHA2_H)
LA_CHECK_INCLUDE_FILE("sha256.h" HAVE_SHA256_H)
#
# Find MD5/RMD160/SHA library
#
FIND_LIBRARY(CRYPTO_LIBRARY NAMES crypto)
IF(CRYPTO_LIBRARY)
LIST(APPEND ADDITIONAL_LIBS ${CRYPTO_LIBRARY})
ELSE(CRYPTO_LIBRARY)
IF(NOT OPENSSL_FOUND)
FIND_LIBRARY(MD_LIBRARY NAMES md)
IF(MD_LIBRARY)
LIST(APPEND ADDITIONAL_LIBS ${MD_LIBRARY})
ENDIF(MD_LIBRARY)
ENDIF(NOT OPENSSL_FOUND)
ENDIF(CRYPTO_LIBRARY)
#
# Check MD5/RMD160/SHA functions
#
SET(CMAKE_REQUIRED_LIBRARIES ${ADDITIONAL_LIBS})
IF(HAVE_MD5_H)
CHECK_SYMBOL_EXISTS(MD5Init "md5.h" HAVE_MD5INIT)
ENDIF(HAVE_MD5_H)
IF(HAVE_RMD160_H)
CHECK_SYMBOL_EXISTS(RMD160Init "rmd160.h" HAVE_RMD160INIT)
ENDIF(HAVE_RMD160_H)
IF(HAVE_SHA2_H)
CHECK_SYMBOL_EXISTS(SHA256Init "sha2.h" HAVE_SHA256INIT)
CHECK_SYMBOL_EXISTS(SHA384Init "sha2.h" HAVE_SHA384INIT)
CHECK_SYMBOL_EXISTS(SHA512Init "sha2.h" HAVE_SHA512INIT)
CHECK_SYMBOL_EXISTS(SHA256_Init "sha2.h" HAVE_SHA256_INIT)
CHECK_SYMBOL_EXISTS(SHA384_Init "sha2.h" HAVE_SHA384_INIT)
CHECK_SYMBOL_EXISTS(SHA512_Init "sha2.h" HAVE_SHA512_INIT)
ELSEIF(HAVE_OPENSSL_SHA_H)
CHECK_SYMBOL_EXISTS(SHA256_Init "openssl/sha.h" HAVE_OPENSSL_SHA256_INIT)
CHECK_SYMBOL_EXISTS(SHA384_Init "openssl/sha.h" HAVE_OPENSSL_SHA384_INIT)
CHECK_SYMBOL_EXISTS(SHA512_Init "openssl/sha.h" HAVE_OPENSSL_SHA512_INIT)
ENDIF()
SET(CMAKE_REQUIRED_LIBRARIES "")
#
# Find Libxml2
#
FIND_PACKAGE(LibXml2)
IF(LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES})
SET(HAVE_LIBXML2 1)
# libxml2's include files use iconv.h
# We need a directory path of iconv.h so that it won't fail to check
# "libxml/xmlreader.h".
FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
CHECK_INCLUDE_FILES("libxml/xmlreader.h" HAVE_LIBXML_XMLREADER_H)
SET(CMAKE_REQUIRED_INCLUDES "")
ELSE(LIBXML2_FOUND)
#
# Find Expat
#
FIND_PACKAGE(EXPAT)
IF(EXPAT_FOUND)
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES})
SET(HAVE_LIBEXPAT 1)
LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H)
ENDIF(EXPAT_FOUND)
ENDIF(LIBXML2_FOUND)
#
# Check functions
#
CHECK_SYMBOL_EXISTS(CreateHardLinkA "windows.h" HAVE_CREATEHARDLINKA)
CHECK_SYMBOL_EXISTS(CreateHardLinkW "windows.h" HAVE_CREATEHARDLINKW)
CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode)
CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS)
CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT)
CHECK_FUNCTION_EXISTS_GLIBC(fchdir HAVE_FCHDIR)
CHECK_FUNCTION_EXISTS_GLIBC(fchflags HAVE_FCHFLAGS)
CHECK_FUNCTION_EXISTS_GLIBC(fchmod HAVE_FCHMOD)
CHECK_FUNCTION_EXISTS_GLIBC(fchown HAVE_FCHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(fcntl HAVE_FCNTL)
CHECK_FUNCTION_EXISTS_GLIBC(fork HAVE_FORK)
CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT)
CHECK_FUNCTION_EXISTS_GLIBC(ftruncate HAVE_FTRUNCATE)
CHECK_FUNCTION_EXISTS_GLIBC(futimens HAVE_FUTIMENS)
CHECK_FUNCTION_EXISTS_GLIBC(futimes HAVE_FUTIMES)
CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID)
CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID)
CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS)
CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK)
CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT)
CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES)
CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR)
CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO)
CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD)
CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO)
CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE)
CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL)
CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK)
CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT)
CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV)
CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE)
CHECK_FUNCTION_EXISTS_GLIBC(sigaction HAVE_SIGACTION)
CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR)
CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP)
CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR)
CHECK_FUNCTION_EXISTS_GLIBC(strncpy_s HAVE_STRNCPY_S)
CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR)
CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK)
CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM)
CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET)
CHECK_FUNCTION_EXISTS_GLIBC(unsetenv HAVE_UNSETENV)
CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME)
CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES)
CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT)
CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK)
CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB)
CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY)
CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN)
CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
CHECK_SYMBOL_EXISTS(wmemcmp "wchar.h" HAVE_WMEMCMP)
CHECK_SYMBOL_EXISTS(wmemcpy "wchar.h" HAVE_WMEMCPY)
SET(CMAKE_REQUIRED_LIBRARIES "")
CHECK_SYMBOL_EXISTS(fseeko "stdio.h" HAVE_FSEEKO)
CHECK_SYMBOL_EXISTS(strerror_r "string.h" HAVE_STRERROR_R)
CHECK_SYMBOL_EXISTS(strftime "time.h" HAVE_STRFTIME)
CHECK_SYMBOL_EXISTS(vprintf "stdio.h" HAVE_VPRINTF)
CHECK_SYMBOL_EXISTS(cygwin_conv_path "sys/cygwin.h" HAVE_CYGWIN_CONV_PATH)
CHECK_SYMBOL_EXISTS(major "sys/mkdev.h" MAJOR_IN_MKDEV)
CHECK_SYMBOL_EXISTS(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
IF(HAVE_STRERROR_R)
SET(HAVE_DECL_STRERROR_R 1)
ENDIF(HAVE_STRERROR_R)
#
# Check defines
#
SET(headers "limits.h")
IF(HAVE_STDINT_H)
LIST(APPEND headers "stdint.h")
ENDIF(HAVE_STDINT_H)
IF(HAVE_INTTYPES_H)
LIST(APPEND headers "inttypes.h")
ENDIF(HAVE_INTTYPES_H)
CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE)
CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ)
CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER)
CHECK_SYMBOL_EXISTS(optarg "unistd.h" HAVE_DECL_OPTARG)
CHECK_SYMBOL_EXISTS(optind "unistd.h" HAVE_DECL_OPTIND)
CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX)
CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN)
CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX)
CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX)
CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX)
CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX)
#
# Check struct members
#
# Check for birthtime in struct stat
CHECK_STRUCT_MEMBER("struct stat" st_birthtime
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME)
# Check for high-resolution timestamps in struct stat
CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC)
CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
CHECK_STRUCT_MEMBER("struct stat" st_mtime_n
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N)
CHECK_STRUCT_MEMBER("struct stat" st_umtime
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME)
CHECK_STRUCT_MEMBER("struct stat" st_mtime_usec
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC)
# Check for block size support in struct stat
CHECK_STRUCT_MEMBER("struct stat" st_blksize
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE)
# Check for st_flags in struct stat (BSD fflags)
CHECK_STRUCT_MEMBER("struct stat" st_flags
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS)
#
#
CHECK_STRUCT_MEMBER("struct tm" tm_sec
"sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME)
#
# Check for integer types
#
# XXX There must be a way to make this simpler <sigh> XXXX
#
CHECK_TYPE_SIZE("long long int" LONG_LONG_INT)
CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG)
CHECK_TYPE_SIZE("unsigned long long int" UNSIGNED_LONG_LONG_INT)
#
CHECK_TYPE_SIZE(dev_t DEV_T)
IF(NOT HAVE_DEV_T)
IF(MSVC)
SET(dev_t "unsigned int")
ENDIF(MSVC)
ENDIF(NOT HAVE_DEV_T)
#
CHECK_TYPE_SIZE(gid_t GID_T)
IF(NOT HAVE_GID_T)
IF(WIN32)
SET(gid_t "short")
ELSE(WIN32)
SET(gid_t "unsigned int")
ENDIF(WIN32)
ENDIF(NOT HAVE_GID_T)
#
CHECK_TYPE_SIZE(id_t ID_T)
IF(NOT HAVE_ID_T)
IF(WIN32)
SET(id_t "short")
ELSE(WIN32)
SET(id_t "unsigned int")
ENDIF(WIN32)
ENDIF(NOT HAVE_ID_T)
#
CHECK_TYPE_SIZE(int32_t INT32_T)
IF(NOT HAVE_INT32_T)
SET(int32_t "int")
ENDIF(NOT HAVE_INT32_T)
#
CHECK_TYPE_SIZE(int64_t INT64_T)
IF(NOT HAVE_INT64_T)
IF(WIN32)
SET(int64_t __int64)
ENDIF(WIN32)
ENDIF(NOT HAVE_INT64_T)
#
CHECK_TYPE_SIZE(intmax_t INTMAX_T)
IF(NOT HAVE_INTMAX_T)
SET(intmax_t "int64_t")
ENDIF(NOT HAVE_INTMAX_T)
#
CHECK_TYPE_SIZE(mode_t MODE_T)
IF(NOT HAVE_MODE_T)
IF(WIN32)
SET(mode_t "unsigned short")
ELSE(WIN32)
SET(mode_t "int")
ENDIF(WIN32)
ENDIF(NOT HAVE_MODE_T)
#
CHECK_TYPE_SIZE(off_t OFF_T)
IF(NOT HAVE_OFF_T)
SET(off_t "__int64")
ENDIF(NOT HAVE_OFF_T)
#
CHECK_TYPE_SIZE(size_t SIZE_T)
IF(NOT HAVE_SIZE_T)
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
SET(size_t "uint64_t")
ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
SET(size_t "uint32_t")
ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
ENDIF(NOT HAVE_SIZE_T)
#
CHECK_TYPE_SIZE(ssize_t SSIZE_T)
IF(NOT HAVE_SSIZE_T)
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
SET(ssize_t "int64_t")
ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
SET(ssize_t "long")
ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
ENDIF(NOT HAVE_SSIZE_T)
#
CHECK_TYPE_SIZE(uid_t UID_T)
IF(NOT HAVE_UID_T)
IF(WIN32)
SET(uid_t "short")
ELSE(WIN32)
SET(uid_t "unsigned int")
ENDIF(WIN32)
ENDIF(NOT HAVE_UID_T)
#
CHECK_TYPE_SIZE(pid_t PID_T)
IF(NOT HAVE_PID_T)
IF(WIN32)
SET(pid_t "int")
ELSE(WIN32)
MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?")
ENDIF(WIN32)
ENDIF(NOT HAVE_PID_T)
#
CHECK_TYPE_SIZE(uint16_t UINT16_T)
IF(NOT HAVE_UINT16_T)
SET(uint16_t "unsigned short")
ENDIF(NOT HAVE_UINT16_T)
#
CHECK_TYPE_SIZE(uint32_t UINT32_T)
IF(NOT HAVE_UINT32_T)
SET(uint32_t "unsigned int")
ENDIF(NOT HAVE_UINT32_T)
#
CHECK_TYPE_SIZE(uint64_t UINT64_T)
IF(NOT HAVE_UINT64_T)
IF(WIN32)
SET(uint64_t "unsigned __int64")
ENDIF(WIN32)
ENDIF(NOT HAVE_UINT64_T)
#
CHECK_TYPE_SIZE(uintmax_t UINTMAX_T)
IF(NOT HAVE_UINTMAX_T)
SET(uintmax_t "uint64_t")
ENDIF(NOT HAVE_UINTMAX_T)
#
CHECK_TYPE_SIZE(intptr_t INTPTR_T)
IF(NOT HAVE_INTPTR_T)
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
SET(intptr_t "int64_t")
ELSE()
SET(intptr_t "int32_t")
ENDIF()
ENDIF(NOT HAVE_INTPTR_T)
#
CHECK_TYPE_SIZE(uintptr_t UINTPTR_T)
IF(NOT HAVE_UINTPTR_T)
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
SET(uintptr_t "uint64_t")
ELSE()
SET(uintptr_t "uint32_t")
ENDIF()
ENDIF(NOT HAVE_UINTPTR_T)
#
CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T)
IF(HAVE_SIZEOF_WCHAR_T)
SET(HAVE_WCHAR_T 1)
ENDIF(HAVE_SIZEOF_WCHAR_T)
#
# Check if _FILE_OFFSET_BITS macro needed for large files
#
CHECK_FILE_OFFSET_BITS()
#
# Check for Extended Attribute libraries, headers, and functions
#
IF(ENABLE_XATTR)
LA_CHECK_INCLUDE_FILE(attr/xattr.h HAVE_ATTR_XATTR_H)
LA_CHECK_INCLUDE_FILE(sys/xattr.h HAVE_SYS_XATTR_H)
CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_ATTR_LIB)
IF(HAVE_ATTR_LIB)
SET(CMAKE_REQUIRED_LIBRARIES "attr")
ENDIF(HAVE_ATTR_LIB)
CHECK_FUNCTION_EXISTS_GLIBC(extattr_get_file HAVE_EXTATTR_GET_FILE)
CHECK_FUNCTION_EXISTS_GLIBC(extattr_list_file HAVE_EXTATTR_LIST_FILE)
CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_fd HAVE_EXTATTR_SET_FD)
CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_file HAVE_EXTATTR_SET_FILE)
CHECK_FUNCTION_EXISTS_GLIBC(fsetxattr HAVE_FSETXATTR)
CHECK_FUNCTION_EXISTS_GLIBC(getxattr HAVE_GETXATTR)
CHECK_FUNCTION_EXISTS_GLIBC(lgetxattr HAVE_LGETXATTR)
CHECK_FUNCTION_EXISTS_GLIBC(listxattr HAVE_LISTXATTR)
CHECK_FUNCTION_EXISTS_GLIBC(llistxattr HAVE_LLISTXATTR)
CHECK_FUNCTION_EXISTS_GLIBC(lsetxattr HAVE_LSETXATTR)
ENDIF(ENABLE_XATTR)
#
# Check for ACL libraries, headers, and functions
#
# The ACL support in libarchive is written against the POSIX1e draft,
# which was never officially approved and varies quite a bit across
# platforms. Worse, some systems have completely non-POSIX acl functions,
# which makes the following checks rather more complex than I would like.
#
IF(ENABLE_ACL)
CHECK_LIBRARY_EXISTS(acl "acl_get_file" "" HAVE_ACL_LIB)
IF(HAVE_ACL_LIB)
SET(CMAKE_REQUIRED_LIBRARIES "acl")
FIND_LIBRARY(ACL_LIBRARY NAMES acl)
LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY})
ENDIF(HAVE_ACL_LIB)
#
CHECK_FUNCTION_EXISTS_GLIBC(acl_create_entry HAVE_ACL_CREATE_ENTRY)
CHECK_FUNCTION_EXISTS_GLIBC(acl_init HAVE_ACL_INIT)
CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd HAVE_ACL_SET_FD)
CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd_np HAVE_ACL_SET_FD_NP)
CHECK_FUNCTION_EXISTS_GLIBC(acl_set_file HAVE_ACL_SET_FILE)
CHECK_TYPE_EXISTS(acl_permset_t "${INCLUDES}" HAVE_ACL_PERMSET_T)
# The "acl_get_perm()" function was omitted from the POSIX draft.
# (It's a pretty obvious oversight; otherwise, there's no way to
# test for specific permissions in a permset.) Linux uses the obvious
# name, FreeBSD adds _np to mark it as "non-Posix extension."
# Test for both as a double-check that we really have POSIX-style ACL support.
CHECK_SYMBOL_EXISTS(acl_get_perm "${INCLUDES}" HAVE_ACL_GET_PERM)
CHECK_SYMBOL_EXISTS(acl_get_perm_np "${INCLUDES}" HAVE_ACL_GET_PERM_NP)
CHECK_SYMBOL_EXISTS(acl_get_link "${INCLUDES}" HAVE_ACL_GET_LINK)
CHECK_SYMBOL_EXISTS(acl_get_link_np "${INCLUDES}" HAVE_ACL_GET_LINK_NP)
# MacOS has an acl.h that isn't POSIX. It can be detected by
# checking for ACL_USER
CHECK_SYMBOL_EXISTS(ACL_USER "${INCLUDES}" HAVE_ACL_USER)
ENDIF(ENABLE_ACL)
# Generate "config.h" from "build/cmake/config.h.in"
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
#
# Register installation of PDF documents.
#
IF(WIN32 AND NOT CYGWIN)
#
# On Windows platform, It's better that we install PDF documents
# on one's computer.
# These PDF documents are available in the release package.
#
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf
DESTINATION share/man
FILES_MATCHING PATTERN "*.pdf"
)
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf)
ENDIF(WIN32 AND NOT CYGWIN)
#
#
#
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libarchive)
#
IF(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ENDIF(MSVC)
# Especially for early development, we want to be a little
# aggressive about diagnosing build problems; this can get
# relaxed somewhat in final shipping versions.
IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
ADD_DEFINITIONS(-Wall -Werror)
ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
IF(ENABLE_TEST)
ADD_CUSTOM_TARGET(run_all_tests)
ENDIF(ENABLE_TEST)
add_subdirectory(libarchive)
add_subdirectory(tar)
add_subdirectory(cpio)

View file

@ -22,7 +22,7 @@ the actual statements in the files are controlling.
tar/matching.c
* The following source files are in the public domain:
tar/getdate.y
tar/getdate.c
* The build files---including Makefiles, configure scripts,
and auxiliary scripts used as part of the compile process---have
@ -35,7 +35,7 @@ do use the license below. The varying licensing of the build scripts
seems to be an unavoidable mess.
Copyright (c) 2003-2008 <author(s)>
Copyright (c) 2003-2009 <author(s)>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,8 @@
On most Unix-like systems, you should be able to install libarchive
and bsdtar using the following common steps:
More complete build documentation is available on the libarchive
Wiki: http://libarchive.googlecode.com/
On most Unix-like systems, you should be able to install libarchive,
bsdtar, and bsdcpio using the following common steps:
./configure
make
make install
@ -9,12 +12,19 @@ the build setting, use
./configure --help
to list the configure options.
To build and install only libarchive:
./configure
make
cd libarchive && make install
If you are developing libarchive and need to update the
configure script and other build files:
/bin/sh build/autogen.sh
To build and install only bsdtar (assumes a suitable
libarchive is already installed on the system):
./configure
cd tar && make && make install
To create a distribution, please use the 'distcheck' target:
/bin/sh build/autogen.sh && ./configure && make distcheck
On non-Unix-like systems, use the "cmake" utility (available from
http://cmake.org/) to generate suitable build files for your platform.
Cmake requires the name of the directory containing CmakeLists.txt and
the "generator" to use for your build environment. For example, to
build with Xcode on Mac OS, you can use the following command:
cmake -G "Xcode" ~/libarchive-download-dir/
The result will be appropriate makefiles, solution files, or project
files that can be used with the corresponding development tool.
See the libarchive Wiki or the cmake site for further documentation.

View file

@ -1,11 +1,13 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign subdir-objects
ACLOCAL_AMFLAGS = -I build/autoconf
#
# What to build and install
#
lib_LTLIBRARIES= libarchive.la
noinst_LTLIBRARIES= libarchive_fe.la
bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs)
man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS)
BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h
@ -19,15 +21,27 @@ TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs)
TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT)
# Always build and test both bsdtar and bsdcpio as part of 'distcheck'
DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
# Uncommenting this line can help diagnose some errors. This is ordinarily
# enabled in the libarchive development branch but is disabled
# for libarchive production releases.
#AM_CFLAGS=-Wall -Werror
PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@
AM_CPPFLAGS=$(PLATFORMCPPFLAGS)
#
# What to include in the distribution
#
EXTRA_DIST= version \
EXTRA_DIST= \
CMakeLists.txt \
build/autogen.sh \
build/bump-version.sh \
build/clean.sh \
build/cmake \
build/version \
build/windows \
contrib \
doc \
examples \
windows \
$(libarchive_EXTRA_DIST) \
$(libarchive_test_EXTRA_DIST) \
$(bsdtar_EXTRA_DIST) \
@ -46,10 +60,16 @@ dist-hook:
-rm -f $(distdir)/*/Makefile $(distdir)/*/*/Makefile
cd $(distdir)/doc && /bin/sh update.sh
# Verify cmake builds as part of the acceptance
distcheck-hook:
mkdir $(distdir)/_build/cmtest
cd $(distdir)/_build/cmtest && cmake ../.. && make && make test
rm -rf $(distdir)/_build/cmtest
#
# Extra rules for cleanup
#
DISTCLEANFILES= tar/getdate.c tar/getdate.h \
DISTCLEANFILES= \
libarchive/test/list.h \
tar/test/list.h \
cpio/test/list.h
@ -82,10 +102,16 @@ libarchive_la_SOURCES= \
libarchive/archive_entry_private.h \
libarchive/archive_entry_stat.c \
libarchive/archive_entry_strmode.c \
libarchive/archive_entry_xattr.c \
libarchive/archive_hash.h \
libarchive/archive_platform.h \
libarchive/archive_private.h \
libarchive/archive_read.c \
libarchive/archive_read_data_into_fd.c \
libarchive/archive_read_disk.c \
libarchive/archive_read_disk_entry_from_file.c \
libarchive/archive_read_disk_private.h \
libarchive/archive_read_disk_set_standard_lookup.c \
libarchive/archive_read_extract.c \
libarchive/archive_read_open_fd.c \
libarchive/archive_read_open_file.c \
@ -98,13 +124,18 @@ libarchive_la_SOURCES= \
libarchive/archive_read_support_compression_gzip.c \
libarchive/archive_read_support_compression_none.c \
libarchive/archive_read_support_compression_program.c \
libarchive/archive_read_support_compression_rpm.c \
libarchive/archive_read_support_compression_uu.c \
libarchive/archive_read_support_compression_xz.c \
libarchive/archive_read_support_format_all.c \
libarchive/archive_read_support_format_ar.c \
libarchive/archive_read_support_format_cpio.c \
libarchive/archive_read_support_format_empty.c \
libarchive/archive_read_support_format_iso9660.c \
libarchive/archive_read_support_format_mtree.c \
libarchive/archive_read_support_format_raw.c \
libarchive/archive_read_support_format_tar.c \
libarchive/archive_read_support_format_xar.c \
libarchive/archive_read_support_format_zip.c \
libarchive/archive_string.c \
libarchive/archive_string.h \
@ -125,27 +156,38 @@ libarchive_la_SOURCES= \
libarchive/archive_write_set_compression_gzip.c \
libarchive/archive_write_set_compression_none.c \
libarchive/archive_write_set_compression_program.c \
libarchive/archive_write_set_compression_xz.c \
libarchive/archive_write_set_format.c \
libarchive/archive_write_set_format_ar.c \
libarchive/archive_write_set_format_by_name.c \
libarchive/archive_write_set_format_cpio.c \
libarchive/archive_write_set_format_cpio_newc.c \
libarchive/archive_write_set_format_mtree.c \
libarchive/archive_write_set_format_pax.c \
libarchive/archive_write_set_format_shar.c \
libarchive/archive_write_set_format_ustar.c \
libarchive/archive_write_set_format_zip.c \
libarchive/config_freebsd.h \
libarchive/config_windows.h \
libarchive/filter_fork.c \
libarchive/filter_fork.h
# cygwin barfs without -no-undefined; I don't know what it does or
# whether it helps or hurts other platforms...
if INC_WINDOWS_FILES
libarchive_la_SOURCES+= \
libarchive/archive_entry_copy_bhfi.c \
libarchive/archive_windows.h \
libarchive/archive_windows.c \
libarchive/filter_fork_windows.c
endif
# -no-undefined marks that libarchive doesn't rely on symbols
# defined in the application. This is mandatory for cygwin.
libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION)
# Manpages to install
libarchive_man_MANS= \
libarchive/archive_entry.3 \
libarchive/archive_read.3 \
libarchive/archive_read_disk.3 \
libarchive/archive_util.3 \
libarchive/archive_write.3 \
libarchive/archive_write_disk.3 \
@ -161,8 +203,14 @@ libarchive_EXTRA_DIST= \
libarchive/test/list.h \
libarchive/archive_windows.c \
libarchive/archive_windows.h \
libarchive/filter_fork_windows.c \
libarchive/CMakeLists.txt \
$(libarchive_man_MANS)
# pkgconfig
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = build/pkgconfig/libarchive.pc
#
#
# libarchive_test program
@ -174,66 +222,113 @@ libarchive_test_SOURCES= \
libarchive/test/read_open_memory.c \
libarchive/test/test.h \
libarchive/test/test_acl_basic.c \
libarchive/test/test_acl_freebsd.c \
libarchive/test/test_acl_pax.c \
libarchive/test/test_archive_api_feature.c \
libarchive/test/test_bad_fd.c \
libarchive/test/test_compat_bzip2.c \
libarchive/test/test_compat_cpio.c \
libarchive/test/test_compat_gtar.c \
libarchive/test/test_compat_gzip.c \
libarchive/test/test_compat_lzma.c \
libarchive/test/test_compat_solaris_tar_acl.c \
libarchive/test/test_compat_tar_hardlink.c \
libarchive/test/test_compat_xz.c \
libarchive/test/test_compat_zip.c \
libarchive/test/test_empty_write.c \
libarchive/test/test_entry.c \
libarchive/test/test_extattr_freebsd.c \
libarchive/test/test_fuzz.c \
libarchive/test/test_entry_strmode.c \
libarchive/test/test_link_resolver.c \
libarchive/test/test_open_fd.c \
libarchive/test/test_open_file.c \
libarchive/test/test_open_filename.c \
libarchive/test/test_pax_filename_encoding.c \
libarchive/test/test_read_compress_program.c \
libarchive/test/test_read_data_large.c \
libarchive/test/test_read_disk.c \
libarchive/test/test_read_disk_entry_from_file.c \
libarchive/test/test_read_extract.c \
libarchive/test/test_read_file_nonexistent.c \
libarchive/test/test_read_format_ar.c \
libarchive/test/test_read_format_cpio_bin.c \
libarchive/test/test_read_format_cpio_bin_Z.c \
libarchive/test/test_read_format_cpio_bin_be.c \
libarchive/test/test_read_format_cpio_bin_bz2.c \
libarchive/test/test_read_format_cpio_bin_gz.c \
libarchive/test/test_read_format_cpio_bin_lzma.c \
libarchive/test/test_read_format_cpio_bin_xz.c \
libarchive/test/test_read_format_cpio_odc.c \
libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \
libarchive/test/test_read_format_cpio_svr4_gzip.c \
libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \
libarchive/test/test_read_format_cpio_svr4c_Z.c \
libarchive/test/test_read_format_empty.c \
libarchive/test/test_read_format_gtar_gz.c \
libarchive/test/test_read_format_gtar_lzma.c \
libarchive/test/test_read_format_gtar_sparse.c \
libarchive/test/test_read_format_iso_gz.c \
libarchive/test/test_read_format_iso_multi_extent.c \
libarchive/test/test_read_format_isojoliet_bz2.c \
libarchive/test/test_read_format_isojoliet_long.c \
libarchive/test/test_read_format_isojoliet_rr.c \
libarchive/test/test_read_format_isorr_bz2.c \
libarchive/test/test_read_format_isorr_ce.c \
libarchive/test/test_read_format_isorr_new_bz2.c \
libarchive/test/test_read_format_isorr_rr_moved.c \
libarchive/test/test_read_format_isozisofs_bz2.c \
libarchive/test/test_read_format_mtree.c \
libarchive/test/test_read_format_pax_bz2.c \
libarchive/test/test_read_format_raw.c \
libarchive/test/test_read_format_tar.c \
libarchive/test/test_read_format_tar_empty_filename.c \
libarchive/test/test_read_format_tbz.c \
libarchive/test/test_read_format_tgz.c \
libarchive/test/test_read_format_tlz.c \
libarchive/test/test_read_format_txz.c \
libarchive/test/test_read_format_tz.c \
libarchive/test/test_read_format_xar.c \
libarchive/test/test_read_format_zip.c \
libarchive/test/test_read_large.c \
libarchive/test/test_read_pax_truncated.c \
libarchive/test/test_read_position.c \
libarchive/test/test_read_truncated.c \
libarchive/test/test_read_uu.c \
libarchive/test/test_tar_filenames.c \
libarchive/test/test_tar_large.c \
libarchive/test/test_ustar_filenames.c \
libarchive/test/test_write_compress.c \
libarchive/test/test_write_compress_bzip2.c \
libarchive/test/test_write_compress_gzip.c \
libarchive/test/test_write_compress_lzma.c \
libarchive/test/test_write_compress_program.c \
libarchive/test/test_write_compress_xz.c \
libarchive/test/test_write_disk.c \
libarchive/test/test_write_disk_failures.c \
libarchive/test/test_write_disk_hardlink.c \
libarchive/test/test_write_disk_perms.c \
libarchive/test/test_write_disk_secure.c \
libarchive/test/test_write_disk_sparse.c \
libarchive/test/test_write_disk_symlink.c \
libarchive/test/test_write_disk_times.c \
libarchive/test/test_write_format_ar.c \
libarchive/test/test_write_format_cpio.c \
libarchive/test/test_write_format_cpio_empty.c \
libarchive/test/test_write_format_cpio_odc.c \
libarchive/test/test_write_format_cpio_newc.c \
libarchive/test/test_write_format_mtree.c \
libarchive/test/test_write_format_pax.c \
libarchive/test/test_write_format_shar_empty.c \
libarchive/test/test_write_format_tar.c \
libarchive/test/test_write_format_tar_empty.c \
libarchive/test/test_write_format_tar_ustar.c \
libarchive/test/test_write_format_zip.c \
libarchive/test/test_write_format_zip_empty.c \
libarchive/test/test_write_format_zip_no_compression.c \
libarchive/test/test_write_open_memory.c
libarchive_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test
libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS)
# The "list.h" file just lists all of the tests defined in all of the sources.
# Building it automatically provides a sanity-check on libarchive_test_SOURCES
@ -244,20 +339,62 @@ libarchive/test/list.h: Makefile
libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test
libarchive_test_EXTRA_DIST=\
libarchive/test/test_compat_gtar_1.tgz.uu \
libarchive/test/test_compat_bzip2_1.tbz.uu \
libarchive/test/test_compat_bzip2_2.tbz.uu \
libarchive/test/test_compat_cpio_1.cpio.uu \
libarchive/test/test_compat_gtar_1.tar.uu \
libarchive/test/test_compat_gzip_1.tgz.uu \
libarchive/test/test_compat_gzip_2.tgz.uu \
libarchive/test/test_compat_lzma_1.tlz.uu \
libarchive/test/test_compat_lzma_2.tlz.uu \
libarchive/test/test_compat_lzma_3.tlz.uu \
libarchive/test/test_compat_solaris_tar_acl.tar.uu \
libarchive/test/test_compat_tar_hardlink_1.tar.uu \
libarchive/test/test_compat_xz_1.txz.uu \
libarchive/test/test_compat_zip_1.zip.uu \
libarchive/test/test_pax_filename_encoding.tar.gz.uu \
libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu \
libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu \
libarchive/test/test_fuzz_1.iso.Z.uu \
libarchive/test/test_pax_filename_encoding.tar.uu \
libarchive/test/test_read_format_ar.ar.uu \
libarchive/test/test_read_format_cpio_bin_be.cpio.uu \
libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \
libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \
libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \
libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \
libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \
libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu \
libarchive/test/test_read_format_iso.iso.Z.uu \
libarchive/test/test_read_format_iso_joliet.iso.Z.uu \
libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \
libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \
libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \
libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \
libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \
libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \
libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu\
libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \
libarchive/test/test_read_format_mtree.mtree.uu \
libarchive/test/test_read_format_raw.data.Z.uu \
libarchive/test/test_read_format_raw.data.uu \
libarchive/test/test_read_format_tar_empty_filename.tar.uu \
libarchive/test/test_read_format_zip.zip.uu
libarchive/test/test_read_format_zip.zip.uu \
libarchive/test/CMakeLists.txt \
libarchive/test/README
#
# Common code for libarchive frontends (cpio, tar)
#
libarchive_fe_la_SOURCES= \
libarchive_fe/err.c \
libarchive_fe/err.h \
libarchive_fe/lafe_platform.h \
libarchive_fe/line_reader.c \
libarchive_fe/line_reader.h \
libarchive_fe/matching.c \
libarchive_fe/matching.h \
libarchive_fe/pathmatch.c \
libarchive_fe/pathmatch.h
#
#
@ -269,29 +406,43 @@ bsdtar_SOURCES= \
tar/bsdtar.c \
tar/bsdtar.h \
tar/bsdtar_platform.h \
tar/getdate.y \
tar/matching.c \
tar/cmdline.c \
tar/getdate.c \
tar/read.c \
tar/siginfo.c \
tar/subst.c \
tar/tree.c \
tar/tree.h \
tar/util.c \
tar/write.c
bsdtar_DEPENDENCIES= libarchive.la
if STATIC_BSDTAR
bsdtar_static= -static
else
bsdtar_static=
if INC_WINDOWS_FILES
bsdtar_SOURCES+= \
tar/bsdtar_windows.h \
tar/bsdtar_windows.c
endif
bsdtar_LDADD= libarchive.la
bsdtar_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
bsdtar_LDFLAGS= $(bsdtar_static)
bsdtar_DEPENDENCIES= libarchive.la libarchive_fe.la
if STATIC_BSDTAR
bsdtar_ldstatic= -static
bsdtar_ccstatic= -DLIBARCHIVE_STATIC
else
bsdtar_ldstatic=
bsdtar_ccstatic=
endif
bsdtar_LDADD= libarchive.la libarchive_fe.la
bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS)
bsdtar_LDFLAGS= $(bsdtar_ldstatic)
bsdtar_EXTRA_DIST= \
tar/bsdtar.1
tar/bsdtar.1 \
tar/bsdtar_windows.h \
tar/bsdtar_windows.c \
tar/CMakeLists.txt \
tar/config_freebsd.h \
tar/test/list.h
if BUILD_BSDTAR
bsdtar_man_MANS= tar/bsdtar.1
@ -312,26 +463,49 @@ bsdtar_test_SOURCES= \
tar/test/test_0.c \
tar/test/test_basic.c \
tar/test/test_copy.c \
tar/test/test_empty_mtree.c \
tar/test/test_getdate.c \
tar/test/test_help.c \
tar/test/test_option_T.c \
tar/test/test_option_T_upper.c \
tar/test/test_option_q.c \
tar/test/test_option_r.c \
tar/test/test_option_s.c \
tar/test/test_patterns.c \
tar/test/test_stdio.c \
tar/test/test_version.c
tar/test/test_strip_components.c \
tar/test/test_symlink_dir.c \
tar/test/test_version.c \
tar/test/test_windows.c
bsdtar_test_CPPFLAGS= -I$(top_builddir)/tar/test
# For now, bsdtar_test uses Windows shims from tar/bsdtar_windows.*
if INC_WINDOWS_FILES
bsdtar_test_SOURCES+= \
tar/bsdtar_windows.h \
tar/bsdtar_windows.c
endif
bsdtar_test_CPPFLAGS=\
-I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
-I$(top_srcdir)/tar -I$(top_builddir)/tar/test \
$(PLATFORMCPPFLAGS)
tar/test/list.h: Makefile
cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h
if BUILD_BSDTAR
bsdtar_test_programs= bsdtar_test
bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test
bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test
else
bsdtar_test_programs=
bsdtar_TESTS_ENVIRONMENT=
endif
bsdtar_test_EXTRA_DIST= \
tar/test/test_patterns_2.tar.uu \
tar/test/test_patterns_3.tar.uu \
tar/test/test_patterns_4.tar.uu \
tar/test/CMakeLists.txt
#
#
@ -343,28 +517,37 @@ bsdcpio_SOURCES= \
cpio/cmdline.c \
cpio/cpio.c \
cpio/cpio.h \
cpio/cpio_platform.h \
cpio/err.c \
cpio/matching.c \
cpio/matching.h \
cpio/pathmatch.c \
cpio/pathmatch.h
cpio/cpio_platform.h
bsdcpio_DEPENDENCIES = libarchive.la
if INC_WINDOWS_FILES
bsdcpio_SOURCES+= \
cpio/cpio_windows.h \
cpio/cpio_windows.c
endif
bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la
if STATIC_BSDCPIO
bsdcpio_static= -static
bsdcpio_ldstatic= -static
bsdcpio_ccstatic= -DLIBARCHIVE_STATIC
else
bsdcpio_static=
bsdcpio_ldstatic=
bsdcpio_ccstatic=
endif
bsdcpio_LDADD= libarchive.la
bsdcpio_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive
bsdcpio_LDFLAGS= $(bsdcpio_static)
bsdcpio_LDADD= libarchive_fe.la libarchive.la
bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS)
bsdcpio_LDFLAGS= $(bsdcpio_ldstatic)
bsdcpio_EXTRA_DIST= \
cpio/test/list.h \
cpio/bsdcpio.1
cpio/bsdcpio.1 \
cpio/cpio_windows.h \
cpio/cpio_windows.c \
cpio/CMakeLists.txt \
cpio/config_freebsd.h
if BUILD_BSDCPIO
# Manpages to install
@ -381,22 +564,25 @@ endif
bsdcpio_test_SOURCES= \
cpio/cmdline.c \
cpio/err.c \
cpio/pathmatch.c \
cpio/test/main.c \
cpio/test/test.h \
cpio/test/test_0.c \
cpio/test/test_basic.c \
cpio/test/test_cmdline.c \
cpio/test/test_format_newc.c \
cpio/test/test_gcpio_compat.c \
cpio/test/test_option_B_upper.c \
cpio/test/test_option_C_upper.c \
cpio/test/test_option_J_upper.c \
cpio/test/test_option_L_upper.c \
cpio/test/test_option_Z_upper.c \
cpio/test/test_option_a.c \
cpio/test/test_option_B.c \
cpio/test/test_option_c.c \
cpio/test/test_option_d.c \
cpio/test/test_option_f.c \
cpio/test/test_option_help.c \
cpio/test/test_option_L.c \
cpio/test/test_option_ell.c \
cpio/test/test_option_l.c \
cpio/test/test_option_lzma.c \
cpio/test/test_option_m.c \
cpio/test/test_option_t.c \
cpio/test/test_option_u.c \
@ -404,16 +590,22 @@ bsdcpio_test_SOURCES= \
cpio/test/test_option_y.c \
cpio/test/test_option_z.c \
cpio/test/test_owner_parse.c \
cpio/test/test_passthrough_dotdot.c \
cpio/test/test_passthrough_reverse.c \
cpio/test/test_pathmatch.c
bsdcpio_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -I$(top_builddir)/cpio/test
bsdcpio_test_CPPFLAGS= \
-I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
-I$(top_srcdir)/cpio -I$(top_builddir)/cpio/test \
$(PLATFORMCPPFLAGS)
bsdcpio_test_LDADD=libarchive_fe.la
cpio/test/list.h: Makefile
cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h
if BUILD_BSDCPIO
bsdcpio_test_programs= bsdcpio_test
bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
else
bsdcpio_test_programs=
bsdcpio_TESTS_ENVIRONMENT=
@ -428,4 +620,5 @@ bsdcpio_test_EXTRA_DIST= \
cpio/test/test_option_m.cpio.uu \
cpio/test/test_option_t.cpio.uu \
cpio/test/test_option_t.stdout.uu \
cpio/test/test_option_tv.stdout.uu
cpio/test/test_option_tv.stdout.uu \
cpio/test/CMakeLists.txt

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,94 @@
Feb 04, 2010: libarchive 2.8.0 released
Jan 17, 2010: Fix error handling for 'echo nonexistent | cpio -o'
Jan 17, 2010: Don't use futimes() on Cygwin
Jan 02, 2010: libarchive 2.7.902a released (test release for 2.8)
Jan 02, 2010: Fix tar/test/test_windows on MinGW
Jan 02, 2010: Fix memory leaks in libarchive tests
Jan 01, 2010: Fix memory leak when filter startup fails
Dec 27, 2009: libarchive 2.7.901a released (test release for 2.8)
Aug 04, 2009: libarchive 2.7.1 released
Jul 20, 2009: Suppress bogus warning about unxz
Jul 19, 2009: Support Cygwin 1.7
Jun 11, 2009: Support lzma/xz files compressed with larger buffer sizes.
May 24, 2009: Handle gzip files signed with OpenBSD "gzsig" program.
May 07, 2009: Avoid false failures when reading from pipe.
Apr 16, 2009: libarchive 2.7.0 released
Apr 10, 2009: libarchive 2.6.992a released
Apr 09, 2009: Fix SIGPIPE issue building with MSVC.
Apr 09, 2009: Fix several minor memory leaks in libarchive and libarchive_test
Apr 08, 2009: libarchive 2.6.991a released
Apr 07, 2009: Additional tests added to bsdcpio_test
Apr 01, 2009: libarchive 2.6.990a released
Apr 01, 2009: Use command-line gunzip, bunzip2, unxz, unlzma for
decompression if the library is built without suitable
libraries. The setup functions return ARCHIVE_WARN
in this case so clients can adapt if necessary.
Apr 01, 2009: Use getpw*_r and getgr*_r functions for thread-safety.
Mar 24, 2009: Add archive_read_next_header2(), which is up to 25%
more efficient for some clients; from Brian Harring.
Mar 22, 2009: PDF versions of manpages are now included in the distribution.
Mar, 2009: Major work to improve Cygwin build by Charles Wilson.
Feb/Mar, 2009: Major work on cmake build support, mostly by Michihiro NAKAJIMA.
Feb/Mar, 2009: Major work on Visual Studio support by Michihiro NAKAJIMA.
All tests now pass.
Feb 25, 2009: Fix Debian Bug #516577
Feb 21, 2009: Yacc is no longer needed to build; date parser rewritten in C.
Jan/Feb, 2009: Mtree work by Michihiro.
Feb, 2009: Joliet support by Andreas Henriksson.
Jan/Feb, 2009: New options framework by Michihiro.
Feb, 2009: High-res timestamps on Tru64, AIX, and GNU Hurd, by Björn Jacke.
Jan 18, 2009: Extended attributes work on FreeBSD and Linux now with pax format.
Jan 07, 2009: New archive_read_disk_entry_from_file() knows about ACLs,
extended attributes, etc so that bsdtar and bsdcpio don't require
such system-specific knowledge.
Jan 03, 2009: Read filter system extensively refactored. In particular,
read filter pipelines are now built out automatically and individual
filters should be much easier to implement. Documentation on the
Googlecode Wiki explains how to implement new filters.
Dec 28, 2008: Many Windows/Visual Studio fixes from Michihiro NAKAJIMA.
Dec 28, 2008: Main libarchive development moved from FreeBSD Perforce
server to Google Code. This should make it easier for more
people to participate in libarchive development.
Dec 28, 2008: libarchive 2.6.0 released
Dec 25, 2008: libarchive 2.5.905a released
Dec 10, 2008: libarchive 2.5.904a released
Dec 04, 2008: libarchive 2.5.903a released
Nov 09, 2008: libarchive 2.5.902a released
Nov 08, 2008: libarchive 2.5.901a released
Nov 08, 2008: Start of pre-release testing for libarchive 2.6
Nov 07, 2008: Read filter refactor: The decompression routines just
consume and produce arbitrarily-sized blocks. The reblocking
from read_support_compression_none() has been pulled into the
read core. Also, the decompression bid now makes multiple
passes and stacks read filters.
Oct 21, 2008: bsdcpio: New command-line parser.
Oct 19, 2008: Internal read_ahead change: short reads are now an error
Oct 06, 2008: bsdtar: option parser no longer uses getopt_long(),
gives consistent option parsing on all platforms.
Sep 19, 2008: Jaakko Heinonen: shar utility built on libarchive
Sep 17, 2008: Pedro Giffuni: birthtime support
Sep 17, 2008: Miklos Vajna: lzma reader and test. Note: I still have
some concerns about the auto-detection (LZMA file format
doesn't support auto-detection well), so this is not yet
enabled under archive_read_support_compression_all(). For
now, you must call archive_read_support_compression_lzma() if
you want LZMA read support.
Sep 11, 2008: Ivailo Petrov: Many fixes to Windows build, new solution files
Jul 26, 2008: archive_entry now tracks which values have not been set.
This helps zip extraction (file size is often "unknown") and
time restores (tar usually doesn't know atime).
Jul 26, 2008: Joerg Sonnenberger: Performance improvements to shar writer
Jul 25, 2008: Joerg Sonnenberger: mtree write support
Jul 02, 2008: libarchive 2.5.5 released
@ -323,7 +414,7 @@ Feb 27, 2007: Make the GID restore checks more robust by checking
Feb 26, 2007: libarchive 2.0b15 released
Feb 26, 2007: Don't lose symlinks when extracting from ISOs.
Thanks to Diego "Flameeyes" Pettenò for telling me about the
Thanks to Diego "Flameeyes" Pettenò for telling me about the
broken testcase on Gentoo that (finally!) led me to the cause
of this long-standing bug.

View file

@ -1,7 +1,11 @@
README for libarchive bundle.
This distribution bundle includes the following components:
Questions? Issues?
* http://libarchive.googlecode.com/ is the home for ongoing
libarchive development, including issue tracker, additional
documentation, and links to the libarchive mailing lists.
This distribution bundle includes the following components:
* libarchive: a library for reading and writing streaming archives
* tar: the 'bsdtar' program is a full-featured 'tar'
replacement built on libarchive
@ -20,38 +24,41 @@ The top-level directory contains the following information files:
* INSTALL - installation instructions
* README - this file
* configure - configuration script, see INSTALL for details.
* CMakeLists.txt - input for "cmake" build tool, see INSTALL
The following files in the top-level directory are used by the
'configure' script:
* Makefile.am, aclocal.m4, configure.ac
- used to build this distribution, only needed by maintainers
* Makefile.in, config.h.in
- templates used by configure script
* config.aux/* - auxiliary scripts used by build system
Guide to Documentation installed by this system:
* bsdtar.1 explains the use of the bsdtar program
* bsdcpio.1 explains the use of the bsdcpio program
* libarchive.3 gives an overview of the library as a whole
* archive_read.3, archive_write.3, and archive_write_disk.3 provide
detailed calling sequences for the read and write APIs
* archive_read.3, archive_write.3, archive_write_disk.3, and
archive_read_disk.3 provide detailed calling sequences for the read
and write APIs
* archive_entry.3 details the "struct archive_entry" utility class
* archive_internals.3 provides some insight into libarchive's
internal structure and operation.
* libarchive-formats.5 documents the file formats supported by the library
* cpio.5, mtree.5, and tar.5 provide detailed information about a
variety of different archive formats, including hard-to-find details
about modern cpio and tar variants.
* cpio.5, mtree.5, and tar.5 provide detailed information about these
popular archive formats, including hard-to-find details about
modern cpio and tar variants.
The manual pages above are provided in the 'doc' directory in
a number of different formats.
You should also read the copious comments in "archive.h" and the source
code for the sample "bsdtar" program for more details. Please let me know
about any errors or omissions you find.
You should also read the copious comments in "archive.h" and the
source code for the sample programs for more details. Please let me
know about any errors or omissions you find.
Currently, the library automatically detects and reads the following:
* gzip compression
* bzip2 compression
* compress/LZW compression
* lzma and xz compression
* GNU tar format (including GNU long filenames, long link names, and
sparse files)
* Solaris 9 extended tar format (including ACLs)
@ -60,8 +67,9 @@ Currently, the library automatically detects and reads the following:
* POSIX pax interchange format
* POSIX octet-oriented cpio
* SVR4 ASCII cpio
* POSIX octet-oriented cpio
* Binary cpio (big-endian or little-endian)
* ISO9660 CD-ROM images (with optional Rockridge extensions)
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
@ -70,6 +78,7 @@ The library can write:
* gzip compression
* bzip2 compression
* compress/LZW compression
* lzma and xz compression
* POSIX ustar
* POSIX pax interchange format
* "restricted" pax format, which will create ustar archives except for
@ -77,19 +86,20 @@ The library can write:
* POSIX octet-oriented cpio
* SVR4 "newc" cpio
* shar archives
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
Notes about the library architecture:
* This is a heavily stream-oriented system. There is no direct
support for in-place modification or random access and no intention
of ever adding such support. Adding such support would require
sacrificing a lot of other features, so don't bother asking.
support for in-place modification or random access.
* The library is designed to be extended with new compression and
archive formats. The only requirement is that the format be
readable or writable as a stream and that each archive entry be
independent.
independent. There are articles on the libarchive Wiki explaining
how to extend libarchive.
* On read, compression and format are always detected automatically.
@ -103,7 +113,7 @@ Notes about the library architecture:
environments where that matters.
* On read, the library accepts whatever blocks you hand it.
Your read callback is free to pass the library a byte at a time[1]
Your read callback is free to pass the library a byte at a time
or mmap the entire archive and give it to the library at once.
On write, the library always produces correctly-blocked output.
@ -125,11 +135,3 @@ Notes about the library architecture:
* Note: "pax interchange format" is really an extended tar format,
despite what the name says.
[1] Gzip and compress formats are identical in the first byte.
For that reason, the first block must be at least two bytes if
you have both of these formats enabled at read time. This is
currently the only restriction on block size. (This restriction
could be lifted by buffering the initial blocks prior to the
compression tasting step, but it doesn't really seem worth the
effort.)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,51 @@
# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE)
# -------------------------------
# Produce a source which links correctly iff the FUNCTION exists.
AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY],
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -----------------------------------------------------------------
AC_DEFUN([AC_CHECK_STDCALL_FUNC],
[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
AC_CACHE_CHECK([for $1], ac_var,
[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])],
[AS_VAR_SET(ac_var, yes)],
[AS_VAR_SET(ac_var, no)])])
AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
AS_VAR_POPDEF([ac_var])dnl
])# AC_CHECK_FUNC
# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE)
# ----------------------------------
# Don't include <ctype.h> because on OSF/1 3.0 it includes
# <sys/types.h> which includes <sys/select.h> which contains a
# prototype for select. Similarly for bzero.
m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)],
[AC_LANG_PROGRAM(
[/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char __stdcall $1 ( $2 ) below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char __stdcall $1 ( $2 );
char (*f) ( $2 );
],
[/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$1) || defined (__stub___$1)
choke me
#else
f = $1;
#endif
])])
# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION)
# ------------------------------------
m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)])

View file

@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,589 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -0,0 +1,519 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -0,0 +1,20 @@
# la_TYPE_UID_T
# -------------
AC_DEFUN([la_TYPE_UID_T],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_CACHE_CHECK(for uid_t in sys/types.h, la_cv_type_uid_t,
[AC_EGREP_HEADER(uid_t, sys/types.h,
la_cv_type_uid_t=yes, la_cv_type_uid_t=no)])
if test $la_cv_type_uid_t = no; then
case $host in
*mingw*) def_uid_t=short ;;
*) def_uid_t=int ;;
esac
AC_DEFINE_UNQUOTED(uid_t, [$def_uid_t],
[Define to match typeof st_uid field of struct stat if <sys/types.h> doesn't define.])
AC_DEFINE_UNQUOTED(gid_t, [$def_uid_t],
[Define to match typeof st_gid field of struct stat if <sys/types.h> doesn't define.])
fi
])
AU_ALIAS([AC_TYPE_UID_T], [la_TYPE_UID_T])

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,367 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -0,0 +1,64 @@
#!/bin/sh
PATH=/usr/local/gnu-autotools/bin/:$PATH
export PATH
# Start from one level above the build directory
if [ -f version ]; then
cd ..
fi
if [ \! -f build/version ]; then
echo "Can't find source directory"
exit 1
fi
# BSD make's "OBJDIR" support freaks out the automake-generated
# Makefile. Effectively disable it.
export MAKEOBJDIRPREFIX=/junk
# Start from the build directory, where the version file is located
if [ -f build/version ]; then
cd build
fi
if [ \! -f version ]; then
echo "Can't find version file"
exit 1
fi
# Update the build number in the 'version' file.
# Separate number from additional alpha/beta/etc marker
MARKER=`cat version | sed 's/[0-9.]//g'`
# Bump the number
VN=`cat version | sed 's/[^0-9.]//g'`
# Build out the string.
VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
cd ..
# Clean up the source dir as much as we can.
/bin/sh build/clean.sh
# Substitute the integer version into Libarchive's archive.h
perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h
perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h
# Substitute versions into configure.ac as well
perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac
perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac
set -xe
aclocal -I build/autoconf
# Note: --automake flag needed only for libtoolize from
# libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet
case `uname` in
Darwin) glibtoolize --automake -c;;
*) libtoolize --automake -c;;
esac
autoconf
autoheader
automake -a -c
./configure
make distcheck

View file

@ -0,0 +1,36 @@
#!/bin/sh +v
# Start from the build directory, where the version file is located
if [ -f build/version ]; then
cd build
fi
if [ \! -f version ]; then
echo "Can't find version file"
exit 1
fi
# Update the build number in the 'version' file.
# Separate number from additional alpha/beta/etc marker
MARKER=`cat version | sed 's/[0-9.]//g'`
# Bump the number
VN=`cat version | sed 's/[^0-9.]//g'`
# Reassemble and write back out
VN=$(($VN + 1))
rm -f version.old
mv version version.old
chmod +w version.old
echo $VN$MARKER > version
VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
cd ..
ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released"
echo $ANNOUNCE
# Add a version notice to NEWS
mv NEWS NEWS.bak
chmod +w NEWS.bak
echo > NEWS
echo $ANNOUNCE >> NEWS
cat NEWS.bak >> NEWS

View file

@ -0,0 +1,81 @@
#!/bin/sh
if [ \! -f build/version ]; then
echo 'Must run the clean script from the top-level dir of the libarchive distribution' 1>&2
exit 1
fi
#
# The automake-generated 'maintainer-clean' target does clean up a
# lot. If that fails, try plain 'clean' in case we're using the cmake
# or other makefile. But don't worry if we can't...
#
make maintainer-clean || make clean || true
# If we're on BSD, blow away the build dir under /usr/obj
rm -rf /usr/obj`pwd`
#
# Try to clean up a bit more...
#
find . -name '*.So' | xargs rm
find . -name '*.a' | xargs rm
find . -name '*.la' | xargs rm
find . -name '*.lo' | xargs rm
find . -name '*.o' | xargs rm
find . -name '*.orig' | xargs rm
find . -name '*.po' | xargs rm
find . -name '*.rej' | xargs rm
find . -name '*~' | xargs rm
find . -name '.depend' | xargs rm
find . -name '.deps' | xargs rm -rf
find . -name '.dirstamp' | xargs rm
find . -name '.libs' | xargs rm -rf
rm -rf autom4te.cache
rm -f Makefile.in
rm -f aclocal.m4
rm -f bsdcpio
rm -f bsdcpio_test
rm -f bsdtar
rm -f bsdtar_test
rm -f build/autoconf/compile
rm -f build/autoconf/config.*
rm -f build/autoconf/depcomp
rm -f build/autoconf/install-sh
rm -f build/autoconf/libtool.m4
rm -f build/autoconf/ltmain.sh
rm -f build/autoconf/ltoptions.m4
rm -f build/autoconf/ltsugar.m4
rm -f build/autoconf/ltversion.m4
rm -f build/autoconf/lt~obsolete.m4
rm -f build/autoconf/missing
rm -f build/pkgconfig/libarchive.pc
rm -f build/version.old
rm -f config.h
rm -f config.h.in
rm -f config.log
rm -f config.status
rm -f configure
rm -f cpio/*.1.gz
rm -f cpio/bsdcpio
rm -f cpio/test/bsdcpio_test
rm -f cpio/test/list.h
rm -f doc/html/*
rm -f doc/man/*
rm -f doc/pdf/*
rm -f doc/text/*
rm -f doc/wiki/*
rm -f libarchive/*.[35].gz
rm -f libarchive/libarchive.so*
rm -f libarchive/test/libarchive_test
rm -f libarchive/test/list.h
rm -f libarchive_test
rm -f libtool
rm -f stamp-h1
rm -f tar/*.1.gz
rm -f tar/bsdtar
rm -f tar/test/bsdtar_test
rm -f tar/test/list.h

View file

@ -0,0 +1,107 @@
# - Macro approximating the CMake 2.8 ADD_TEST(NAME) signature.
# ADD_TEST_28(NAME <name> COMMAND <command> [arg1 [arg2 ...]])
# <name> - The name of the test
# <command> - The test executable
# [argN...] - Arguments to the test executable
# This macro approximates the ADD_TEST(NAME) signature provided in
# CMake 2.8 but works with CMake 2.6 too. See CMake 2.8 documentation
# of ADD_TEST()for details.
#
# This macro automatically replaces a <command> that names an
# executable target with the target location. A generator expression
# of the form "$<TARGET_FILE:tgt>" is supported in both the command
# and arguments of the test. Howerver, this macro only works for
# targets without per-config output name properties set.
#
# Example usage:
# add_test(NAME mytest COMMAND testDriver --exe $<TARGET_FILE:myexe>)
# This creates a test "mytest" whose command runs a testDriver tool
# passing the full path to the executable file produced by target
# "myexe".
#=============================================================================
# Copyright 2009 Kitware, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer
# in this position and unchanged.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
# CMake 2.8 supports ADD_TEST(NAME) natively.
IF(NOT "${CMAKE_VERSION}" VERSION_LESS "2.8")
MACRO(ADD_TEST_28)
ADD_TEST(${ARGV})
ENDMACRO()
RETURN()
ENDIF()
# Simulate ADD_TEST(NAME) signature from CMake 2.8.
MACRO(ADD_TEST_28 NAME name COMMAND command)
# Enforce the signature.
IF(NOT "x${NAME}" STREQUAL "xNAME")
MESSAGE(FATAL_ERROR "First ADD_TEST_28 argument must be \"NAME\"")
ENDIF()
IF(NOT "x${COMMAND}" STREQUAL "xCOMMAND")
MESSAGE(FATAL_ERROR "Third ADD_TEST_28 argument must be \"COMMAND\"")
ENDIF()
# Perform "COMMAND myexe ..." substitution.
SET(cmd "${command}")
IF(TARGET "${cmd}")
_ADD_TEST_28_GET_EXE(${cmd} cmd)
ENDIF()
# Perform "COMMAND ... $<TARGET_FILE:myexe> ..." substitution.
SET(target_file "\\$<TARGET_FILE:(.+)>")
SET(args)
FOREACH(ARG ${cmd} ${ARGN})
SET(arg "${ARG}")
IF("${arg}" MATCHES "${target_file}")
STRING(REGEX REPLACE "${target_file}" "\\1" tgt "${arg}")
IF(TARGET "${tgt}")
_ADD_TEST_28_GET_EXE(${tgt} exe)
STRING(REGEX REPLACE "${target_file}" "${exe}" arg "${arg}")
ENDIF()
ENDIF()
LIST(APPEND args "${arg}")
ENDFOREACH()
# Invoke old ADD_TEST() signature with transformed arguments.
ADD_TEST(${name} ${args})
ENDMACRO()
# Get the test-time location of an executable target.
MACRO(_ADD_TEST_28_GET_EXE tgt exe_var)
# The LOCATION property gives a build-time location.
GET_TARGET_PROPERTY(${exe_var} ${tgt} LOCATION)
# In single-configuration generatrs the build-time and test-time
# locations are the same because there is no per-config variable
# reference. In multi-configuration generators the following
# substitution converts the build-time configuration variable
# reference to a test-time configuration variable reference.
IF(CMAKE_CONFIGURATION_TYPES)
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CTEST_CONFIGURATION_TYPE}"
${exe_var} "${${exe_var}}")
ENDIF(CMAKE_CONFIGURATION_TYPES)
ENDMACRO()

View file

@ -0,0 +1,14 @@
#include <sys/types.h>
#define KB ((off_t)1024)
#define MB ((off_t)1024 * KB)
#define GB ((off_t)1024 * MB)
#define TB ((off_t)1024 * GB)
int t2[(((64 * GB -1) % 671088649) == 268434537)
&& (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
int main()
{
;
return 0;
}

View file

@ -0,0 +1,44 @@
# - Check if _FILE_OFFSET_BITS macro needed for large files
# CHECK_FILE_OFFSET_BITS ()
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2009, Michihiro NAKAJIMA
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#INCLUDE(CheckCXXSourceCompiles)
GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits
"${CMAKE_CURRENT_LIST_FILE}" PATH)
MACRO (CHECK_FILE_OFFSET_BITS)
IF(NOT DEFINED _FILE_OFFSET_BITS)
MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files")
TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
${CMAKE_CURRENT_BINARY_DIR}
${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
${CMAKE_CURRENT_BINARY_DIR}
${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files - needed")
ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files - not needed")
ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
ENDMACRO (CHECK_FILE_OFFSET_BITS)

View file

@ -0,0 +1,49 @@
# Check if the system has the specified function; treat glibc "stub"
# functions as nonexistent:
# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR)
#
# FUNCTION - the function(s) where the prototype should be declared
# FUNCVAR - variable to define if the function does exist
#
# In particular, this understands the glibc convention of
# defining macros __stub_XXXX or __stub___XXXX if the function
# does appear in the library but is merely a stub that does nothing.
# By detecting this case, we can select alternate behavior on
# platforms that don't support this functionality.
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2009, Michihiro NAKAJIMA
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckFunctionExists)
GET_FILENAME_COMPONENT(_selfdir_CheckFunctionExistsGlibc
"${CMAKE_CURRENT_LIST_FILE}" PATH)
MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR)
IF(NOT DEFINED ${_FUNCVAR})
SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}")
SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}")
CONFIGURE_FILE( ${_selfdir_CheckFunctionExistsGlibc}/CheckFuncs_stub.c.in
${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE)
TRY_COMPILE(__stub
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}")
IF (__stub)
SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}")
ELSE (__stub)
CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}")
ENDIF (__stub)
ENDIF(NOT DEFINED ${_FUNCVAR})
ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC)

View file

@ -0,0 +1,16 @@
#ifdef __STDC__
#include <limits.h>
#else
#include <assert.h>
#endif
int
main()
{
#if defined ${CHECK_STUB_FUNC_1} || defined ${CHECK_STUB_FUNC_2}
return 0;
#else
this system have stub
return 0;
#endif
}

View file

@ -0,0 +1,32 @@
# - Check if the system has the specified type
# CHECK_HEADER_DIRENT (HEADER1 HEARDER2 ...)
#
# HEADER - the header(s) where the prototype should be declared
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2009, Michihiro NAKAJIMA
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckTypeExists)
MACRO (CHECK_HEADER_DIRENT)
CHECK_TYPE_EXISTS("DIR *" dirent.h HAVE_DIRENT_H)
IF(NOT HAVE_DIRENT_H)
CHECK_TYPE_EXISTS("DIR *" sys/ndir.h HAVE_SYS_NDIR_H)
IF(NOT HAVE_SYS_NDIR_H)
CHECK_TYPE_EXISTS("DIR *" ndir.h HAVE_NDIR_H)
IF(NOT HAVE_NDIR_H)
CHECK_TYPE_EXISTS("DIR *" sys/dir.h HAVE_SYS_DIR_H)
ENDIF(NOT HAVE_NDIR_H)
ENDIF(NOT HAVE_SYS_NDIR_H)
ENDIF(NOT HAVE_DIRENT_H)
ENDMACRO (CHECK_HEADER_DIRENT)

View file

@ -0,0 +1,43 @@
# - Check if the given struct or class has the specified member variable
# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE)
#
# STRUCT - the name of the struct or class you are interested in
# MEMBER - the member which existence you want to check
# HEADER - the header(s) where the prototype should be declared
# VARIABLE - variable to store the result
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCSourceCompiles)
MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
SET(_INCLUDE_FILES)
FOREACH (it ${_HEADER})
SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
ENDFOREACH (it)
SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
static ${_STRUCT} tmp;
if (sizeof(tmp.${_MEMBER}))
return 0;
return 0;
}
")
CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
ENDMACRO (CHECK_STRUCT_MEMBER)

View file

@ -0,0 +1,42 @@
# - Check if the system has the specified type
# CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE)
#
# TYPE - the name of the type or struct or class you are interested in
# HEADER - the header(s) where the prototype should be declared
# VARIABLE - variable to store the result
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2009, Michihiro NAKAJIMA
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCSourceCompiles)
MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT)
SET(_INCLUDE_FILES)
FOREACH (it ${_HEADER})
SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
ENDFOREACH (it)
SET(_CHECK_TYPE_EXISTS_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
static ${_TYPE} tmp;
if (sizeof(tmp))
return 0;
return 0;
}
")
CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT})
ENDMACRO (CHECK_TYPE_EXISTS)

View file

@ -0,0 +1,52 @@
# - Find lzma and lzmadec
# Find the native LZMA includes and library
#
# LZMA_INCLUDE_DIR - where to find lzma.h, etc.
# LZMA_LIBRARIES - List of libraries when using liblzma.
# LZMA_FOUND - True if liblzma found.
# LZMADEC_INCLUDE_DIR - where to find lzmadec.h, etc.
# LZMADEC_LIBRARIES - List of libraries when using liblzmadec.
# LZMADEC_FOUND - True if liblzmadec found.
IF (LZMA_INCLUDE_DIR)
# Already in cache, be silent
SET(LZMA_FIND_QUIETLY TRUE)
ENDIF (LZMA_INCLUDE_DIR)
FIND_PATH(LZMA_INCLUDE_DIR lzma.h)
FIND_LIBRARY(LZMA_LIBRARY NAMES lzma )
# handle the QUIETLY and REQUIRED arguments and set LZMA_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMA DEFAULT_MSG LZMA_LIBRARY LZMA_INCLUDE_DIR)
IF(LZMA_FOUND)
SET( LZMA_LIBRARIES ${LZMA_LIBRARY} )
ELSE(LZMA_FOUND)
SET( LZMA_LIBRARIES )
IF (LZMADEC_INCLUDE_DIR)
# Already in cache, be silent
SET(LZMADEC_FIND_QUIETLY TRUE)
ENDIF (LZMADEC_INCLUDE_DIR)
FIND_PATH(LZMADEC_INCLUDE_DIR lzmadec.h)
FIND_LIBRARY(LZMADEC_LIBRARY NAMES lzmadec )
# handle the QUIETLY and REQUIRED arguments and set LZMADEC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMADEC DEFAULT_MSG LZMADEC_LIBRARY
LZMADEC_INCLUDE_DIR)
IF(LZMADEC_FOUND)
SET( LZMADEC_LIBRARIES ${LZMADEC_LIBRARY} )
ELSE(LZMADEC_FOUND)
SET( LZMADEC_LIBRARIES )
ENDIF(LZMADEC_FOUND)
ENDIF(LZMA_FOUND)
MARK_AS_ADVANCED( LZMA_LIBRARY LZMA_INCLUDE_DIR
LZMADEC_LIBRARY LZMADEC_INCLUDE_DIR )

View file

@ -0,0 +1,723 @@
/* config.h. Generated from config.h.cmake by cmake configure */
/* Version number of bsdcpio */
#cmakedefine BSDCPIO_VERSION_STRING "${BSDCPIO_VERSION_STRING}"
/* Version number of bsdtar */
#cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}"
/* Define to 1 if you have the `acl_create_entry' function. */
#cmakedefine HAVE_ACL_CREATE_ENTRY 1
/* Define to 1 if you have the `acl_get_link' function. */
#cmakedefine HAVE_ACL_GET_LINK 1
/* Define to 1 if you have the `acl_get_link_np' function. */
#cmakedefine HAVE_ACL_GET_LINK_NP 1
/* Define to 1 if you have the `acl_get_perm' function. */
#cmakedefine HAVE_ACL_GET_PERM 1
/* Define to 1 if you have the `acl_get_perm_np' function. */
#cmakedefine HAVE_ACL_GET_PERM_NP 1
/* Define to 1 if you have the `acl_init' function. */
#cmakedefine HAVE_ACL_INIT 1
/* Define to 1 if you have the <acl/libacl.h> header file. */
#cmakedefine HAVE_ACL_LIBACL_H 1
/* Define to 1 if the system has the type `acl_permset_t'. */
#cmakedefine HAVE_ACL_PERMSET_T 1
/* Define to 1 if you have the `acl_set_fd' function. */
#cmakedefine HAVE_ACL_SET_FD 1
/* Define to 1 if you have the `acl_set_fd_np' function. */
#cmakedefine HAVE_ACL_SET_FD_NP 1
/* Define to 1 if you have the `acl_set_file' function. */
#cmakedefine HAVE_ACL_SET_FILE 1
/* True for systems with POSIX ACL support */
#cmakedefine HAVE_ACL_USER 1
/* Define to 1 if you have the <attr/xattr.h> header file. */
#cmakedefine HAVE_ATTR_XATTR_H 1
/* Define to 1 if you have the <bsdxml.h> header file. */
#cmakedefine HAVE_BSDXML_H 1
/* Define to 1 if you have the <bzlib.h> header file. */
#cmakedefine HAVE_BZLIB_H 1
/* Define to 1 if you have the `chflags' function. */
#cmakedefine HAVE_CHFLAGS 1
/* Define to 1 if you have the `chown' function. */
#cmakedefine HAVE_CHOWN 1
/* Define to 1 if you have the `chroot' function. */
#cmakedefine HAVE_CHROOT 1
/* Define to 1 if you have the `CreateHardLinkA' function. */
#cmakedefine HAVE_CREATEHARDLINKA 1
/* Define to 1 if you have the `CreateHardLinkW' function. */
#cmakedefine HAVE_CREATEHARDLINKW 1
/* Define to 1 if you have the <ctype.h> header file. */
#cmakedefine HAVE_CTYPE_H 1
/* Define to 1 if you have the `cygwin_conv_path' function. */
#cmakedefine HAVE_CYGWIN_CONV_PATH 1
/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_INT64_MAX 1
/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_INT64_MIN 1
/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
*/
#cmakedefine HAVE_DECL_OPTARG 1
/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
*/
#cmakedefine HAVE_DECL_OPTIND 1
/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_SIZE_MAX 1
/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_SSIZE_MAX 1
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_STRERROR_R 1
/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_UINT32_MAX 1
/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_UINT64_MAX 1
/* Define to 1 if you have the <direct.h> header file. */
#cmakedefine HAVE_DIRECT_H 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#cmakedefine HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#cmakedefine HAVE_DOPRNT 1
/* Define to 1 if nl_langinfo supports D_MD_ORDER */
#cmakedefine HAVE_D_MD_ORDER 1
/* A possible errno value for invalid file format errors */
#cmakedefine HAVE_EFTYPE 1
/* A possible errno value for invalid file format errors */
#cmakedefine HAVE_EILSEQ 1
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H 1
/* Define to 1 if you have the <expat.h> header file. */
#cmakedefine HAVE_EXPAT_H 1
/* Define to 1 if you have the <ext2fs/ext2_fs.h> header file. */
#cmakedefine HAVE_EXT2FS_EXT2_FS_H 1
/* Define to 1 if you have the `extattr_get_file' function. */
#cmakedefine HAVE_EXTATTR_GET_FILE 1
/* Define to 1 if you have the `extattr_list_file' function. */
#cmakedefine HAVE_EXTATTR_LIST_FILE 1
/* Define to 1 if you have the `extattr_set_fd' function. */
#cmakedefine HAVE_EXTATTR_SET_FD 1
/* Define to 1 if you have the `extattr_set_file' function. */
#cmakedefine HAVE_EXTATTR_SET_FILE 1
/* Define to 1 if you have the `fchdir' function. */
#cmakedefine HAVE_FCHDIR 1
/* Define to 1 if you have the `fchflags' function. */
#cmakedefine HAVE_FCHFLAGS 1
/* Define to 1 if you have the `fchmod' function. */
#cmakedefine HAVE_FCHMOD 1
/* Define to 1 if you have the `fchown' function. */
#cmakedefine HAVE_FCHOWN 1
/* Define to 1 if you have the `fcntl' function. */
#cmakedefine HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H 1
/* Define to 1 if you have the `fork' function. */
#cmakedefine HAVE_FORK 1
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#cmakedefine HAVE_FSEEKO 1
/* Define to 1 if you have the `fsetxattr' function. */
#cmakedefine HAVE_FSETXATTR 1
/* Define to 1 if you have the `fstat' function. */
#cmakedefine HAVE_FSTAT 1
/* Define to 1 if you have the `ftruncate' function. */
#cmakedefine HAVE_FTRUNCATE 1
/* Define to 1 if you have the `futimens' function. */
#cmakedefine HAVE_FUTIMENS 1
/* Define to 1 if you have the `futimes' function. */
#cmakedefine HAVE_FUTIMES 1
/* Define to 1 if you have the `geteuid' function. */
#cmakedefine HAVE_GETEUID 1
/* Define to 1 if you have the `getpid' function. */
#cmakedefine HAVE_GETPID 1
/* Define to 1 if you have the `getxattr' function. */
#cmakedefine HAVE_GETXATTR 1
/* Define to 1 if you have the <grp.h> header file. */
#cmakedefine HAVE_GRP_H 1
/* Define to 1 if the system has the type `intmax_t'. */
#cmakedefine HAVE_INTMAX_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the <io.h> header file. */
#cmakedefine HAVE_IO_H 1
/* Define to 1 if you have the <langinfo.h> header file. */
#cmakedefine HAVE_LANGINFO_H 1
/* Define to 1 if you have the `lchflags' function. */
#cmakedefine HAVE_LCHFLAGS 1
/* Define to 1 if you have the `lchmod' function. */
#cmakedefine HAVE_LCHMOD 1
/* Define to 1 if you have the `lchown' function. */
#cmakedefine HAVE_LCHOWN 1
/* Define to 1 if you have the `lgetxattr' function. */
#cmakedefine HAVE_LGETXATTR 1
/* Define to 1 if you have the `acl' library (-lacl). */
#cmakedefine HAVE_LIBACL 1
/* Define to 1 if you have the `attr' library (-lattr). */
#cmakedefine HAVE_LIBATTR 1
/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */
#cmakedefine HAVE_LIBBSDXML 1
/* Define to 1 if you have the `bz2' library (-lbz2). */
#cmakedefine HAVE_LIBBZ2 1
/* Define to 1 if you have the `expat' library (-lexpat). */
#cmakedefine HAVE_LIBEXPAT 1
/* Define to 1 if you have the `lzma' library (-llzma). */
#cmakedefine HAVE_LIBLZMA 1
/* Define to 1 if you have the `lzmadec' library (-llzmadec). */
#cmakedefine HAVE_LIBLZMADEC 1
/* Define to 1 if you have the `xml2' library (-lxml2). */
#cmakedefine HAVE_LIBXML2 1
/* Define to 1 if you have the <libxml/xmlreader.h> header file. */
#cmakedefine HAVE_LIBXML_XMLREADER_H 1
/* Define to 1 if you have the `z' library (-lz). */
#cmakedefine HAVE_LIBZ 1
/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H 1
/* Define to 1 if you have the link() function. */
#cmakedefine HAVE_LINK 1
/* Define to 1 if you have the <linux/fs.h> header file. */
#cmakedefine HAVE_LINUX_FS_H 1
/* Define to 1 if you have the `listxattr' function. */
#cmakedefine HAVE_LISTXATTR 1
/* Define to 1 if you have the `llistxattr' function. */
#cmakedefine HAVE_LLISTXATTR 1
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H 1
/* Define to 1 if the system has the type `long long int'. */
#cmakedefine HAVE_LONG_LONG_INT 1
/* Define to 1 if you have the `lsetxattr' function. */
#cmakedefine HAVE_LSETXATTR 1
/* Define to 1 if you have the `lstat' function. */
#cmakedefine HAVE_LSTAT 1
/* Define to 1 if `lstat' has the bug that it succeeds when given the
zero-length file name argument. */
#cmakedefine HAVE_LSTAT_EMPTY_STRING_BUG 1
/* Define to 1 if you have the `lutimes' function. */
#cmakedefine HAVE_LUTIMES 1
/* Define to 1 if you have the <lzmadec.h> header file. */
#cmakedefine HAVE_LZMADEC_H 1
/* Define to 1 if you have the <lzma.h> header file. */
#cmakedefine HAVE_LZMA_H 1
/* Define to 1 if you have the `MD5Init' function. */
#cmakedefine HAVE_MD5INIT 1
/* Define to 1 if you have the <md5.h> header file. */
#cmakedefine HAVE_MD5_H 1
/* Define to 1 if you have the `memmove' function. */
#cmakedefine HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkdir' function. */
#cmakedefine HAVE_MKDIR 1
/* Define to 1 if you have the `mkfifo' function. */
#cmakedefine HAVE_MKFIFO 1
/* Define to 1 if you have the `mknod' function. */
#cmakedefine HAVE_MKNOD 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#cmakedefine HAVE_NDIR_H 1
/* Define to 1 if you have the `nl_langinfo' function. */
#cmakedefine HAVE_NL_LANGINFO 1
/* Define to 1 if you have the <openssl/md5.h> header file. */
#cmakedefine HAVE_OPENSSL_MD5_H 1
/* Define to 1 if you have the <openssl/ripemd.h> header file. */
#cmakedefine HAVE_OPENSSL_RIPEMD_H 1
/* Define to 1 if you have the <openssl/sha.h> header file. */
#cmakedefine HAVE_OPENSSL_SHA_H 1
/* Define to 1 if your openssl has the `SHA256_Init' function. */
#cmakedefine HAVE_OPENSSL_SHA256_INIT 1
/* Define to 1 if your openssl has the `SHA384_Init' function. */
#cmakedefine HAVE_OPENSSL_SHA384_INIT 1
/* Define to 1 if your openssl has the `SHA512_Init' function. */
#cmakedefine HAVE_OPENSSL_SHA512_INIT 1
/* Define to 1 if you have the <paths.h> header file. */
#cmakedefine HAVE_PATHS_H 1
/* Define to 1 if you have the `pipe' function. */
#cmakedefine HAVE_PIPE 1
/* Define to 1 if you have the `poll' function. */
#cmakedefine HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#cmakedefine HAVE_POLL_H 1
/* Define to 1 if you have the <process.h> header file. */
#cmakedefine HAVE_PROCESS_H 1
/* Define to 1 if you have the <pwd.h> header file. */
#cmakedefine HAVE_PWD_H 1
/* Define to 1 if you have the `readlink' function. */
#cmakedefine HAVE_READLINK 1
/* Define to 1 if you have the <regex.h> header file. */
#cmakedefine HAVE_REGEX_H 1
/* Define to 1 if you have the <ripemd.h> header file. */
#cmakedefine HAVE_RIPEMD_H 1
/* Define to 1 if you have the `RIPEMD160Init' function. */
#cmakedefine HAVE_RMD160INIT 1
/* Define to 1 if you have the <rmd160.h> header file. */
#cmakedefine HAVE_RMD160_H 1
/* Define to 1 if you have the `select' function. */
#cmakedefine HAVE_SELECT 1
/* Define to 1 if you have the `setenv' function. */
#cmakedefine HAVE_SETENV 1
/* Define to 1 if you have the `setlocale' function. */
#cmakedefine HAVE_SETLOCALE 1
/* Define to 1 if you have the `SHA1Init' function. */
#cmakedefine HAVE_SHA1INIT 1
/* Define to 1 if you have the `SHA1_Init' function. */
#cmakedefine HAVE_SHA1_INIT 1
/* Define to 1 if you have the <sha1.h> header file. */
#cmakedefine HAVE_SHA1_H 1
/* Define to 1 if you have the `SHA256Init' function. */
#cmakedefine HAVE_SHA256INIT 1
/* Define to 1 if you have the `SHA256_Init' function. */
#cmakedefine HAVE_SHA256_INIT 1
/* Define to 1 if you have the <sha256.h> header file. */
#cmakedefine HAVE_SHA256_H 1
/* Define to 1 if you have the <sha2.h> header file. */
#cmakedefine HAVE_SHA2_H 1
/* Define to 1 if you have the `SHA384Init' function. */
#cmakedefine HAVE_SHA384INIT 1
/* Define to 1 if you have the `SHA384_Init' function. */
#cmakedefine HAVE_SHA384_INIT 1
/* Define to 1 if you have the `SHA512Init' function. */
#cmakedefine HAVE_SHA512INIT 1
/* Define to 1 if you have the `SHA512_Init' function. */
#cmakedefine HAVE_SHA512_INIT 1
/* Define to 1 if you have the <sha.h> header file. */
#cmakedefine HAVE_SHA_H 1
/* Define to 1 if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H 1
/* Define to 1 if `stat' has the bug that it succeeds when given the
zero-length file name argument. */
#cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1
/* Define to 1 if you have the <stdarg.h> header file. */
#cmakedefine HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
#cmakedefine HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#cmakedefine HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#cmakedefine HAVE_STRERROR 1
/* Define to 1 if you have the `strerror_r' function. */
#cmakedefine HAVE_STRERROR_R 1
/* Define to 1 if you have the `strftime' function. */
#cmakedefine HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define to 1 if you have the `strrchr' function. */
#cmakedefine HAVE_STRRCHR 1
/* Define to 1 if `st_birthtime' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1
/* Define to 1 if `st_birthtimespec.tv_nsec' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
/* Define to 1 if `st_blksize' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1
/* Define to 1 if `st_flags' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_FLAGS 1
/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
/* Define to 1 if `st_mtime_n' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_N 1
/* Define to 1 if `st_mtime_usec' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_USEC 1
/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
/* Define to 1 if `st_umtime' is member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_UMTIME 1
/* Define to 1 if you have the symlink() function. */
#cmakedefine HAVE_SYMLINK 1
/* Define to 1 if you have the <sys/acl.h> header file. */
#cmakedefine HAVE_SYS_ACL_H 1
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#cmakedefine HAVE_SYS_CDEFS_H 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#cmakedefine HAVE_SYS_DIR_H 1
/* Define to 1 if you have the <sys/extattr.h> header file. */
#cmakedefine HAVE_SYS_EXTATTR_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#cmakedefine HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mkdev.h> header file. */
#cmakedefine HAVE_SYS_MKDEV_H 1
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#cmakedefine HAVE_SYS_NDIR_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#cmakedefine HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#cmakedefine HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#cmakedefine HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/utime.h> header file. */
#cmakedefine HAVE_SYS_UTIME_H 1
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#cmakedefine HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <sys/xattr.h> header file. */
#cmakedefine HAVE_SYS_XATTR_H 1
/* Define to 1 if you have the `timegm' function. */
#cmakedefine HAVE_TIMEGM 1
/* Define to 1 if you have the <time.h> header file. */
#cmakedefine HAVE_TIME_H 1
/* Define to 1 if you have the `tzset' function. */
#cmakedefine HAVE_TZSET 1
/* Define to 1 if the system has the type `uintmax_t'. */
#cmakedefine HAVE_UINTMAX_T 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
/* Define to 1 if you have the `unsetenv' function. */
#cmakedefine HAVE_UNSETENV 1
/* Define to 1 if the system has the type `unsigned long long'. */
#cmakedefine HAVE_UNSIGNED_LONG_LONG 1
/* Define to 1 if the system has the type `unsigned long long int'. */
#cmakedefine HAVE_UNSIGNED_LONG_LONG_INT 1
/* Define to 1 if you have the `utime' function. */
#cmakedefine HAVE_UTIME 1
/* Define to 1 if you have the `utimensat' function. */
#cmakedefine HAVE_UTIMENSAT 1
/* Define to 1 if you have the `utimes' function. */
#cmakedefine HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#cmakedefine HAVE_UTIME_H 1
/* Define to 1 if you have the `vfork' function. */
#cmakedefine HAVE_VFORK 1
/* Define to 1 if you have the `vprintf' function. */
#cmakedefine HAVE_VPRINTF 1
/* Define to 1 if you have the <wchar.h> header file. */
#cmakedefine HAVE_WCHAR_H 1
/* Define to 1 if the system has the type `wchar_t'. */
#cmakedefine HAVE_WCHAR_T 1
/* Define to 1 if you have the `wcrtomb' function. */
#cmakedefine HAVE_WCRTOMB 1
/* Define to 1 if you have the `wcscpy' function. */
#cmakedefine HAVE_WCSCPY 1
/* Define to 1 if you have the `wcslen' function. */
#cmakedefine HAVE_WCSLEN 1
/* Define to 1 if you have the `wctomb' function. */
#cmakedefine HAVE_WCTOMB 1
/* Define to 1 if you have the <wctype.h> header file. */
#cmakedefine HAVE_WCTYPE_H 1
/* Define to 1 if you have the <windows.h> header file. */
#cmakedefine HAVE_WINDOWS_H 1
/* Define to 1 if you have _CrtSetReportMode in <crtdbg.h> */
#cmakedefine HAVE__CrtSetReportMode 1
/* Define to 1 if you have the `wmemcmp' function. */
#cmakedefine HAVE_WMEMCMP 1
/* Define to 1 if you have the `wmemcpy' function. */
#cmakedefine HAVE_WMEMCPY 1
/* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine HAVE_ZLIB_H 1
/* Version number of libarchive as a single integer */
#cmakedefine LIBARCHIVE_VERSION_NUMBER "${LIBARCHIVE_VERSION_NUMBER}"
/* Version number of libarchive */
#cmakedefine LIBARCHIVE_VERSION_STRING "${LIBARCHIVE_VERSION_STRING}"
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#cmakedefine LSTAT_FOLLOWS_SLASHED_SYMLINK 1
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
#cmakedefine MAJOR_IN_MKDEV 1
/* Define to 1 if `major', `minor', and `makedev' are declared in
<sysmacros.h>. */
#cmakedefine MAJOR_IN_SYSMACROS 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#cmakedefine NO_MINUS_C_MINUS_O 1
/* The size of `wchar_t', as computed by sizeof. */
#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T}
/* Define to 1 if strerror_r returns char *. */
#cmakedefine STRERROR_R_CHAR_P 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#cmakedefine TIME_WITH_SYS_TIME 1
/* Version number of package */
#cmakedefine VERSION "${VERSION}"
/* Number of bits in a file offset, on hosts where this is settable. */
#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS}
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#cmakedefine _LARGEFILE_SOURCE 1
/* Define for large files, on AIX-style hosts. */
#cmakedefine _LARGE_FILES ${_LARGE_FILES}
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#cmakedefine _UINT64_T
/* Define to empty if `const' does not conform to ANSI C. */
#cmakedefine const ${const}
/* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine gid_t ${gid_t}
/* Define to `unsigned long' if <sys/types.h> does not define. */
#cmakedefine id_t ${id_t}
/* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine int32_t ${int32_t}
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#cmakedefine int64_t ${int64_t}
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#cmakedefine intmax_t ${intmax_t}
/* Define to `int' if <sys/types.h> does not define. */
#cmakedefine mode_t ${mode_t}
/* Define to `long long' if <sys/types.h> does not define. */
#cmakedefine off_t ${off_t}
/* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine pid_t ${pid_t}
/* Define to `unsigned int' if <sys/types.h> does not define. */
#cmakedefine size_t ${size_t}
/* Define to `int' if <sys/types.h> does not define. */
#cmakedefine ssize_t ${ssize_t}
/* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine uid_t ${uid_t}
/* Define to `unsigned short' if <sys/types.h> doesn't define. */
#cmakedefine uint16_t ${uint16_t}
/* Define to `unsigned int' if <sys/types.h> doesn't define. */
#cmakedefine uint32_t ${uint32_t}
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#cmakedefine uint64_t ${uint64_t}
/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
do not define. */
#cmakedefine uintmax_t ${uintmax_t}
/* Define to `int' if <sys/types.h> does not define. */
#cmakedefine intptr_t ${intptr_t}
/* Define to `unsigned int' if <sys/types.h> does not define. */
#cmakedefine uintptr_t ${uintptr_t}

View file

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libarchive
Description: library that can create and read several streaming archive formats
Version: @VERSION@
Libs: -larchive
Libs.private: @LIBS@

View file

@ -0,0 +1 @@
2008000

View file

@ -0,0 +1,141 @@
#/* FILE: mvcpp.nt
# *
# * Copyright (c) 2008
# * TouchNet Information Systems, Inc.
# * All Rights Reserved
# *
# * This program is an unpublished copyright work of TouchNet Information
# * Systems, Inc. of Lenexa, KS. The program, all information disclosed
# * and the matter shown and described hereon or herewith are confidential
# * and proprietary to TouchNet Information Systems, Inc.
# *
# ******************************************************************************
# *
# * $LastChangedBy: kientzle $
# * $Locker: $
# * $ProjectName: $
# * $ProjectRevision: $
# * $LastChangedRevision: 1827 $
# * $LastChangedDate: 2010-01-16 16:21:36 -0800 (Sat, 16 Jan 2010) $
# * $State: Exp $
# * $RCSfile: mvcpp.nt,v $
# * $Source: /cvsroot/pkgsrc/archivers/libarchive/files/build/windows/Attic/mvcpp.nt,v $
# *
# * Change Log:
# * $Log: mvcpp.nt,v $
# * Revision 1.1.1.1 2010/02/20 03:48:54 joerg
# * Import libarchive 2.8.0:
# * - Infrastructure:
# * - Allow command line tools as fallback for missing compression
# * libraries. If compiled without gzip for example, gunzip will
# * be used automatically.
# * - Improved support for a number of platforms like high-resolution
# * timestamps and Extended Attributes on various Unix systems
# * - New convience interface for creating archives based on disk content,
# * complement of the archive_write_disk interface.
# * - Frontends:
# * - bsdcpio ready for public consumption
# * - hand-written date parser replaces the yacc code
# * - Filter system:
# * - Simplified read filter chains
# * - Option support for filters
# * - LZMA, XZ, uudecode handled
# * - Format support:
# * - Write support for mtree files based on file system or archive
# * content
# * - Basic read support for Joliet
# * - Write support for zip files
# * - Write support for shar archives, both text-only and binary-safe
# *
# *
# */
.SUFFIXES : .c .cpp .obm
ZLIB_INCL=\3rdParty\ZLib\Current\Include
EXTRA_DEFINES=/DLIBARCHIVE_STATIC=1
!ifdef DEBUG
DEST_PATH=.\lib\mvcpp\debug
OBJ_DIR=obj\debug
COMPILE_FLAG=/MTd /DDEBUG=1 $(EXTRA_DEFINES) /Zi /Fd$(OBJ_DIR)\libarchive.pdb
!else
DEST_PATH=.\lib\mvcpp
OBJ_DIR=obj
COMPILE_FLAG=/MT $(EXTRA_DEFINES) /Fd$(OBJ_DIR)\libarchive.pdb
!endif
INCLUDE=.;$(MSDEVDIR)\INCLUDE;$(ZLIB_INCL);
INCLUDE_OPTS=
NT_CPP=cl
NT_C=cl
NT_LIBRARIAN=lib
###
NT_C_OPTS=$(COMPILE_FLAG) /GX /Zl /Zp1 /nologo /c /G5 /Oi /Ot /TC /DVC_EXTRANLEAN /DWIN32_LEAN_AND_MEAN $(INCLUDE_OPTS)
NT_CPP_OPTS=$(COMPILE_FLAG) /GX /Zl /Zp1 /nologo /c /G5 /Oi /Ot /TP /DVC_EXTRANLEAN /DWIN32_LEAN_AND_MEAN $(INCLUDE_OPTS)
NT_LIB_OPTS=
.cpp{$(OBJ_DIR)}.obm:
-md $(OBJ_DIR) > nul 2>nul
$(NT_CPP) $(NT_CPP_OPTS) -Fo$*.obm $<
.c{$(OBJ_DIR)}.obm:
-md $(OBJ_DIR) > nul 2>nul
$(NT_C) $(NT_C_OPTS) -Fo$*.obm $<
OBJS=\
$(OBJ_DIR)\archive_check_magic.obm $(OBJ_DIR)\archive_entry.obm \
$(OBJ_DIR)\archive_entry_copy_stat.obm $(OBJ_DIR)\archive_entry_link_resolver.obm \
$(OBJ_DIR)\archive_entry_stat.obm $(OBJ_DIR)\archive_entry_strmode.obm \
$(OBJ_DIR)\archive_read.obm $(OBJ_DIR)\archive_read_data_into_fd.obm \
$(OBJ_DIR)\archive_read_extract.obm $(OBJ_DIR)\archive_read_open_fd.obm \
$(OBJ_DIR)\archive_read_open_file.obm $(OBJ_DIR)\archive_read_open_filename.obm \
$(OBJ_DIR)\archive_read_open_memory.obm $(OBJ_DIR)\archive_read_support_compression_all.obm \
$(OBJ_DIR)\archive_read_support_compression_bzip2.obm \
$(OBJ_DIR)\archive_read_support_compression_compress.obm \
$(OBJ_DIR)\archive_read_support_compression_gzip.obm \
$(OBJ_DIR)\archive_read_support_compression_none.obm \
$(OBJ_DIR)\archive_read_support_compression_program.obm \
$(OBJ_DIR)\archive_read_support_format_all.obm \
$(OBJ_DIR)\archive_read_support_format_ar.obm \
$(OBJ_DIR)\archive_read_support_format_cpio.obm \
$(OBJ_DIR)\archive_read_support_format_empty.obm \
$(OBJ_DIR)\archive_read_support_format_iso9660.obm \
$(OBJ_DIR)\archive_read_support_format_mtree.obm \
$(OBJ_DIR)\archive_read_support_format_tar.obm \
$(OBJ_DIR)\archive_read_support_format_zip.obm \
$(OBJ_DIR)\archive_string.obm $(OBJ_DIR)\archive_string_sprintf.obm \
$(OBJ_DIR)\archive_util.obm $(OBJ_DIR)\archive_virtual.obm \
$(OBJ_DIR)\archive_write.obm $(OBJ_DIR)\archive_write_disk.obm \
$(OBJ_DIR)\archive_write_disk_set_standard_lookup.obm \
$(OBJ_DIR)\archive_write_open_fd.obm $(OBJ_DIR)\archive_write_open_file.obm \
$(OBJ_DIR)\archive_write_open_filename.obm $(OBJ_DIR)\archive_write_open_memory.obm \
$(OBJ_DIR)\archive_write_set_compression_bzip2.obm $(OBJ_DIR)\archive_write_set_compression_compress.obm \
$(OBJ_DIR)\archive_write_set_compression_gzip.obm $(OBJ_DIR)\archive_write_set_compression_none.obm \
$(OBJ_DIR)\archive_write_set_compression_program.obm $(OBJ_DIR)\archive_write_set_format.obm \
$(OBJ_DIR)\archive_write_set_format_ar.obm $(OBJ_DIR)\archive_write_set_format_by_name.obm \
$(OBJ_DIR)\archive_write_set_format_cpio.obm $(OBJ_DIR)\archive_write_set_format_cpio_newc.obm \
$(OBJ_DIR)\archive_write_set_format_pax.obm $(OBJ_DIR)\archive_write_set_format_shar.obm \
$(OBJ_DIR)\archive_write_set_format_ustar.obm $(OBJ_DIR)\filter_fork.obm \
$(OBJ_DIR)\libarchive-nonposix.obm
all: CLEAN $(DEST_PATH)\libarchive.lib
$(DEST_PATH)\libarchive.lib :: $(OBJS) $(DEST_PATH)
$(DEST_PATH)\libarchive.lib ::
$(NT_LIBRARIAN) $(NT_LIB_OPTS) /OUT:$(DEST_PATH)\libarchive.lib $(OBJS)
$(DEST_PATH):
-md $(DEST_PATH) > nul 2>nul
CLEAN:
!ifdef CLEAN
-del $(OBJ_DIR)\*.pd? > nul 2>nul
-ren $(OBJ_DIR)\*.pdb *.pd1 > nul 2>nul
-ren $(OBJ_DIR)\*.pdb *.pd2 > nul 2>nul
!endif

View file

@ -0,0 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libarchive", "libarchive.vcproj", "{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Debug.ActiveCfg = Debug|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Debug.Build.0 = Debug|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Release.ActiveCfg = Release|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,327 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="libarchive"
ProjectGUID="{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PLATFORM_CONFIG_H=&quot;\&quot;config_windows.h\&quot;&quot;"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="../../lib/$(ProjectName)-vc71-mt-d.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PLATFORM_CONFIG_H=&quot;\&quot;config_windows.h\&quot;&quot;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="../../lib/$(ProjectName)-vc71-mt.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\libarchive\archive_check_magic.c">
</File>
<File
RelativePath="..\..\libarchive\archive_entry.c">
</File>
<File
RelativePath="..\..\libarchive\archive_entry_copy_stat.c">
</File>
<File
RelativePath="..\..\libarchive\archive_entry_link_resolver.c">
</File>
<File
RelativePath="..\..\libarchive\archive_entry_stat.c">
</File>
<File
RelativePath="..\..\libarchive\archive_entry_strmode.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_data_into_fd.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk_set_standard_lookup.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_extract.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_fd.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_file.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_filename.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_memory.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_all.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_bzip2.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_compress.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_gzip.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_lzma.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_none.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_program.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_all.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_ar.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_cpio.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_empty.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_iso9660.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_mtree.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_tar.c">
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_zip.c">
</File>
<File
RelativePath="..\..\libarchive\archive_string.c">
</File>
<File
RelativePath="..\..\libarchive\archive_string_sprintf.c">
</File>
<File
RelativePath="..\..\libarchive\archive_util.c">
</File>
<File
RelativePath="..\..\libarchive\archive_virtual.c">
</File>
<File
RelativePath="..\..\libarchive\archive_windows.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk_set_standard_lookup.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_fd.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_file.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_filename.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_memory.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_bzip2.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_compress.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_gzip.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_none.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_program.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_ar.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_by_name.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_cpio.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_cpio_newc.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_mtree.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_pax.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_shar.c">
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_ustar.c">
</File>
<File
RelativePath="..\..\libarchive\filter_fork.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\..\libarchive\archive.h">
</File>
<File
RelativePath="..\..\libarchive\archive_endian.h">
</File>
<File
RelativePath="..\..\libarchive\archive_entry.h">
</File>
<File
RelativePath="..\..\libarchive\archive_entry_private.h">
</File>
<File
RelativePath="..\..\libarchive\archive_platform.h">
</File>
<File
RelativePath="..\..\libarchive\archive_private.h">
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk_private.h">
</File>
<File
RelativePath="..\..\libarchive\archive_read_private.h">
</File>
<File
RelativePath="..\..\libarchive\archive_string.h">
</File>
<File
RelativePath="..\..\libarchive\archive_windows.h">
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk_private.h">
</File>
<File
RelativePath="..\..\libarchive\archive_write_private.h">
</File>
<File
RelativePath="..\..\libarchive\config_windows.h">
</File>
<File
RelativePath="..\..\libarchive\filter_fork.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libarchive", "libarchive.vcproj", "{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libarchive_test", "libarchive_test\libarchive_test.vcproj", "{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Debug|Win32.ActiveCfg = Debug|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Debug|Win32.Build.0 = Debug|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Release|Win32.ActiveCfg = Release|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Release|Win32.Build.0 = Release|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Debug|Win32.ActiveCfg = Debug|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Debug|Win32.Build.0 = Debug|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Release|Win32.ActiveCfg = Release|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,455 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libarchive"
ProjectGUID="{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
RootNamespace="libarchive"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PLATFORM_CONFIG_H=&quot;\&quot;config_windows.h\&quot;&quot;;LIBARCHIVE_STATIC"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="../../lib/$(ProjectName)-vc80-mt-d.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PLATFORM_CONFIG_H=&quot;\&quot;config_windows.h\&quot;&quot;;LIBARCHIVE_STATIC"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="../../lib/$(ProjectName)-vc80-mt.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\libarchive\archive_check_magic.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_copy_stat.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_link_resolver.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_stat.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_strmode.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_data_into_fd.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk_set_standard_lookup.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_extract.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_fd.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_file.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_filename.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_memory.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_all.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_bzip2.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_compress.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_gzip.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_lzma.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_none.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_program.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_all.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_ar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_cpio.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_empty.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_iso9660.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_mtree.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_tar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_zip.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_string.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_string_sprintf.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_util.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_virtual.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_windows.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk_set_standard_lookup.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_fd.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_file.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_filename.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_memory.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_bzip2.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_compress.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_gzip.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_none.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_program.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_ar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_by_name.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_cpio.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_cpio_newc.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_mtree.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_pax.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_shar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_ustar.c"
>
</File>
<File
RelativePath="..\..\libarchive\filter_fork.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\libarchive\archive.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_endian.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_platform.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_string.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_windows.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\config_windows.h"
>
</File>
<File
RelativePath="..\..\libarchive\filter_fork.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,495 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libarchive_test"
ProjectGUID="{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}"
RootNamespace="libarchive_test"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\libarchive"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LIBARCHIVE_STATIC"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
ShowProgress="0"
OutputFile="..\..\..\$(ProjectName).exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="true"
SuppressStartupBanner="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\libarchive"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LIBARCHIVE_STATIC"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<ProjectReference
ReferencedProjectIdentifier="{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
CopyLocal="false"
CopyLocalDependencies="false"
CopyLocalSatelliteAssemblies="false"
RelativePathToProject=".\libarchive.vcproj"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\libarchive\test\main.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\read_open_memory.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_acl_basic.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_acl_freebsd.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_acl_pax.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_archive_api_feature.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_bad_fd.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_bzip2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_gtar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_gzip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_tar_hardlink.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_zip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_empty_write.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_entry.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_entry_strmode.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_fuzz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_link_resolver.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_pax_filename_encoding.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_compress_program.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_data_large.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_disk.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_extract.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_ar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin_bz2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin_gz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin_Z.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_odc.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_svr4_gzip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_svr4c_Z.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_gtar_gz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_gtar_lzma.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_gtar_sparse.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_iso_gz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_isorr_bz2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_mtree.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_pax_bz2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tar_empty_filename.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tbz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tgz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_zip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_large.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_pax_truncated.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_position.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_truncated.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_tar_filenames.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_tar_large.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_ustar_filenames.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_compress.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_compress_program.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_hardlink.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_perms.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_secure.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_times.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_ar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio_newc.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio_odc.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_pax.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_shar_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_tar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_tar_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_tar_ustar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_open_memory.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\libarchive\test\list.h"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libarchive", "libarchive.vcproj", "{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libarchive_test", "libarchive_test\libarchive_test.vcproj", "{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Debug|Win32.ActiveCfg = Debug|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Debug|Win32.Build.0 = Debug|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Release|Win32.ActiveCfg = Release|Win32
{0C758FDB-BE1D-47E9-8E18-9168AB34A308}.Release|Win32.Build.0 = Release|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Debug|Win32.ActiveCfg = Debug|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Debug|Win32.Build.0 = Debug|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Release|Win32.ActiveCfg = Release|Win32
{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,456 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libarchive"
ProjectGUID="{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
RootNamespace="libarchive"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PLATFORM_CONFIG_H=&quot;\&quot;config_windows.h\&quot;&quot;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="../../lib/$(ProjectName)-vc90-mt-d.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PLATFORM_CONFIG_H=&quot;\&quot;config_windows.h\&quot;&quot;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="../../lib/$(ProjectName)-vc90-mt.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\libarchive\archive_check_magic.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_copy_stat.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_link_resolver.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_stat.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_strmode.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_data_into_fd.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk_set_standard_lookup.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_extract.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_fd.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_file.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_filename.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_open_memory.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_all.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_bzip2.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_compress.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_gzip.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_lzma.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_none.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_compression_program.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_all.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_ar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_cpio.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_empty.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_iso9660.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_mtree.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_tar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_support_format_zip.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_string.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_string_sprintf.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_util.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_virtual.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_windows.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk_set_standard_lookup.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_fd.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_file.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_filename.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_open_memory.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_bzip2.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_compress.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_gzip.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_none.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_compression_program.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_ar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_by_name.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_cpio.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_cpio_newc.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_mtree.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_pax.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_shar.c"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_set_format_ustar.c"
>
</File>
<File
RelativePath="..\..\libarchive\filter_fork.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\libarchive\archive.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_endian.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_entry_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_platform.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_disk_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_read_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_string.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_windows.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_disk_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\archive_write_private.h"
>
</File>
<File
RelativePath="..\..\libarchive\config_windows.h"
>
</File>
<File
RelativePath="..\..\libarchive\filter_fork.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,494 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libarchive_test"
ProjectGUID="{407CA0B9-0CCB-4F02-A20B-CBBAEAAA2E4B}"
RootNamespace="libarchive_test"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\libarchive"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LIBARCHIVE_STATIC"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
ShowProgress="0"
OutputFile="..\..\..\$(ProjectName).exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="true"
SuppressStartupBanner="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\libarchive"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LIBARCHIVE_STATIC"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<ProjectReference
ReferencedProjectIdentifier="{0C758FDB-BE1D-47E9-8E18-9168AB34A308}"
CopyLocal="false"
CopyLocalDependencies="false"
CopyLocalSatelliteAssemblies="false"
RelativePathToProject=".\libarchive.vcproj"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\libarchive\test\main.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\read_open_memory.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_acl_basic.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_acl_freebsd.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_acl_pax.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_archive_api_feature.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_bad_fd.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_bzip2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_gtar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_gzip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_tar_hardlink.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_compat_zip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_empty_write.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_entry.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_entry_strmode.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_fuzz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_link_resolver.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_pax_filename_encoding.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_compress_program.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_data_large.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_disk.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_extract.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_ar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin_bz2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin_gz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_bin_Z.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_odc.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_svr4_gzip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_cpio_svr4c_Z.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_gtar_gz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_gtar_lzma.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_gtar_sparse.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_iso_gz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_isorr_bz2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_mtree.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_pax_bz2.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tar_empty_filename.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tbz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tgz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_tz.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_format_zip.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_large.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_pax_truncated.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_position.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_read_truncated.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_tar_filenames.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_tar_large.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_ustar_filenames.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_compress.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_compress_program.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_hardlink.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_perms.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_secure.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_disk_times.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_ar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio_newc.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_cpio_odc.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_pax.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_shar_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_tar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_tar_empty.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_format_tar_ustar.c"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test_write_open_memory.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\libarchive\test\list.h"
>
</File>
<File
RelativePath="..\..\..\libarchive\test\test.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,131 @@
#/* FILE: wccpp.nt
# *
# * Copyright (c) 2008
# * TouchNet Information Systems, Inc.
# * All Rights Reserved
# *
# * This program is an unpublished copyright work of TouchNet Information
# * Systems, Inc. of Lenexa, KS. The program, all information disclosed
# * and the matter shown and described hereon or herewith are confidential
# * and proprietary to TouchNet Information Systems, Inc.
# *
# ******************************************************************************
# *
# * $LastChangedBy: kientzle $
# * $Locker: $
# * $ProjectName: $
# * $ProjectRevision: $
# * $LastChangedRevision: 1827 $
# * $LastChangedDate: 2010-01-16 16:21:36 -0800 (Sat, 16 Jan 2010) $
# * $State: Exp $
# * $RCSfile: wccpp.nt,v $
# * $Source: /cvsroot/pkgsrc/archivers/libarchive/files/build/windows/Attic/wccpp.nt,v $
# *
# * Change Log:
# * $Log: wccpp.nt,v $
# * Revision 1.1.1.1 2010/02/20 03:48:54 joerg
# * Import libarchive 2.8.0:
# * - Infrastructure:
# * - Allow command line tools as fallback for missing compression
# * libraries. If compiled without gzip for example, gunzip will
# * be used automatically.
# * - Improved support for a number of platforms like high-resolution
# * timestamps and Extended Attributes on various Unix systems
# * - New convience interface for creating archives based on disk content,
# * complement of the archive_write_disk interface.
# * - Frontends:
# * - bsdcpio ready for public consumption
# * - hand-written date parser replaces the yacc code
# * - Filter system:
# * - Simplified read filter chains
# * - Option support for filters
# * - LZMA, XZ, uudecode handled
# * - Format support:
# * - Write support for mtree files based on file system or archive
# * content
# * - Basic read support for Joliet
# * - Write support for zip files
# * - Write support for shar archives, both text-only and binary-safe
# *
# *
# */
.EXTENSIONS:
.EXTENSIONS: .obn .cpp .c
ZLIB_INCL=\3rdParty\ZLib\Current\Include
!ifdef DEBUG
DEST_PATH=.\lib\wccpp\debug
OBJ_DIR=obj\debug
EXT_COMPILE_FLAG=-d2 -DLIBARCHIVE_STATIC=1
!else
DEST_PATH=.\lib\wccpp
OBJ_DIR=obj
EXT_COMPILE_FLAG=-DLIBARCHIVE_STATIC=1
!endif
# ----- NT compiler options -----------------------------------------------
NT_CPP=wpp386
NT_C=wcc386
NT_LIBRARIAN=wlib
###
INCLUDE_OPTS=/I.;$(%watcom)\h;$(%watcom)\h\nt;$(ZLIB_INCL);
NT_CPP_OPTS=-ei -wx -xs -xss -xst -od -of+ -zp1 -5 -bt=nt -bm $(EXT_COMPILE_FLAG) $(INCLUDE_OPTS) -DWIN32_LEAN_AND_MEAN
NT_C_OPTS=-ei -wx -od -of+ -zp1 -5 -bt=nt -bm $(EXT_COMPILE_FLAG) $(INCLUDE_OPTS) -DWIN32_LEAN_AND_MEAN
NT_LIB_OPTS=
.cpp{$(OBJ_DIR)}.obn:
-md $(OBJ_DIR) > nul 2>nul
$(NT_CPP) $(NT_CPP_OPTS) -zp1 -fo=$*.obn $<
.c{$(OBJ_DIR)}.obn:
-md $(OBJ_DIR) > nul 2>nul
$(NT_C) $(NT_C_OPTS) -zp1 -fo=$*.obn $<
OBJS = &
$(OBJ_DIR)\archive_check_magic.obn $(OBJ_DIR)\archive_entry.obn &
$(OBJ_DIR)\archive_entry_copy_stat.obn $(OBJ_DIR)\archive_entry_link_resolver.obn &
$(OBJ_DIR)\archive_entry_stat.obn $(OBJ_DIR)\archive_entry_strmode.obn &
$(OBJ_DIR)\archive_read.obn $(OBJ_DIR)\archive_read_data_into_fd.obn &
$(OBJ_DIR)\archive_read_extract.obn $(OBJ_DIR)\archive_read_open_fd.obn &
$(OBJ_DIR)\archive_read_open_file.obn $(OBJ_DIR)\archive_read_open_filename.obn &
$(OBJ_DIR)\archive_read_open_memory.obn $(OBJ_DIR)\archive_read_support_compression_all.obn &
$(OBJ_DIR)\archive_read_support_compression_bzip2.obn &
$(OBJ_DIR)\archive_read_support_compression_compress.obn &
$(OBJ_DIR)\archive_read_support_compression_gzip.obn &
$(OBJ_DIR)\archive_read_support_compression_none.obn &
$(OBJ_DIR)\archive_read_support_compression_program.obn &
$(OBJ_DIR)\archive_read_support_format_all.obn &
$(OBJ_DIR)\archive_read_support_format_ar.obn &
$(OBJ_DIR)\archive_read_support_format_cpio.obn &
$(OBJ_DIR)\archive_read_support_format_empty.obn &
$(OBJ_DIR)\archive_read_support_format_iso9660.obn &
$(OBJ_DIR)\archive_read_support_format_mtree.obn &
$(OBJ_DIR)\archive_read_support_format_tar.obn &
$(OBJ_DIR)\archive_read_support_format_zip.obn &
$(OBJ_DIR)\archive_string.obn $(OBJ_DIR)\archive_string_sprintf.obn &
$(OBJ_DIR)\archive_util.obn $(OBJ_DIR)\archive_virtual.obn &
$(OBJ_DIR)\archive_write.obn $(OBJ_DIR)\archive_write_disk.obn &
$(OBJ_DIR)\archive_write_disk_set_standard_lookup.obn &
$(OBJ_DIR)\archive_write_open_fd.obn $(OBJ_DIR)\archive_write_open_file.obn &
$(OBJ_DIR)\archive_write_open_filename.obn $(OBJ_DIR)\archive_write_open_memory.obn &
$(OBJ_DIR)\archive_write_set_compression_bzip2.obn $(OBJ_DIR)\archive_write_set_compression_compress.obn &
$(OBJ_DIR)\archive_write_set_compression_gzip.obn $(OBJ_DIR)\archive_write_set_compression_none.obn &
$(OBJ_DIR)\archive_write_set_compression_program.obn $(OBJ_DIR)\archive_write_set_format.obn &
$(OBJ_DIR)\archive_write_set_format_ar.obn $(OBJ_DIR)\archive_write_set_format_by_name.obn &
$(OBJ_DIR)\archive_write_set_format_cpio.obn $(OBJ_DIR)\archive_write_set_format_cpio_newc.obn &
$(OBJ_DIR)\archive_write_set_format_pax.obn $(OBJ_DIR)\archive_write_set_format_shar.obn &
$(OBJ_DIR)\archive_write_set_format_ustar.obn $(OBJ_DIR)\filter_fork.obn &
$(OBJ_DIR)\libarchive-nonposix.obn
$(DEST_PATH)\LibArchive.lib :: $(OBJS) $(DEST_PATH)
$(DEST_PATH)\LibArchive.lib ::
-md $(DEST_PATH) > nul 2>nul
$(NT_LIBRARIAN) $@ -+ $(OBJS)
$(DEST_PATH):
-md $(DEST_PATH) > nul 2>nul

View file

@ -9,6 +9,12 @@
/* Define to 1 if you have the `acl_create_entry' function. */
#undef HAVE_ACL_CREATE_ENTRY
/* Define to 1 if you have the `acl_get_link' function. */
#undef HAVE_ACL_GET_LINK
/* Define to 1 if you have the `acl_get_link_np' function. */
#undef HAVE_ACL_GET_LINK_NP
/* Define to 1 if you have the `acl_get_perm' function. */
#undef HAVE_ACL_GET_PERM
@ -18,6 +24,9 @@
/* Define to 1 if you have the `acl_init' function. */
#undef HAVE_ACL_INIT
/* Define to 1 if you have the <acl/libacl.h> header file. */
#undef HAVE_ACL_LIBACL_H
/* Define to 1 if the system has the type `acl_permset_t'. */
#undef HAVE_ACL_PERMSET_T
@ -48,6 +57,12 @@
/* Define to 1 if you have the `chroot' function. */
#undef HAVE_CHROOT
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the `cygwin_conv_path' function. */
#undef HAVE_CYGWIN_CONV_PATH
/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_INT64_MAX
@ -56,18 +71,14 @@
don't. */
#undef HAVE_DECL_INT64_MIN
/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
*/
#undef HAVE_DECL_OPTARG
/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
*/
#undef HAVE_DECL_OPTIND
/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_SIZE_MAX
/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_SSIZE_MAX
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR_R
@ -102,9 +113,24 @@
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <expat.h> header file. */
#undef HAVE_EXPAT_H
/* Define to 1 if you have the <ext2fs/ext2_fs.h> header file. */
#undef HAVE_EXT2FS_EXT2_FS_H
/* Define to 1 if you have the `extattr_get_file' function. */
#undef HAVE_EXTATTR_GET_FILE
/* Define to 1 if you have the `extattr_list_file' function. */
#undef HAVE_EXTATTR_LIST_FILE
/* Define to 1 if you have the `extattr_set_fd' function. */
#undef HAVE_EXTATTR_SET_FD
/* Define to 1 if you have the `extattr_set_file' function. */
#undef HAVE_EXTATTR_SET_FILE
/* Define to 1 if you have the `fchdir' function. */
#undef HAVE_FCHDIR
@ -123,12 +149,6 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if your system has a working POSIX `fnmatch' function. */
#undef HAVE_FNMATCH
/* Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag */
#undef HAVE_FNM_LEADING_DIR
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
@ -144,15 +164,15 @@
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* Define to 1 if you have the `futimens' function. */
#undef HAVE_FUTIMENS
/* Define to 1 if you have the `futimes' function. */
#undef HAVE_FUTIMES
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
/* Define to 1 if you have the `getpid' function. */
#undef HAVE_GETPID
@ -168,6 +188,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
@ -192,12 +215,30 @@
/* Define to 1 if you have the `bz2' library (-lbz2). */
#undef HAVE_LIBBZ2
/* Define to 1 if you have the `expat' library (-lexpat). */
#undef HAVE_LIBEXPAT
/* Define to 1 if you have the `lzma' library (-llzma). */
#undef HAVE_LIBLZMA
/* Define to 1 if you have the `lzmadec' library (-llzmadec). */
#undef HAVE_LIBLZMADEC
/* Define to 1 if you have the `xml2' library (-lxml2). */
#undef HAVE_LIBXML2
/* Define to 1 if you have the <libxml/xmlreader.h> header file. */
#undef HAVE_LIBXML_XMLREADER_H
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the `link' function. */
#undef HAVE_LINK
/* Define to 1 if you have the <linux/fs.h> header file. */
#undef HAVE_LINUX_FS_H
@ -216,6 +257,9 @@
/* Define to 1 if you have the `lsetxattr' function. */
#undef HAVE_LSETXATTR
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if `lstat' has the bug that it succeeds when given the
zero-length file name argument. */
#undef HAVE_LSTAT_EMPTY_STRING_BUG
@ -223,6 +267,18 @@
/* Define to 1 if you have the `lutimes' function. */
#undef HAVE_LUTIMES
/* Define to 1 if you have the <lzmadec.h> header file. */
#undef HAVE_LZMADEC_H
/* Define to 1 if you have the <lzma.h> header file. */
#undef HAVE_LZMA_H
/* Define to 1 if you have the `MD5Init' function. */
#undef HAVE_MD5INIT
/* Define to 1 if you have the <md5.h> header file. */
#undef HAVE_MD5_H
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
@ -247,6 +303,24 @@
/* Define to 1 if you have the `nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
/* Define to 1 if you have the <openssl/md5.h> header file. */
#undef HAVE_OPENSSL_MD5_H
/* Define to 1 if you have the <openssl/ripemd.h> header file. */
#undef HAVE_OPENSSL_RIPEMD_H
/* Define to 1 if your openssl has the `SHA256_Init' function. */
#undef HAVE_OPENSSL_SHA256_INIT
/* Define to 1 if your openssl has the `SHA384_Init' function. */
#undef HAVE_OPENSSL_SHA384_INIT
/* Define to 1 if your openssl has the `SHA512_Init' function. */
#undef HAVE_OPENSSL_SHA512_INIT
/* Define to 1 if you have the <openssl/sha.h> header file. */
#undef HAVE_OPENSSL_SHA_H
/* Define to 1 if you have the <paths.h> header file. */
#undef HAVE_PATHS_H
@ -262,9 +336,21 @@
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK
/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
/* Define to 1 if you have the <ripemd.h> header file. */
#undef HAVE_RIPEMD_H
/* Define to 1 if you have the `RMD160Init' function. */
#undef HAVE_RMD160INIT
/* Define to 1 if you have the <rmd160.h> header file. */
#undef HAVE_RMD160_H
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
@ -274,6 +360,45 @@
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the `SHA1Init' function. */
#undef HAVE_SHA1INIT
/* Define to 1 if you have the <sha1.h> header file. */
#undef HAVE_SHA1_H
/* Define to 1 if you have the `SHA256Init' function. */
#undef HAVE_SHA256INIT
/* Define to 1 if you have the <sha256.h> header file. */
#undef HAVE_SHA256_H
/* Define to 1 if you have the `SHA256_Init' function. */
#undef HAVE_SHA256_INIT
/* Define to 1 if you have the <sha2.h> header file. */
#undef HAVE_SHA2_H
/* Define to 1 if you have the `SHA384Init' function. */
#undef HAVE_SHA384INIT
/* Define to 1 if you have the `SHA384_Init' function. */
#undef HAVE_SHA384_INIT
/* Define to 1 if you have the `SHA512Init' function. */
#undef HAVE_SHA512INIT
/* Define to 1 if you have the `SHA512_Init' function. */
#undef HAVE_SHA512_INIT
/* Define to 1 if you have the <sha.h> header file. */
#undef HAVE_SHA_H
/* Define to 1 if you have the `sigaction' function. */
#undef HAVE_SIGACTION
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if `stat' has the bug that it succeeds when given the
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
@ -308,25 +433,61 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strncpy_s' function. */
#undef HAVE_STRNCPY_S
/* Define to 1 if you have the `strrchr' function. */
#undef HAVE_STRRCHR
/* Define to 1 if `st_birthtime' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
/* Define to 1 if `st_birthtimespec.tv_nsec' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
/* Define to 1 if `st_blksize' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if `st_flags' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_FLAGS
/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
/* Define to 1 if `st_mtime_n' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIME_N
/* Define to 1 if `st_mtime_usec' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIME_USEC
/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
/* Define to 1 if `st_umtime' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_UMTIME
/* Define to 1 if you have the `symlink' function. */
#undef HAVE_SYMLINK
/* Define to 1 if you have the <sys/acl.h> header file. */
#undef HAVE_SYS_ACL_H
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#undef HAVE_SYS_CDEFS_H
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/extattr.h> header file. */
#undef HAVE_SYS_EXTATTR_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/mkdev.h> header file. */
#undef HAVE_SYS_MKDEV_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
@ -355,6 +516,9 @@
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <sys/xattr.h> header file. */
#undef HAVE_SYS_XATTR_H
/* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM
@ -382,6 +546,9 @@
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
/* Define to 1 if you have the `utimensat' function. */
#undef HAVE_UTIMENSAT
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
@ -397,6 +564,12 @@
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if the system has the type `wchar_t'. */
#undef HAVE_WCHAR_T
/* Define to 1 if you have the `wcrtomb' function. */
#undef HAVE_WCRTOMB
/* Define to 1 if you have the `wcscpy' function. */
#undef HAVE_WCSCPY
@ -406,6 +579,12 @@
/* Define to 1 if you have the `wctomb' function. */
#undef HAVE_WCTOMB
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to 1 if you have the `wmemcmp' function. */
#undef HAVE_WMEMCMP
@ -425,6 +604,10 @@
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
#undef MAJOR_IN_MKDEV
@ -454,6 +637,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `wchar_t', as computed by sizeof. */
#undef SIZEOF_WCHAR_T
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
@ -466,6 +652,9 @@
/* Version number of package */
#undef VERSION
/* Define to '0x0500' for Windows 2000 APIs. */
#undef WINVER
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@ -475,15 +664,51 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT64_T
/* Define to '0x0500' for Windows 2000 APIs. */
#undef _WIN32_WINNT
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
/* Define to match typeof st_gid field of struct stat if <sys/types.h> doesn't
define. */
#undef gid_t
/* Define to `unsigned long' if <sys/types.h> does not define. */
@ -506,7 +731,8 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
/* Define to match typeof st_uid field of struct stat if <sys/types.h> doesn't
define. */
#undef uid_t
/* Define to the type of an unsigned integer type of width exactly 64 bits if

File diff suppressed because it is too large Load diff

View file

@ -4,13 +4,12 @@ dnl First, define all of the version numbers up front.
dnl In particular, this allows the version macro to be used in AC_INIT
dnl These first two version numbers are updated automatically on each release.
m4_define([LIBARCHIVE_VERSION_S],[2.5.5])
m4_define([LIBARCHIVE_VERSION_N],[2005005])
m4_define([LIBARCHIVE_VERSION_S],[2.8.0])
m4_define([LIBARCHIVE_VERSION_N],[2008000])
dnl bsdtar versioning tracks libarchive
dnl bsdtar and bsdcpio versioning tracks libarchive
m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
dnl bsdcpio is still versioning separately, as it's less mature.
m4_define([BSDCPIO_VERSION_S],[1.0.0])
m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S())
#
# Now starts the "real" configure script.
@ -20,7 +19,9 @@ AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@freebsd.org])
# Make sure the srcdir contains "libarchive" directory
AC_CONFIG_SRCDIR([libarchive])
# Use auxiliary subscripts from this subdirectory (cleans up root)
AC_CONFIG_AUX_DIR([config.aux])
AC_CONFIG_AUX_DIR([build/autoconf])
# M4 scripts
AC_CONFIG_MACRO_DIR([build/autoconf])
# Must follow AC_CONFIG macros above...
AM_INIT_AUTOMAKE()
@ -63,11 +64,33 @@ AC_SUBST(LIBARCHIVE_VERSION_NUMBER)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([build/pkgconfig/libarchive.pc])
# Check for host type
AC_CANONICAL_HOST
dnl Compilation on mingw and Cygwin needs special Makefile rules
inc_windows_files=no
inc_cygwin_files=no
case "$host_os" in
*mingw* ) inc_windows_files=yes ;;
*cygwin*) inc_cygwin_files=yes ;;
esac
AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
PLATFORMCPPFLAGS=
case "$host_os" in
*mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;;
esac
AC_SUBST(PLATFORMCPPFLAGS)
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
AC_USE_SYSTEM_EXTENSIONS
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_CHECK_TOOL([STRIP],[strip])
@ -121,11 +144,11 @@ AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
# Default is not to build bsdcpio, but that can be overridden.
#
AC_ARG_ENABLE([bsdcpio],
[AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio])
[AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)])
AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio])
AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio])
AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio (default)])],
[], [enable_bsdcpio=no])
AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])],
[], [enable_bsdcpio=yes])
case "$enable_bsdcpio" in
yes)
@ -158,20 +181,130 @@ esac
AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ])
AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
# Set up defines needed before including any headers
case $host in
*mingw* | *cygwin* )
AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
;;
esac
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([bzlib.h errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
AC_CHECK_HEADERS([inttypes.h langinfo.h limits.h linux/fs.h])
AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h stdarg.h])
AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/acl.h sys/ioctl.h])
AC_CHECK_HEADERS([acl/libacl.h attr/xattr.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])
AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h])
AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h])
AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h zlib.h])
AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h windows.h])
# Checks for libraries.
AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
AC_CHECK_LIB(z,inflate)
AC_ARG_WITH([zlib],
AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
if test "x$with_zlib" != "xno"; then
AC_CHECK_HEADERS([zlib.h])
AC_CHECK_LIB(z,inflate)
fi
AC_ARG_WITH([bz2lib],
AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib]))
if test "x$with_bz2lib" != "xno"; then
AC_CHECK_HEADERS([bzlib.h])
AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
fi
AC_ARG_WITH([lzmadec],
AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec]))
if test "x$with_lzmadec" != "xno"; then
AC_CHECK_HEADERS([lzmadec.h])
AC_CHECK_LIB(lzmadec,lzmadec_decode)
fi
AC_ARG_WITH([lzma],
AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
if test "x$with_lzma" != "xno"; then
AC_CHECK_HEADERS([lzma.h])
AC_CHECK_LIB(lzma,lzma_stream_decoder)
fi
AC_ARG_WITH([openssl],
AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl]))
AC_ARG_WITH([xml2],
AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2]))
AC_ARG_WITH([expat],
AS_HELP_STRING([--without-expat], [Don't build support for xar through expat]))
if test "x$with_xml2" != "xno"; then
AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}])
if test "x$XML2_CONFIG" != "x"; then
CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
LIBS="${LIBS} `${XML2_CONFIG} --libs`"
fi
AC_CHECK_HEADERS([libxml/xmlreader.h])
AC_CHECK_LIB(xml2,xmlInitParser)
fi
if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
if test "x$with_expat" != "xno"; then
AC_CHECK_HEADERS([expat.h])
AC_CHECK_LIB(expat,XML_ParserCreate)
fi
fi
AC_CHECK_HEADERS([md5.h ripemd.h rmd160.h sha.h sha1.h sha2.h sha256.h])
# Common names for libc implementation on NetBSD and OpenBSD
AC_CHECK_FUNCS(MD5Init RMD160Init SHA1Init)
# SHA2 on NetBSD and older OpenBSD
AC_CHECK_FUNCS(SHA256_Init SHA384_Init SHA512_Init)
# SHA2 on newer OpenBSD
AC_CHECK_FUNCS(SHA256Init SHA384Init SHA512Init)
if test "x$with_openssl" != "xno"; then
if test "$ac_cv_func_MD5Init" != "yes"; then
AC_CHECK_HEADERS([openssl/md5.h])
AC_SEARCH_LIBS([MD5_Init], [crypto])
fi
if test "$ac_cv_func_RMD160Init" != "yes"; then
AC_CHECK_HEADERS([openssl/ripemd.h])
AC_SEARCH_LIBS([RIPEMD160_Init], [crypto])
fi
if test "$ac_cv_func_SHA1Init" != "yes"; then
AC_CHECK_HEADERS([openssl/sha.h])
AC_SEARCH_LIBS([SHA1_Init], [crypto])
fi
if test "$ac_cv_func_SHA256Init" != "yes" ||
test "$ac_cv_func_SHA384Init" != "yes" ||
test "$ac_cv_func_SHA512Init" != "yes"; then
if test "$ac_cv_func_SHA256_Init" != "yes" ||
test "$ac_cv_func_SHA384_Init" != "yes" ||
test "$ac_cv_func_SHA512_Init" != "yes"; then
AC_CHECK_HEADERS([openssl/sha.h])
# TODO: Does AC_SEARCH_LIBS support more than one function at once?
# This appears to always fail.
AC_SEARCH_LIBS([SHA256_Init SHA384_Init SHA512_Init], [crypto])
# TODO: Actually test for these. Previously our C code did not
# test for these at all and just assumed availability. Now that
# the C code tests these macros we preserve previous behavior
# for the autotools build by hard-coding availability.
if test "$ac_cv_header_openssl_sha_h" = "yes"; then
AC_DEFINE(HAVE_OPENSSL_SHA256_INIT, 1,
[Define to 1 if your openssl has the `SHA256_Init' function.])
AC_DEFINE(HAVE_OPENSSL_SHA384_INIT, 1,
[Define to 1 if your openssl has the `SHA384_Init' function.])
AC_DEFINE(HAVE_OPENSSL_SHA512_INIT, 1,
[Define to 1 if your openssl has the `SHA512_Init' function.])
fi
fi
fi
fi
# TODO: Give the user the option of using a pre-existing system
# libarchive. This will define HAVE_LIBARCHIVE which will cause
@ -182,7 +315,9 @@ AC_CHECK_LIB(z,inflate)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW
# and MSVC. Use a customized version.
la_TYPE_UID_T
AC_TYPE_MODE_T
# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
# most systems... default to "long long" instead.
@ -190,9 +325,21 @@ AC_CHECK_TYPE(off_t, [long long])
AC_TYPE_SIZE_T
AC_CHECK_TYPE(id_t, [unsigned long])
AC_CHECK_TYPE(uintptr_t, [unsigned int])
# Check for birthtime in struct stat
AC_CHECK_MEMBERS([struct stat.st_birthtime])
# Check for high-resolution timestamps in struct stat
AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
# Check for block size support in struct stat
AC_CHECK_MEMBERS([struct stat.st_blksize])
# Check for st_flags in struct stat (BSD fflags)
AC_CHECK_MEMBERS([struct stat.st_flags])
# If you have uintmax_t, we assume printf supports %ju
# If you have unsigned long long, we assume printf supports %llu
@ -206,7 +353,7 @@ AC_TYPE_UINTMAX_T
AC_TYPE_UINT64_T
# TODO: If any of these are missing, define them right here.
AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
AC_CHECK_DECLS([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
AC_CHECK_DECL([EFTYPE],
[AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
@ -216,6 +363,11 @@ AC_CHECK_DECL([EILSEQ],
[AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
[],
[#include <errno.h>])
AC_CHECK_TYPE([wchar_t],
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl
AC_CHECK_SIZEOF([wchar_t])],
[])
AC_HEADER_TIME
# Checks for library functions.
@ -228,14 +380,23 @@ AC_FUNC_STAT
AC_FUNC_STRERROR_R
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([chflags chown chroot fchdir fchflags fchmod fchown fcntl fork])
AC_CHECK_FUNCS([fstat ftruncate futimes geteuid getopt_long getpid])
AC_CHECK_FUNCS([lchflags lchmod lchown])
# check for:
# CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES)
# To avoid necessity for including windows.h or special forward declaration
# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
AC_CHECK_FUNCS([chflags chown chroot])
AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork])
AC_CHECK_FUNCS([fstat ftruncate futimens futimes geteuid getpid])
AC_CHECK_FUNCS([lchflags lchmod lchown link lstat])
AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod])
AC_CHECK_FUNCS([nl_langinfo pipe poll select setenv setlocale])
AC_CHECK_FUNCS([strchr strdup strerror strrchr timegm])
AC_CHECK_FUNCS([tzset unsetenv utime utimes vfork])
AC_CHECK_FUNCS([wcscpy wcslen wctomb wmemcmp wmemcpy])
AC_CHECK_FUNCS([nl_langinfo pipe poll readlink])
AC_CHECK_FUNCS([select setenv setlocale sigaction])
AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork])
AC_CHECK_FUNCS([wcrtomb wcscpy wcslen wctomb wmemcmp wmemcpy])
# detects cygwin-1.7, as opposed to older versions
AC_CHECK_FUNCS([cygwin_conv_path])
# FreeBSD's nl_langinfo supports an option to specify whether the
# current locale uses month/day or day/month ordering. It makes the
@ -248,19 +409,6 @@ AC_CHECK_DECL([D_MD_ORDER],
#endif
])
# If fnmatch() exists and supports FNM_LEADING_DIR, then bsdtar uses that,
# otherwise it uses some usable (but less featureful) built-in code for
# filename pattern matching.
AC_FUNC_FNMATCH
AC_CHECK_DECL([FNM_LEADING_DIR],
[AC_DEFINE(HAVE_FNM_LEADING_DIR, 1, [Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag])],
[],
[#if HAVE_FNMATCH
#define _GNU_SOURCE /* Required on Linux to get GNU extensions */
#include <fnmatch.h>
#endif
])
# Check for dirent.d_namlen field explicitly
# (This is a bit more straightforward than, if not quite as portable as,
# the recipe given by the autoconf maintainers.)
@ -277,8 +425,12 @@ AC_ARG_ENABLE([xattr],
if test "x$enable_xattr" != "xno"; then
AC_CHECK_HEADERS([attr/xattr.h])
AC_CHECK_HEADERS([sys/xattr.h])
AC_CHECK_LIB(attr,setxattr)
AC_CHECK_FUNCS([getxattr lgetxattr listxattr llistxattr fsetxattr lsetxattr])
AC_CHECK_FUNCS([extattr_get_file extattr_list_file])
AC_CHECK_FUNCS([extattr_set_fd extattr_set_file])
AC_CHECK_FUNCS([fsetxattr getxattr])
AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr])
fi
# Check for ACL support
@ -311,7 +463,7 @@ if test "x$enable_acl" != "xno"; then
# test for specific permissions in a permset.) Linux uses the obvious
# name, FreeBSD adds _np to mark it as "non-Posix extension."
# Test for both as a double-check that we really have POSIX-style ACL support.
AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm,,,
AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,,
[#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@ -331,8 +483,4 @@ fi
# Additional requirements
AC_SYS_LARGEFILE
# Interix doesn't provide optarg and optind
AC_CHECK_DECLS([optarg])
AC_CHECK_DECLS([optind])
AC_OUTPUT

View file

@ -1,4 +1,4 @@
# $Revision: 1.1.1.1 $, $Date: 2007/11/30 21:25:32 $
# $LastChangedRevision: 1827 $, $LastChangedDate: 2010-01-16 16:21:36 -0800 (Sat, 16 Jan 2010) $
Summary: Library to create and read several different archive formats
Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów
Name: libarchive
@ -127,8 +127,29 @@ rm -fr %buildroot
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log: libarchive.1aix53.spec,v $
Revision 1.1.1.1 2007/11/30 21:25:32 joerg
Import libarchive-2.4.0
Revision 1.1.1.2 2010/02/20 03:49:41 joerg
Import libarchive 2.8.0:
- Infrastructure:
- Allow command line tools as fallback for missing compression
libraries. If compiled without gzip for example, gunzip will
be used automatically.
- Improved support for a number of platforms like high-resolution
timestamps and Extended Attributes on various Unix systems
- New convience interface for creating archives based on disk content,
complement of the archive_write_disk interface.
- Frontends:
- bsdcpio ready for public consumption
- hand-written date parser replaces the yacc code
- Filter system:
- Simplified read filter chains
- Option support for filters
- LZMA, XZ, uudecode handled
- Format support:
- Write support for mtree files based on file system or archive
content
- Basic read support for Joliet
- Write support for zip files
- Write support for shar archives, both text-only and binary-safe
Release 1aix53 2006/12/12 rm1023@dcx.com
- tweak for aix-5.3

View file

@ -1,4 +1,4 @@
# $Revision: 1.1.1.1 $, $Date: 2007/11/30 21:25:32 $
# $LastChangedRevision: 1827 $, $LastChangedDate: 2010-01-16 16:21:36 -0800 (Sat, 16 Jan 2010) $
Summary: Library to create and read several different archive formats
Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów
Name: libarchive
@ -115,8 +115,29 @@ rm -fr %buildroot
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log: libarchive.spec,v $
Revision 1.1.1.1 2007/11/30 21:25:32 joerg
Import libarchive-2.4.0
Revision 1.1.1.2 2010/02/20 03:49:41 joerg
Import libarchive 2.8.0:
- Infrastructure:
- Allow command line tools as fallback for missing compression
libraries. If compiled without gzip for example, gunzip will
be used automatically.
- Improved support for a number of platforms like high-resolution
timestamps and Extended Attributes on various Unix systems
- New convience interface for creating archives based on disk content,
complement of the archive_write_disk interface.
- Frontends:
- bsdcpio ready for public consumption
- hand-written date parser replaces the yacc code
- Filter system:
- Simplified read filter chains
- Option support for filters
- LZMA, XZ, uudecode handled
- Format support:
- Write support for mtree files based on file system or archive
content
- Basic read support for Joliet
- Write support for zip files
- Write support for shar archives, both text-only and binary-safe
Release 1 2006/12/12 rm1023@dcx.com
- added libarchive-0123457890.patch for "0123457890" error

View file

@ -0,0 +1,128 @@
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)shar.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
.Dd April 17, 2008
.Dt SHAR 1
.Os
.Sh NAME
.Nm shar
.Nd create a shell archive of files
.Sh SYNOPSIS
.Nm
.Op Fl br
.Op Fl o Ar archive-file
.Ar
.Sh DESCRIPTION
The
.Nm
command writes a
.Xr sh 1
shell script which will recreate the file hierarchy specified by the command
line operands.
.Pp
The
.Nm
command is normally used for distributing files by
.Xr ftp 1
or
.Xr mail 1 .
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl b
Use an alternative binary format. Content of files will be uuencoded.
This option should be used to archive binary files correctly.
In this mode also file permissions will be stored to the archive.
uudecode(1) is needed to extract archives created with this option.
.It Fl o Ar archive-file
Redirect output to
.Ar archive-file .
.It Fl r
If
.Ar file
given on command line is a directory the entire subtree will be archived.
Symbolic links given on command line are followed. Other symbolic links will
be archived as such.
.El
.Sh EXAMPLES
To create a shell archive of the program
.Xr ls 1
and mail it to Rick:
.Bd -literal -offset indent
cd ls
shar -r . \&| mail -s "ls source" rick
.Ed
.Pp
To recreate the program directory:
.Bd -literal -offset indent
mkdir ls
cd ls
\&...
<delete header lines and examine mailed archive>
\&...
sh archive
.Ed
.Sh SEE ALSO
.Xr compress 1 ,
.Xr mail 1 ,
.Xr tar 1 ,
.Xr uuencode 1 ,
.Xr uuencode 5
.Sh HISTORY
The
.Nm
command appeared in
.Bx 4.4 .
This is a re-implementation based on the libarchive(3) library.
.Sh BUGS
The
.Nm
command makes no provisions for hard links.
.Pp
Files containing magic characters or files without a newline ('\\n') as the
last character are not handled correctly with the default format. Use the -b
option for binary files.
.Pp
It is easy to insert trojan horses into
.Nm
files.
It is strongly recommended that all shell archive files be examined
before running them through
.Xr sh 1 .
Archives produced using this implementation of
.Nm
may be easily examined with the command:
.Bd -literal -offset indent
egrep -v '^[X#]' shar.file
.Ed

View file

@ -0,0 +1,314 @@
/*-
* Copyright (c) 2008 Jaakko Heinonen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <archive.h>
#include <archive_entry.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include "tree.h"
/* command line options */
static int b_opt; /* use alternative shar binary format */
static int r_opt; /* recurse into subdirectories */
static char *o_arg; /* output file name */
static void
usage(void)
{
fprintf(stderr, "Usage: shar [-br] [-o filename] file ...\n");
exit(EX_USAGE);
}
/*
* Initialize archive structure and create a shar archive.
*/
static struct archive *
shar_create(void)
{
struct archive *a;
if ((a = archive_write_new()) == NULL)
errx(EXIT_FAILURE, "%s", archive_error_string(a));
if (b_opt)
archive_write_set_format_shar_dump(a);
else
archive_write_set_format_shar(a);
archive_write_set_compression_none(a);
if (archive_write_open_filename(a, o_arg) != ARCHIVE_OK)
errx(EX_CANTCREAT, "%s", archive_error_string(a));
return (a);
}
/* buffer for file data */
static char buffer[32768];
/*
* Write file data to an archive entry.
*/
static int
shar_write_entry_data(struct archive *a, const int fd)
{
ssize_t bytes_read, bytes_written;
assert(a != NULL);
assert(fd >= 0);
bytes_read = read(fd, buffer, sizeof(buffer));
while (bytes_read != 0) {
if (bytes_read < 0) {
archive_set_error(a, errno, "Read failed");
return (ARCHIVE_WARN);
}
bytes_written = archive_write_data(a, buffer, bytes_read);
if (bytes_written < 0)
return (ARCHIVE_WARN);
bytes_read = read(fd, buffer, sizeof(buffer));
}
return (ARCHIVE_OK);
}
/*
* Write a file to the archive. We have special handling for symbolic links.
*/
static int
shar_write_entry(struct archive *a, const char *pathname, const char *accpath,
const struct stat *st)
{
struct archive_entry *entry;
int fd = -1;
int ret = ARCHIVE_OK;
assert(a != NULL);
assert(pathname != NULL);
assert(accpath != NULL);
assert(st != NULL);
entry = archive_entry_new();
if (S_ISREG(st->st_mode) && st->st_size > 0) {
/* regular file */
if ((fd = open(accpath, O_RDONLY)) == -1) {
warn("%s", accpath);
ret = ARCHIVE_WARN;
goto out;
}
} else if (S_ISLNK(st->st_mode)) {
/* symbolic link */
char lnkbuff[PATH_MAX + 1];
int lnklen;
if ((lnklen = readlink(accpath, lnkbuff, PATH_MAX)) == -1) {
warn("%s", accpath);
ret = ARCHIVE_WARN;
goto out;
}
lnkbuff[lnklen] = '\0';
archive_entry_set_symlink(entry, lnkbuff);
}
archive_entry_copy_stat(entry, st);
archive_entry_set_pathname(entry, pathname);
if (!S_ISREG(st->st_mode) || st->st_size == 0)
archive_entry_set_size(entry, 0);
if (archive_write_header(a, entry) != ARCHIVE_OK) {
warnx("%s: %s", pathname, archive_error_string(a));
ret = ARCHIVE_WARN;
goto out;
}
if (fd >= 0) {
if ((ret = shar_write_entry_data(a, fd)) != ARCHIVE_OK)
warnx("%s: %s", accpath, archive_error_string(a));
}
out:
archive_entry_free(entry);
if (fd >= 0)
close(fd);
return (ret);
}
/*
* Write singe path to the archive. The path can be a regular file, directory
* or device. Symbolic links are followed.
*/
static int
shar_write_path(struct archive *a, const char *pathname)
{
struct stat st;
assert(a != NULL);
assert(pathname != NULL);
if ((stat(pathname, &st)) == -1) {
warn("%s", pathname);
return (ARCHIVE_WARN);
}
return (shar_write_entry(a, pathname, pathname, &st));
}
/*
* Write tree to the archive. If pathname is a symbolic link it will be
* followed. Other symbolic links are stored as such to the archive.
*/
static int
shar_write_tree(struct archive *a, const char *pathname)
{
struct tree *t;
const struct stat *lst, *st;
int error = 0;
int tree_ret;
int first;
assert(a != NULL);
assert(pathname != NULL);
t = tree_open(pathname);
for (first = 1; (tree_ret = tree_next(t)); first = 0) {
if (tree_ret == TREE_ERROR_DIR) {
warnx("%s: %s", tree_current_path(t),
strerror(tree_errno(t)));
error = 1;
continue;
} else if (tree_ret != TREE_REGULAR)
continue;
if ((lst = tree_current_lstat(t)) == NULL) {
warn("%s", tree_current_path(t));
error = 1;
continue;
}
/*
* If the symlink was given on command line then
* follow it rather than write it as symlink.
*/
if (first && S_ISLNK(lst->st_mode)) {
if ((st = tree_current_stat(t)) == NULL) {
warn("%s", tree_current_path(t));
error = 1;
continue;
}
} else
st = lst;
if (shar_write_entry(a, tree_current_path(t),
tree_current_access_path(t), st) != ARCHIVE_OK)
error = 1;
tree_descend(t);
}
tree_close(t);
return ((error != 0) ? ARCHIVE_WARN : ARCHIVE_OK);
}
/*
* Create a shar archive and write files/trees into it.
*/
static int
shar_write(char **fn, size_t nfn)
{
struct archive *a;
size_t i;
int error = 0;
assert(fn != NULL);
assert(nfn > 0);
a = shar_create();
for (i = 0; i < nfn; i++) {
if (r_opt) {
if (shar_write_tree(a, fn[i]) != ARCHIVE_OK)
error = 1;
} else {
if (shar_write_path(a, fn[i]) != ARCHIVE_OK)
error = 1;
}
}
if (archive_write_finish(a) != ARCHIVE_OK)
errx(EXIT_FAILURE, "%s", archive_error_string(a));
if (error != 0)
warnx("Error exit delayed from previous errors.");
return (error);
}
int
main(int argc, char **argv)
{
int opt;
while ((opt = getopt(argc, argv, "bro:")) != -1) {
switch (opt) {
case 'b':
b_opt = 1;
break;
case 'o':
o_arg = optarg;
break;
case 'r':
r_opt = 1;
break;
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;
argv += optind;
if(argc < 1)
usage();
if (shar_write(argv, argc) != 0)
exit(EXIT_FAILURE);
else
exit(EXIT_SUCCESS);
/* NOTREACHED */
}

View file

@ -0,0 +1,542 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*-
* This is a new directory-walking system that addresses a number
* of problems I've had with fts(3). In particular, it has no
* pathname-length limits (other than the size of 'int'), handles
* deep logical traversals, uses considerably less memory, and has
* an opaque interface (easier to modify in the future).
*
* Internally, it keeps a single list of "tree_entry" items that
* represent filesystem objects that require further attention.
* Non-directories are not kept in memory: they are pulled from
* readdir(), returned to the client, then freed as soon as possible.
* Any directory entry to be traversed gets pushed onto the stack.
*
* There is surprisingly little information that needs to be kept for
* each item on the stack. Just the name, depth (represented here as the
* string length of the parent directory's pathname), and some markers
* indicating how to get back to the parent (via chdir("..") for a
* regular dir or via fchdir(2) for a symlink).
*/
#include "tree_config.h"
__FBSDID("$FreeBSD$");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "tree.h"
/*
* TODO:
* 1) Loop checking.
* 3) Arbitrary logical traversals by closing/reopening intermediate fds.
*/
struct tree_entry {
struct tree_entry *next;
struct tree_entry *parent;
char *name;
size_t dirname_length;
dev_t dev;
ino_t ino;
int fd;
int flags;
};
/* Definitions for tree_entry.flags bitmap. */
#define isDir 1 /* This entry is a regular directory. */
#define isDirLink 2 /* This entry is a symbolic link to a directory. */
#define needsPreVisit 4 /* This entry needs to be previsited. */
#define needsPostVisit 8 /* This entry needs to be postvisited. */
/*
* Local data for this package.
*/
struct tree {
struct tree_entry *stack;
struct tree_entry *current;
DIR *d;
int initialDirFd;
int flags;
int visit_type;
int tree_errno; /* Error code from last failed operation. */
char *buff;
const char *basename;
size_t buff_length;
size_t path_length;
size_t dirname_length;
int depth;
int openCount;
int maxOpenCount;
struct stat lst;
struct stat st;
};
/* Definitions for tree.flags bitmap. */
#define needsReturn 8 /* Marks first entry as not having been returned yet. */
#define hasStat 16 /* The st entry is set. */
#define hasLstat 32 /* The lst entry is set. */
#ifdef HAVE_DIRENT_D_NAMLEN
/* BSD extension; avoids need for a strlen() call. */
#define D_NAMELEN(dp) (dp)->d_namlen
#else
#define D_NAMELEN(dp) (strlen((dp)->d_name))
#endif
#if 0
#include <stdio.h>
void
tree_dump(struct tree *t, FILE *out)
{
struct tree_entry *te;
fprintf(out, "\tdepth: %d\n", t->depth);
fprintf(out, "\tbuff: %s\n", t->buff);
fprintf(out, "\tpwd: "); fflush(stdout); system("pwd");
fprintf(out, "\taccess: %s\n", t->basename);
fprintf(out, "\tstack:\n");
for (te = t->stack; te != NULL; te = te->next) {
fprintf(out, "\t\tte->name: %s%s%s\n", te->name,
te->flags & needsPreVisit ? "" : " *",
t->current == te ? " (current)" : "");
}
}
#endif
/*
* Add a directory path to the current stack.
*/
static void
tree_push(struct tree *t, const char *path)
{
struct tree_entry *te;
te = malloc(sizeof(*te));
memset(te, 0, sizeof(*te));
te->next = t->stack;
t->stack = te;
te->fd = -1;
te->name = strdup(path);
te->flags = needsPreVisit | needsPostVisit;
te->dirname_length = t->dirname_length;
}
/*
* Append a name to the current path.
*/
static void
tree_append(struct tree *t, const char *name, size_t name_length)
{
char *p;
if (t->buff != NULL)
t->buff[t->dirname_length] = '\0';
/* Strip trailing '/' from name, unless entire name is "/". */
while (name_length > 1 && name[name_length - 1] == '/')
name_length--;
/* Resize pathname buffer as needed. */
while (name_length + 1 + t->dirname_length >= t->buff_length) {
t->buff_length *= 2;
if (t->buff_length < 1024)
t->buff_length = 1024;
t->buff = realloc(t->buff, t->buff_length);
}
p = t->buff + t->dirname_length;
t->path_length = t->dirname_length + name_length;
/* Add a separating '/' if it's needed. */
if (t->dirname_length > 0 && p[-1] != '/') {
*p++ = '/';
t->path_length ++;
}
strncpy(p, name, name_length);
p[name_length] = '\0';
t->basename = p;
}
/*
* Open a directory tree for traversal.
*/
struct tree *
tree_open(const char *path)
{
struct tree *t;
t = malloc(sizeof(*t));
memset(t, 0, sizeof(*t));
tree_append(t, path, strlen(path));
t->initialDirFd = open(".", O_RDONLY);
/*
* During most of the traversal, items are set up and then
* returned immediately from tree_next(). That doesn't work
* for the very first entry, so we set a flag for this special
* case.
*/
t->flags = needsReturn;
return (t);
}
/*
* We've finished a directory; ascend back to the parent.
*/
static void
tree_ascend(struct tree *t)
{
struct tree_entry *te;
te = t->stack;
t->depth--;
if (te->flags & isDirLink) {
fchdir(te->fd);
close(te->fd);
t->openCount--;
} else {
chdir("..");
}
}
/*
* Pop the working stack.
*/
static void
tree_pop(struct tree *t)
{
struct tree_entry *te;
t->buff[t->dirname_length] = '\0';
if (t->stack == t->current && t->current != NULL)
t->current = t->current->parent;
te = t->stack;
t->stack = te->next;
t->dirname_length = te->dirname_length;
t->basename = t->buff + t->dirname_length;
/* Special case: starting dir doesn't skip leading '/'. */
if (t->dirname_length > 0)
t->basename++;
free(te->name);
free(te);
}
/*
* Get the next item in the tree traversal.
*/
int
tree_next(struct tree *t)
{
struct dirent *de = NULL;
/* Handle the startup case by returning the initial entry. */
if (t->flags & needsReturn) {
t->flags &= ~needsReturn;
return (t->visit_type = TREE_REGULAR);
}
while (t->stack != NULL) {
/* If there's an open dir, get the next entry from there. */
while (t->d != NULL) {
de = readdir(t->d);
if (de == NULL) {
closedir(t->d);
t->d = NULL;
} else if (de->d_name[0] == '.'
&& de->d_name[1] == '\0') {
/* Skip '.' */
} else if (de->d_name[0] == '.'
&& de->d_name[1] == '.'
&& de->d_name[2] == '\0') {
/* Skip '..' */
} else {
/*
* Append the path to the current path
* and return it.
*/
tree_append(t, de->d_name, D_NAMELEN(de));
t->flags &= ~hasLstat;
t->flags &= ~hasStat;
return (t->visit_type = TREE_REGULAR);
}
}
/* If the current dir needs to be visited, set it up. */
if (t->stack->flags & needsPreVisit) {
t->current = t->stack;
tree_append(t, t->stack->name, strlen(t->stack->name));
t->stack->flags &= ~needsPreVisit;
/* If it is a link, set up fd for the ascent. */
if (t->stack->flags & isDirLink) {
t->stack->fd = open(".", O_RDONLY);
t->openCount++;
if (t->openCount > t->maxOpenCount)
t->maxOpenCount = t->openCount;
}
t->dirname_length = t->path_length;
if (chdir(t->stack->name) != 0) {
/* chdir() failed; return error */
tree_pop(t);
t->tree_errno = errno;
return (t->visit_type = TREE_ERROR_DIR);
}
t->depth++;
t->d = opendir(".");
if (t->d == NULL) {
tree_ascend(t); /* Undo "chdir" */
tree_pop(t);
t->tree_errno = errno;
return (t->visit_type = TREE_ERROR_DIR);
}
t->flags &= ~hasLstat;
t->flags &= ~hasStat;
t->basename = ".";
return (t->visit_type = TREE_POSTDESCENT);
}
/* We've done everything necessary for the top stack entry. */
if (t->stack->flags & needsPostVisit) {
tree_ascend(t);
tree_pop(t);
t->flags &= ~hasLstat;
t->flags &= ~hasStat;
return (t->visit_type = TREE_POSTASCENT);
}
}
return (t->visit_type = 0);
}
/*
* Return error code.
*/
int
tree_errno(struct tree *t)
{
return (t->tree_errno);
}
/*
* Called by the client to mark the directory just returned from
* tree_next() as needing to be visited.
*/
void
tree_descend(struct tree *t)
{
if (t->visit_type != TREE_REGULAR)
return;
if (tree_current_is_physical_dir(t)) {
tree_push(t, t->basename);
t->stack->flags |= isDir;
} else if (tree_current_is_dir(t)) {
tree_push(t, t->basename);
t->stack->flags |= isDirLink;
}
}
/*
* Get the stat() data for the entry just returned from tree_next().
*/
const struct stat *
tree_current_stat(struct tree *t)
{
if (!(t->flags & hasStat)) {
if (stat(t->basename, &t->st) != 0)
return NULL;
t->flags |= hasStat;
}
return (&t->st);
}
/*
* Get the lstat() data for the entry just returned from tree_next().
*/
const struct stat *
tree_current_lstat(struct tree *t)
{
if (!(t->flags & hasLstat)) {
if (lstat(t->basename, &t->lst) != 0)
return NULL;
t->flags |= hasLstat;
}
return (&t->lst);
}
/*
* Test whether current entry is a dir or link to a dir.
*/
int
tree_current_is_dir(struct tree *t)
{
const struct stat *st;
/*
* If we already have lstat() info, then try some
* cheap tests to determine if this is a dir.
*/
if (t->flags & hasLstat) {
/* If lstat() says it's a dir, it must be a dir. */
if (S_ISDIR(tree_current_lstat(t)->st_mode))
return 1;
/* Not a dir; might be a link to a dir. */
/* If it's not a link, then it's not a link to a dir. */
if (!S_ISLNK(tree_current_lstat(t)->st_mode))
return 0;
/*
* It's a link, but we don't know what it's a link to,
* so we'll have to use stat().
*/
}
st = tree_current_stat(t);
/* If we can't stat it, it's not a dir. */
if (st == NULL)
return 0;
/* Use the definitive test. Hopefully this is cached. */
return (S_ISDIR(st->st_mode));
}
/*
* Test whether current entry is a physical directory. Usually, we
* already have at least one of stat() or lstat() in memory, so we
* use tricks to try to avoid an extra trip to the disk.
*/
int
tree_current_is_physical_dir(struct tree *t)
{
const struct stat *st;
/*
* If stat() says it isn't a dir, then it's not a dir.
* If stat() data is cached, this check is free, so do it first.
*/
if ((t->flags & hasStat)
&& (!S_ISDIR(tree_current_stat(t)->st_mode)))
return 0;
/*
* Either stat() said it was a dir (in which case, we have
* to determine whether it's really a link to a dir) or
* stat() info wasn't available. So we use lstat(), which
* hopefully is already cached.
*/
st = tree_current_lstat(t);
/* If we can't stat it, it's not a dir. */
if (st == NULL)
return 0;
/* Use the definitive test. Hopefully this is cached. */
return (S_ISDIR(st->st_mode));
}
/*
* Test whether current entry is a symbolic link.
*/
int
tree_current_is_physical_link(struct tree *t)
{
const struct stat *st = tree_current_lstat(t);
if (st == NULL)
return 0;
return (S_ISLNK(st->st_mode));
}
/*
* Return the access path for the entry just returned from tree_next().
*/
const char *
tree_current_access_path(struct tree *t)
{
return (t->basename);
}
/*
* Return the full path for the entry just returned from tree_next().
*/
const char *
tree_current_path(struct tree *t)
{
return (t->buff);
}
/*
* Return the length of the path for the entry just returned from tree_next().
*/
size_t
tree_current_pathlen(struct tree *t)
{
return (t->path_length);
}
/*
* Return the nesting depth of the entry just returned from tree_next().
*/
int
tree_current_depth(struct tree *t)
{
return (t->depth);
}
/*
* Terminate the traversal and release any resources.
*/
void
tree_close(struct tree *t)
{
/* Release anything remaining in the stack. */
while (t->stack != NULL)
tree_pop(t);
if (t->buff)
free(t->buff);
/* chdir() back to where we started. */
if (t->initialDirFd >= 0) {
fchdir(t->initialDirFd);
close(t->initialDirFd);
t->initialDirFd = -1;
}
free(t);
}

View file

@ -0,0 +1,115 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
/*-
* A set of routines for traversing directory trees.
* Similar in concept to the fts library, but with a few
* important differences:
* * Uses less memory. In particular, fts stores an entire directory
* in memory at a time. This package only keeps enough subdirectory
* information in memory to track the traversal. Information
* about non-directories is discarded as soon as possible.
* * Supports very deep logical traversals. The fts package
* uses "non-chdir" approach for logical traversals. This
* package does use a chdir approach for logical traversals
* and can therefore handle pathnames much longer than
* PATH_MAX.
* * Supports deep physical traversals "out of the box."
* Due to the memory optimizations above, there's no need to
* limit dir names to 32k.
*/
#include <sys/stat.h>
#include <stdio.h>
struct tree;
/* Initiate/terminate a tree traversal. */
struct tree *tree_open(const char * /* pathname */);
void tree_close(struct tree *);
/*
* tree_next() returns Zero if there is no next entry, non-zero if there is.
* Note that directories are potentially visited three times. The first
* time as "regular" file. If tree_descend() is invoked at that time,
* the directory is added to a work list and will be visited two more
* times: once just after descending into the directory and again
* just after ascending back to the parent.
*
* TREE_ERROR is returned if the descent failed (because the
* directory couldn't be opened, for instance). This is returned
* instead of TREE_PREVISIT/TREE_POSTVISIT.
*/
#define TREE_REGULAR 1
#define TREE_POSTDESCENT 2
#define TREE_POSTASCENT 3
#define TREE_ERROR_DIR -1
int tree_next(struct tree *);
int tree_errno(struct tree *);
/*
* Request that current entry be visited. If you invoke it on every
* directory, you'll get a physical traversal. This is ignored if the
* current entry isn't a directory or a link to a directory. So, if
* you invoke this on every returned path, you'll get a full logical
* traversal.
*/
void tree_descend(struct tree *);
/*
* Return information about the current entry.
*/
int tree_current_depth(struct tree *);
/*
* The current full pathname, length of the full pathname,
* and a name that can be used to access the file.
* Because tree does use chdir extensively, the access path is
* almost never the same as the full current path.
*/
const char *tree_current_path(struct tree *);
size_t tree_current_pathlen(struct tree *);
const char *tree_current_access_path(struct tree *);
/*
* Request the lstat() or stat() data for the current path. Since the
* tree package needs to do some of this anyway, and caches the
* results, you should take advantage of it here if you need it rather
* than make a redundant stat() or lstat() call of your own.
*/
const struct stat *tree_current_stat(struct tree *);
const struct stat *tree_current_lstat(struct tree *);
/* The following tests may use mechanisms much faster than stat()/lstat(). */
/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */
int tree_current_is_physical_dir(struct tree *);
/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */
int tree_current_is_physical_link(struct tree *);
/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */
int tree_current_is_dir(struct tree *);
/* For testing/debugging: Dump the internal status to the given filehandle. */
void tree_dump(struct tree *, FILE *);

View file

@ -0,0 +1,78 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef TREE_CONFIG_H_INCLUDED
#define TREE_CONFIG_H_INCLUDED
#if defined(PLATFORM_CONFIG_H)
/*
* Use hand-built config.h in environments that need it.
*/
#include PLATFORM_CONFIG_H
#elif defined(HAVE_CONFIG_H)
/*
* Most POSIX platforms use the 'configure' script to build config.h
*/
#include "../config.h"
#elif defined(__FreeBSD__)
/*
* Built-in definitions for FreeBSD.
*/
#define HAVE_DIRENT_D_NAMLEN 1
#define HAVE_DIRENT_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_LIBARCHIVE 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_UNISTD_H 1
#else
/*
* Warn if there's no platform configuration.
*/
#error Oops: No config.h and no built-in configuration in bsdtar_platform.h.
#endif /* !HAVE_CONFIG_H */
/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
#ifdef __FreeBSD__
#include <sys/cdefs.h> /* For __FBSDID */
#else
/* Just leaving this macro replacement empty leads to a dangling semicolon. */
#define __FBSDID(a) struct _undefined_hack
#endif
#ifdef HAVE_LIBARCHIVE
/* If we're using the platform libarchive, include system headers. */
#include <archive.h>
#include <archive_entry.h>
#else
/* Otherwise, include user headers. */
#include "archive.h"
#include "archive_entry.h"
#endif
#endif /* !TREE_CONFIG_H_INCLUDED */

View file

@ -0,0 +1,225 @@
/*
* "untar" is an extremely simple tar extractor:
* * A single C source file, so it should be easy to compile
* and run on any system with a C compiler.
* * Extremely portable standard C. The only non-ANSI function
* used is mkdir().
* * Reads basic ustar tar archives.
* * Does not require libarchive or any other special library.
*
* To compile: cc -o untar untar.c
*
* Usage: untar <archive>
*
* In particular, this program should be sufficient to extract the
* distribution for libarchive, allowing people to bootstrap
* libarchive on systems that do not already have a tar program.
*
* To unpack libarchive-x.y.z.tar.gz:
* * gunzip libarchive-x.y.z.tar.gz
* * untar libarchive-x.y.z.tar
*
* Written by Tim Kientzle, March 2009.
*
* Released into the public domain.
*/
/* These are all highly standard and portable headers. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* This is for mkdir(); this may need to be changed for some platforms. */
#include <sys/stat.h> /* For mkdir() */
/* Parse an octal number, ignoring leading and trailing nonsense. */
static int
parseoct(const char *p, size_t n)
{
int i = 0;
while (*p < '0' || *p > '7') {
++p;
--n;
}
while (*p >= '0' && *p <= '7' && n > 0) {
i *= 8;
i += *p - '0';
++p;
--n;
}
return (i);
}
/* Returns true if this is 512 zero bytes. */
static int
is_end_of_archive(const char *p)
{
int n;
for (n = 511; n >= 0; --n)
if (p[n] != '\0')
return (0);
return (1);
}
/* Create a directory, including parent directories as necessary. */
static void
create_dir(char *pathname, int mode)
{
char *p;
int r;
/* Strip trailing '/' */
if (pathname[strlen(pathname) - 1] == '/')
pathname[strlen(pathname) - 1] = '\0';
/* Try creating the directory. */
r = mkdir(pathname, mode);
if (r != 0) {
/* On failure, try creating parent directory. */
p = strrchr(pathname, '/');
if (p != NULL) {
*p = '\0';
create_dir(pathname, 0755);
*p = '/';
r = mkdir(pathname, mode);
}
}
if (r != 0)
fprintf(stderr, "Could not create directory %s\n", pathname);
}
/* Create a file, including parent directory as necessary. */
static FILE *
create_file(char *pathname, int mode)
{
FILE *f;
f = fopen(pathname, "w+");
if (f == NULL) {
/* Try creating parent dir and then creating file. */
char *p = strrchr(pathname, '/');
if (p != NULL) {
*p = '\0';
create_dir(pathname, 0755);
*p = '/';
f = fopen(pathname, "w+");
}
}
return (f);
}
/* Verify the tar checksum. */
static int
verify_checksum(const char *p)
{
int n, u = 0;
for (n = 0; n < 512; ++n) {
if (n < 148 || n > 155)
/* Standard tar checksum adds unsigned bytes. */
u += ((unsigned char *)p)[n];
else
u += 0x20;
}
return (u == parseoct(p + 148, 8));
}
/* Extract a tar archive. */
static void
untar(FILE *a, const char *path)
{
char buff[512];
FILE *f = NULL;
size_t bytes_read;
int filesize;
printf("Extracting from %s\n", path);
for (;;) {
bytes_read = fread(buff, 1, 512, a);
if (bytes_read < 512) {
fprintf(stderr,
"Short read on %s: expected 512, got %d\n",
path, bytes_read);
return;
}
if (is_end_of_archive(buff)) {
printf("End of %s\n", path);
return;
}
if (!verify_checksum(buff)) {
fprintf(stderr, "Checksum failure\n");
return;
}
filesize = parseoct(buff + 124, 12);
switch (buff[156]) {
case '1':
printf(" Ignoring hardlink %s\n", buff);
break;
case '2':
printf(" Ignoring symlink %s\n", buff);
break;
case '3':
printf(" Ignoring character device %s\n", buff);
break;
case '4':
printf(" Ignoring block device %s\n", buff);
break;
case '5':
printf(" Extracting dir %s\n", buff);
create_dir(buff, parseoct(buff + 100, 8));
filesize = 0;
break;
case '6':
printf(" Ignoring FIFO %s\n", buff);
break;
default:
printf(" Extracting file %s\n", buff);
f = create_file(buff, parseoct(buff + 100, 8));
break;
}
while (filesize > 0) {
bytes_read = fread(buff, 1, 512, a);
if (bytes_read < 512) {
fprintf(stderr,
"Short read on %s: Expected 512, got %d\n",
path, bytes_read);
return;
}
if (filesize < 512)
bytes_read = filesize;
if (f != NULL) {
if (fwrite(buff, 1, bytes_read, f)
!= bytes_read)
{
fprintf(stderr, "Failed write\n");
fclose(f);
f = NULL;
}
}
filesize -= bytes_read;
}
if (f != NULL) {
fclose(f);
f = NULL;
}
}
}
int
main(int argc, char **argv)
{
FILE *a;
++argv; /* Skip program name */
for ( ;*argv != NULL; ++argv) {
a = fopen(*argv, "r");
if (a == NULL)
fprintf(stderr, "Unable to open %s\n", *argv);
else {
untar(a, *argv);
fclose(a);
}
}
return (0);
}

View file

@ -0,0 +1,51 @@
############################################
#
# How to build bsdcpio
#
############################################
IF(ENABLE_CPIO)
SET(bsdcpio_SOURCES
cmdline.c
cpio.c
cpio.h
cpio_platform.h
../libarchive_fe/err.c
../libarchive_fe/err.h
../libarchive_fe/lafe_platform.h
../libarchive_fe/line_reader.c
../libarchive_fe/line_reader.h
../libarchive_fe/matching.c
../libarchive_fe/matching.h
../libarchive_fe/pathmatch.c
../libarchive_fe/pathmatch.h
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe)
IF(WIN32 AND NOT CYGWIN)
LIST(APPEND bsdcpio_SOURCES cpio_windows.c)
LIST(APPEND bsdcpio_SOURCES cpio_windows.h)
ENDIF(WIN32 AND NOT CYGWIN)
# bsdcpio documentation
SET(bsdcpio_MANS bsdcpio.1)
# How to build bsdcpio
ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES})
IF(ENABLE_CPIO_SHARED)
TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS})
ELSE(ENABLE_CPIO_SHARED)
TARGET_LINK_LIBRARIES(bsdcpio archive_static ${ADDITIONAL_LIBS})
SET_TARGET_PROPERTIES(bsdcpio PROPERTIES COMPILE_DEFINITIONS
LIBARCHIVE_STATIC)
ENDIF(ENABLE_CPIO_SHARED)
# Full path to the compiled executable (used by test suite)
GET_TARGET_PROPERTY(BSDCPIO bsdcpio LOCATION)
# Installation rules
INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin)
INSTALL_MAN(${bsdcpio_MANS})
ENDIF(ENABLE_CPIO)
# Test suite
add_subdirectory(test)

View file

@ -80,6 +80,9 @@ specified directory.
Unless specifically stated otherwise, options are applicable in
all operating modes.
.Bl -tag -width indent
.It Fl 0
Read filenames separated by NUL characters instead of newlines.
This is necessary if any of the filenames being read might contain newlines.
.It Fl A
(o mode only)
Append to the specified archive.
@ -142,6 +145,11 @@ for more complete information about the
formats currently supported by the underlying
.Xr libarchive 3
library.
.It Fl H Ar format
Synonym for
.Fl -format .
.It Fl h , Fl -help
Print usage information.
.It Fl I Ar file
Read archive from
.Ar file .
@ -154,6 +162,14 @@ Disable security checks during extraction or copying.
This allows extraction via symbolic links and path names containing
.Sq ..
in the name.
.It Fl J
(o mode only)
Compress the file with xz-compatible compression before writing it.
In input mode, this option is ignored; xz compression is recognized
automatically on input.
.It Fl j
Synonym for
.Fl y .
.It Fl L
(o and p modes)
All symbolic links will be followed.
@ -163,10 +179,28 @@ With this option, the target of the link will be archived or copied instead.
(p mode only)
Create links from the target directory to the original files,
instead of copying.
.It Fl lzma
(o mode only)
Compress the file with lzma-compatible compression before writing it.
In input mode, this option is ignored; lzma compression is recognized
automatically on input.
.It Fl m
(i and p modes)
Set file modification time on created files to match
those in the source.
.It Fl n
(i mode, only with
.Fl t )
Display numeric uid and gid.
By default,
.Nm
displays the user and group names when they are provided in the
archive, or looks up the user and group names in the system
password database.
.It Fl no-preserve-owner
(i mode only)
Do not attempt to restore file ownership.
This is the default when run by non-root users.
.It Fl O Ar file
Write archive to
.Ar file .
@ -176,6 +210,10 @@ See above for description.
.It Fl p
Pass-through mode.
See above for description.
.It Fl preserve-owner
(i mode only)
Restore file ownership.
This is the default when run by the root user.
.It Fl -quiet
Suppress unnecessary messages.
.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc

View file

@ -26,23 +26,11 @@
#include "cpio_platform.h"
__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.3 2008/06/21 02:20:20 kientzle Exp $");
__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
#else
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
#define no_argument 0
#define required_argument 1
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
@ -58,120 +46,222 @@ struct option {
#endif
#include "cpio.h"
#include "err.h"
/*
*
* Option parsing routines for bsdcpio.
*
* Short options for cpio. Please keep this sorted.
*/
static const char *cpio_opts = "0AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz";
static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuvW:yZz";
/*
* On systems that lack getopt_long, long options can be specified
* using -W longopt and -W longopt=value, e.g. "-W version" is the
* same as "--version" and "-W format=ustar" is the same as "--format
* ustar". This does not rely the GNU getopt() "W;" extension, so
* should work correctly on any system with a POSIX-compliant
* getopt().
* Long options for cpio. Please keep this sorted.
*/
/*
* If you add anything, be very careful to keep this list properly
* sorted, as the -W logic below relies on it.
*/
static const struct option cpio_longopts[] = {
{ "create", no_argument, NULL, 'o' },
{ "extract", no_argument, NULL, 'i' },
{ "file", required_argument, NULL, 'F' },
{ "format", required_argument, NULL, 'H' },
{ "help", no_argument, NULL, 'h' },
{ "insecure", no_argument, NULL, OPTION_INSECURE },
{ "link", no_argument, NULL, 'l' },
{ "list", no_argument, NULL, 't' },
{ "make-directories", no_argument, NULL, 'd' },
{ "null", no_argument, NULL, '0' },
{ "owner", required_argument, NULL, 'R' },
{ "pass-through", no_argument, NULL, 'p' },
{ "preserve-modification-time", no_argument, NULL, 'm' },
{ "quiet", no_argument, NULL, OPTION_QUIET },
{ "unconditional", no_argument, NULL, 'u' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, OPTION_VERSION },
{ NULL, 0, NULL, 0 }
static const struct option {
const char *name;
int required; /* 1 if this option requires an argument */
int equivalent; /* Equivalent short option. */
} cpio_longopts[] = {
{ "create", 0, 'o' },
{ "extract", 0, 'i' },
{ "file", 1, 'F' },
{ "format", 1, 'H' },
{ "help", 0, 'h' },
{ "insecure", 0, OPTION_INSECURE },
{ "link", 0, 'l' },
{ "list", 0, 't' },
{ "lzma", 0, OPTION_LZMA },
{ "make-directories", 0, 'd' },
{ "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER },
{ "null", 0, '0' },
{ "numeric-uid-gid", 0, 'n' },
{ "owner", 1, 'R' },
{ "pass-through", 0, 'p' },
{ "preserve-modification-time", 0, 'm' },
{ "preserve-owner", 0, OPTION_PRESERVE_OWNER },
{ "quiet", 0, OPTION_QUIET },
{ "unconditional", 0, 'u' },
{ "verbose", 0, 'v' },
{ "version", 0, OPTION_VERSION },
{ "xz", 0, 'J' },
{ NULL, 0, 0 }
};
/*
* Parse command-line options using system-provided getopt() or getopt_long().
* If option is -W, then parse argument as a long option.
* I used to try to select platform-provided getopt() or
* getopt_long(), but that caused a lot of headaches. In particular,
* I couldn't consistently use long options in the test harness
* because not all platforms have getopt_long(). That in turn led to
* overuse of the -W hack in the test harness, which made it rough to
* run the test harness against GNU cpio. (I periodically run the
* test harness here against GNU cpio as a sanity-check. Yes,
* I've found a couple of bugs in GNU cpio that way.)
*/
int
cpio_getopt(struct cpio *cpio)
{
char *p, *q;
const struct option *option, *option2;
int opt;
int option_index;
size_t option_length;
enum { state_start = 0, state_next_word, state_short, state_long };
static int state = state_start;
static char *opt_word;
option_index = -1;
const struct option *popt, *match = NULL, *match2 = NULL;
const char *p, *long_prefix = "--";
size_t optlength;
int opt = '?';
int required = 0;
#ifdef HAVE_GETOPT_LONG
opt = getopt_long(cpio->argc, cpio->argv, cpio_opts,
cpio_longopts, &option_index);
#else
opt = getopt(cpio->argc, cpio->argv, cpio_opts);
#endif
cpio->optarg = NULL;
/* Support long options through -W longopt=value */
if (opt == 'W') {
p = optarg;
q = strchr(optarg, '=');
if (q != NULL) {
option_length = (size_t)(q - p);
optarg = q + 1;
/* First time through, initialize everything. */
if (state == state_start) {
/* Skip program name. */
++cpio->argv;
--cpio->argc;
state = state_next_word;
}
/*
* We're ready to look at the next word in argv.
*/
if (state == state_next_word) {
/* No more arguments, so no more options. */
if (cpio->argv[0] == NULL)
return (-1);
/* Doesn't start with '-', so no more options. */
if (cpio->argv[0][0] != '-')
return (-1);
/* "--" marks end of options; consume it and return. */
if (strcmp(cpio->argv[0], "--") == 0) {
++cpio->argv;
--cpio->argc;
return (-1);
}
/* Get next word for parsing. */
opt_word = *cpio->argv++;
--cpio->argc;
if (opt_word[1] == '-') {
/* Set up long option parser. */
state = state_long;
opt_word += 2; /* Skip leading '--' */
} else {
option_length = strlen(p);
optarg = NULL;
/* Set up short option parser. */
state = state_short;
++opt_word; /* Skip leading '-' */
}
option = cpio_longopts;
while (option->name != NULL &&
(strlen(option->name) < option_length ||
strncmp(p, option->name, option_length) != 0 )) {
option++;
}
/*
* We're parsing a group of POSIX-style single-character options.
*/
if (state == state_short) {
/* Peel next option off of a group of short options. */
opt = *opt_word++;
if (opt == '\0') {
/* End of this group; recurse to get next option. */
state = state_next_word;
return cpio_getopt(cpio);
}
if (option->name != NULL) {
option2 = option;
opt = option->val;
/* Does this option take an argument? */
p = strchr(short_options, opt);
if (p == NULL)
return ('?');
if (p[1] == ':')
required = 1;
/* If the first match was exact, we're done. */
if (strncmp(p, option->name, strlen(option->name)) == 0) {
while (option->name != NULL)
option++;
/* If it takes an argument, parse that. */
if (required) {
/* If arg is run-in, opt_word already points to it. */
if (opt_word[0] == '\0') {
/* Otherwise, pick up the next word. */
opt_word = *cpio->argv;
if (opt_word == NULL) {
lafe_warnc(0,
"Option -%c requires an argument",
opt);
return ('?');
}
++cpio->argv;
--cpio->argc;
}
if (opt == 'W') {
state = state_long;
long_prefix = "-W "; /* For clearer errors. */
} else {
/* Check if there's another match. */
option++;
while (option->name != NULL &&
(strlen(option->name) < option_length ||
strncmp(p, option->name, option_length) != 0)) {
option++;
state = state_next_word;
cpio->optarg = opt_word;
}
}
}
/* We're reading a long option, including -W long=arg convention. */
if (state == state_long) {
/* After this long option, we'll be starting a new word. */
state = state_next_word;
/* Option name ends at '=' if there is one. */
p = strchr(opt_word, '=');
if (p != NULL) {
optlength = (size_t)(p - opt_word);
cpio->optarg = (char *)(uintptr_t)(p + 1);
} else {
optlength = strlen(opt_word);
}
/* Search the table for an unambiguous match. */
for (popt = cpio_longopts; popt->name != NULL; popt++) {
/* Short-circuit if first chars don't match. */
if (popt->name[0] != opt_word[0])
continue;
/* If option is a prefix of name in table, record it.*/
if (strncmp(opt_word, popt->name, optlength) == 0) {
match2 = match; /* Record up to two matches. */
match = popt;
/* If it's an exact match, we're done. */
if (strlen(popt->name) == optlength) {
match2 = NULL; /* Forget the others. */
break;
}
}
if (option->name != NULL)
cpio_errc(1, 0,
"Ambiguous option %s "
"(matches both %s and %s)",
p, option2->name, option->name);
if (option2->has_arg == required_argument
&& optarg == NULL)
cpio_errc(1, 0,
"Option \"%s\" requires argument", p);
} else {
opt = '?';
}
/* Fail if there wasn't a unique match. */
if (match == NULL) {
lafe_warnc(0,
"Option %s%s is not supported",
long_prefix, opt_word);
return ('?');
}
if (match2 != NULL) {
lafe_warnc(0,
"Ambiguous option %s%s (matches --%s and --%s)",
long_prefix, opt_word, match->name, match2->name);
return ('?');
}
/* We've found a unique match; does it need an argument? */
if (match->required) {
/* Argument required: get next word if necessary. */
if (cpio->optarg == NULL) {
cpio->optarg = *cpio->argv;
if (cpio->optarg == NULL) {
lafe_warnc(0,
"Option %s%s requires an argument",
long_prefix, match->name);
return ('?');
}
++cpio->argv;
--cpio->argc;
}
} else {
/* Argument forbidden: fail if there is one. */
if (cpio->optarg != NULL) {
lafe_warnc(0,
"Option %s%s does not allow an argument",
long_prefix, match->name);
return ('?');
}
}
return (match->equivalent);
}
return (opt);
@ -182,24 +272,35 @@ cpio_getopt(struct cpio *cpio)
* Parse the argument to the -R or --owner flag.
*
* The format is one of the following:
* <user> - Override user but not group
* <user>: - Override both, group is user's default group
* <user>:<group> - Override both
* :<group> - Override group but not user
* <username|uid> - Override user but not group
* <username>: - Override both, group is user's default group
* <uid>: - Override user but not group
* <username|uid>:<groupname|gid> - Override both
* :<groupname|gid> - Override group but not user
*
* Where uid/gid are decimal representations and groupname/username
* are names to be looked up in system database. Note that we try
* to look up an argument as a name first, then try numeric parsing.
*
* A period can be used instead of the colon.
*
* Sets uid/gid as appropriate, -1 indicates uid/gid not specified.
* Sets uid/gid return as appropriate, -1 indicates uid/gid not specified.
*
* Returns NULL if no error, otherwise returns error string for display.
*
*/
int
const char *
owner_parse(const char *spec, int *uid, int *gid)
{
static char errbuff[128];
const char *u, *ue, *g;
*uid = -1;
*gid = -1;
if (spec[0] == '\0')
return ("Invalid empty user/group spec");
/*
* Split spec into [user][:.][group]
* u -> first char of username, NULL if no username
@ -226,31 +327,43 @@ owner_parse(const char *spec, int *uid, int *gid)
struct passwd *pwent;
user = (char *)malloc(ue - u + 1);
if (user == NULL) {
cpio_warnc(errno, "Couldn't allocate memory");
return (1);
}
if (user == NULL)
return ("Couldn't allocate memory");
memcpy(user, u, ue - u);
user[ue - u] = '\0';
pwent = getpwnam(user);
if (pwent == NULL) {
cpio_warnc(errno, "Couldn't lookup user ``%s''", user);
return (1);
if ((pwent = getpwnam(user)) != NULL) {
*uid = pwent->pw_uid;
if (*ue != '\0')
*gid = pwent->pw_gid;
} else {
char *end;
errno = 0;
*uid = strtoul(user, &end, 10);
if (errno || *end != '\0') {
snprintf(errbuff, sizeof(errbuff),
"Couldn't lookup user ``%s''", user);
errbuff[sizeof(errbuff) - 1] = '\0';
return (errbuff);
}
}
free(user);
*uid = pwent->pw_uid;
if (*ue != '\0' && *g == '\0')
*gid = pwent->pw_gid;
}
if (*g != '\0') {
struct group *grp;
grp = getgrnam(g);
if (grp != NULL)
if ((grp = getgrnam(g)) != NULL) {
*gid = grp->gr_gid;
else {
cpio_warnc(errno, "Couldn't look up group ``%s''", g);
return (1);
} else {
char *end;
errno = 0;
*gid = strtoul(g, &end, 10);
if (errno || *end != '\0') {
snprintf(errbuff, sizeof(errbuff),
"Couldn't lookup group ``%s''", g);
errbuff[sizeof(errbuff) - 1] = '\0';
return (errbuff);
}
}
}
return (0);
return (NULL);
}

View file

@ -0,0 +1,56 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/usr.bin/cpio/config_freebsd.h,v 1.3 2008/12/06 07:30:40 kientzle Exp $
*/
/* A hand-tooled configuration for FreeBSD. */
#include <sys/param.h> /* __FreeBSD_version */
#define HAVE_DIRENT_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_FUTIMES 1
#define HAVE_GRP_H 1
#define HAVE_LIBARCHIVE 1
#define HAVE_LINK 1
#define HAVE_LSTAT 1
#define HAVE_LUTIMES 1
#define HAVE_PWD_H 1
#define HAVE_READLINK 1
#define HAVE_STDARG_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_SYMLINK 1
#define HAVE_SYS_CDEFS_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_TIME_H 1
#define HAVE_UINTMAX_T 1
#define HAVE_UNISTD_H 1
#define HAVE_UNSIGNED_LONG_LONG 1
#define HAVE_UTIME_H 1
#define HAVE_UTIMES 1

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.2 2008/06/21 02:20:20 kientzle Exp $
* $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.7 2008/12/06 07:30:40 kientzle Exp $
*/
#ifndef CPIO_H_INCLUDED
@ -31,7 +31,7 @@
#include "cpio_platform.h"
#include <stdio.h>
#define DEFAULT_BYTES_PER_BLOCK (20*512)
#include "matching.h"
/*
* The internal state for the "cpio" program.
@ -42,8 +42,11 @@
* functions.
*/
struct cpio {
/* Option parsing */
const char *optarg;
/* Options */
char *filename;
const char *filename;
char mode; /* -i -o -p */
char compress; /* -j, -y, or -z */
const char *format; /* -H format */
@ -53,58 +56,54 @@ struct cpio {
int extract_flags; /* Flags for extract operation */
char symlink_mode; /* H or L, per BSD conventions */
const char *compress_program;
char line_separator; /* --null ? '\0' : '\n' */
int option_append; /* -A, only relevant for -o */
int option_atime_restore; /* -a */
int option_follow_links; /* -L */
int option_link; /* -l */
int option_list; /* -t */
char option_null; /* --null */
int option_numeric_uid_gid; /* -n */
int option_rename; /* -r */
char *destdir;
size_t pass_destpath_alloc;
char *pass_destpath;
int uid_override;
int gid_override;
int day_first; /* true if locale prefers day/mon */
/* If >= 0, then close this when done. */
int fd;
/* Miscellaneous state information */
struct archive *archive;
struct archive *archive_read_disk;
int argc;
char **argv;
int return_value; /* Value returned by main() */
struct archive_entry_linkresolver *linkresolver;
struct name_cache *uname_cache;
struct name_cache *gname_cache;
/* Work data. */
struct matching *matching;
struct lafe_matching *matching;
char *buff;
size_t buff_size;
};
/* Name of this program; used in error reporting, initialized in main(). */
const char *cpio_progname;
void cpio_errc(int _eval, int _code, const char *fmt, ...);
void cpio_warnc(int _code, const char *fmt, ...);
int owner_parse(const char *, int *, int *);
const char *owner_parse(const char *, int *, int *);
/* Fake short equivalents for long options that otherwise lack them. */
enum {
OPTION_INSECURE = 1,
OPTION_LZMA,
OPTION_NO_PRESERVE_OWNER,
OPTION_PRESERVE_OWNER,
OPTION_QUIET,
OPTION_VERSION
};
struct line_reader;
struct line_reader *process_lines_init(const char *, char separator);
const char *process_lines_next(struct line_reader *);
void process_lines_free(struct line_reader *);
int cpio_getopt(struct cpio *cpio);
int include_from_file(struct cpio *, const char *);
#endif

View file

@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: src/usr.bin/cpio/cpio_platform.h,v 1.2 2008/12/06 07:15:42 kientzle Exp $
*/
/*
@ -37,19 +37,18 @@
#if defined(PLATFORM_CONFIG_H)
/* Use hand-built config.h in environments that need it. */
#include PLATFORM_CONFIG_H
#elif defined(HAVE_CONFIG_H)
/* Most POSIX platforms use the 'configure' script to build config.h */
#include "../config.h"
#else
/* Warn if cpio hasn't been (automatically or manually) configured. */
#error Oops: No config.h and no built-in configuration in cpio_platform.h.
#endif /* !HAVE_CONFIG_H */
/* Read config.h or die trying. */
#include "config.h"
#endif
/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
#ifdef __FreeBSD__
#include <sys/cdefs.h> /* For __FBSDID */
#else
/* Just leaving this macro replacement empty leads to a dangling semicolon. */
/* Get a real definition for __FBSDID if we can */
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
/* If not, define it so as to avoid dangling semicolons. */
#ifndef __FBSDID
#define __FBSDID(a) struct _undefined_hack
#endif
@ -63,22 +62,16 @@
#include "archive_entry.h"
#endif
/*
* We need to be able to display a filesize using printf(). The type
* and format string here must be compatible with one another and
* large enough for any file.
*/
#if HAVE_UINTMAX_T
#define CPIO_FILESIZE_TYPE uintmax_t
#define CPIO_FILESIZE_PRINTF "%ju"
/* How to mark functions that don't return. */
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
#else
#if HAVE_UNSIGNED_LONG_LONG
#define CPIO_FILESIZE_TYPE unsigned long long
#define CPIO_FILESIZE_PRINTF "%llu"
#else
#define CPIO_FILESIZE_TYPE unsigned long
#define CPIO_FILESIZE_PRINTF "%lu"
#define __LA_DEAD
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "cpio_windows.h"
#endif
#endif /* !CPIO_PLATFORM_H_INCLUDED */

View file

@ -0,0 +1,338 @@
/*-
* Copyright (c) 2009 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "cpio_platform.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <io.h>
#include <stddef.h>
#ifdef HAVE_SYS_UTIME_H
#include <sys/utime.h>
#endif
#include <sys/stat.h>
#include <process.h>
#include <stdlib.h>
#include <wchar.h>
#include <windows.h>
#include <sddl.h>
#include "cpio.h"
#include "err.h"
#define EPOC_TIME (116444736000000000ULL)
static void cpio_dosmaperr(unsigned long);
/*
* Prepend "\\?\" to the path name and convert it to unicode to permit
* an extended-length path for a maximum total path length of 32767
* characters.
* see also http://msdn.microsoft.com/en-us/library/aa365247.aspx
*/
static wchar_t *
permissive_name(const char *name)
{
wchar_t *wn, *wnp;
wchar_t *ws, *wsp;
DWORD l, len, slen, alloclen;
int unc;
len = (DWORD)strlen(name);
wn = malloc((len + 1) * sizeof(wchar_t));
if (wn == NULL)
return (NULL);
l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len);
if (l == 0) {
free(wn);
return (NULL);
}
wn[l] = L'\0';
/* Get a full path names */
l = GetFullPathNameW(wn, 0, NULL, NULL);
if (l == 0) {
free(wn);
return (NULL);
}
wnp = malloc(l * sizeof(wchar_t));
if (wnp == NULL) {
free(wn);
return (NULL);
}
len = GetFullPathNameW(wn, l, wnp, NULL);
free(wn);
wn = wnp;
if (wnp[0] == L'\\' && wnp[1] == L'\\' &&
wnp[2] == L'?' && wnp[3] == L'\\')
/* We have already permissive names. */
return (wn);
if (wnp[0] == L'\\' && wnp[1] == L'\\' &&
wnp[2] == L'.' && wnp[3] == L'\\') {
/* Device names */
if (((wnp[4] >= L'a' && wnp[4] <= L'z') ||
(wnp[4] >= L'A' && wnp[4] <= L'Z')) &&
wnp[5] == L':' && wnp[6] == L'\\')
wnp[2] = L'?';/* Not device names. */
return (wn);
}
unc = 0;
if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') {
wchar_t *p = &wnp[2];
/* Skip server-name letters. */
while (*p != L'\\' && *p != L'\0')
++p;
if (*p == L'\\') {
wchar_t *rp = ++p;
/* Skip share-name letters. */
while (*p != L'\\' && *p != L'\0')
++p;
if (*p == L'\\' && p != rp) {
/* Now, match patterns such as
* "\\server-name\share-name\" */
wnp += 2;
len -= 2;
unc = 1;
}
}
}
alloclen = slen = 4 + (unc * 4) + len + 1;
ws = wsp = malloc(slen * sizeof(wchar_t));
if (ws == NULL) {
free(wn);
return (NULL);
}
/* prepend "\\?\" */
wcsncpy(wsp, L"\\\\?\\", 4);
wsp += 4;
slen -= 4;
if (unc) {
/* append "UNC\" ---> "\\?\UNC\" */
wcsncpy(wsp, L"UNC\\", 4);
wsp += 4;
slen -= 4;
}
wcsncpy(wsp, wnp, slen);
free(wn);
ws[alloclen - 1] = L'\0';
return (ws);
}
static HANDLE
cpio_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
wchar_t *wpath;
HANDLE handle;
handle = CreateFileA(path, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
hTemplateFile);
if (handle != INVALID_HANDLE_VALUE)
return (handle);
if (GetLastError() != ERROR_PATH_NOT_FOUND)
return (handle);
wpath = permissive_name(path);
if (wpath == NULL)
return (handle);
handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
hTemplateFile);
free(wpath);
return (handle);
}
#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10))
static int
__hutimes(HANDLE handle, const struct __timeval *times)
{
ULARGE_INTEGER wintm;
FILETIME fatime, fmtime;
wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec);
fatime.dwLowDateTime = wintm.LowPart;
fatime.dwHighDateTime = wintm.HighPart;
wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec);
fmtime.dwLowDateTime = wintm.LowPart;
fmtime.dwHighDateTime = wintm.HighPart;
if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) {
errno = EINVAL;
return (-1);
}
return (0);
}
int
futimes(int fd, const struct __timeval *times)
{
return (__hutimes((HANDLE)_get_osfhandle(fd), times));
}
int
utimes(const char *name, const struct __timeval *times)
{
int ret;
HANDLE handle;
handle = cpio_CreateFile(name, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (handle == INVALID_HANDLE_VALUE) {
cpio_dosmaperr(GetLastError());
return (-1);
}
ret = __hutimes(handle, times);
CloseHandle(handle);
return (ret);
}
/*
* The following function was modified from PostgreSQL sources and is
* subject to the copyright below.
*/
/*-------------------------------------------------------------------------
*
* win32error.c
* Map win32 error codes to errno values
*
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
PostgreSQL Database Management System
(formerly known as Postgres, then as Postgres95)
Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
Portions Copyright (c) 1994, The Regents of the University of California
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement
is hereby granted, provided that the above copyright notice and this
paragraph and the following two paragraphs appear in all copies.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
static const struct {
DWORD winerr;
int doserr;
} doserrors[] =
{
{ ERROR_INVALID_FUNCTION, EINVAL },
{ ERROR_FILE_NOT_FOUND, ENOENT },
{ ERROR_PATH_NOT_FOUND, ENOENT },
{ ERROR_TOO_MANY_OPEN_FILES, EMFILE },
{ ERROR_ACCESS_DENIED, EACCES },
{ ERROR_INVALID_HANDLE, EBADF },
{ ERROR_ARENA_TRASHED, ENOMEM },
{ ERROR_NOT_ENOUGH_MEMORY, ENOMEM },
{ ERROR_INVALID_BLOCK, ENOMEM },
{ ERROR_BAD_ENVIRONMENT, E2BIG },
{ ERROR_BAD_FORMAT, ENOEXEC },
{ ERROR_INVALID_ACCESS, EINVAL },
{ ERROR_INVALID_DATA, EINVAL },
{ ERROR_INVALID_DRIVE, ENOENT },
{ ERROR_CURRENT_DIRECTORY, EACCES },
{ ERROR_NOT_SAME_DEVICE, EXDEV },
{ ERROR_NO_MORE_FILES, ENOENT },
{ ERROR_LOCK_VIOLATION, EACCES },
{ ERROR_SHARING_VIOLATION, EACCES },
{ ERROR_BAD_NETPATH, ENOENT },
{ ERROR_NETWORK_ACCESS_DENIED, EACCES },
{ ERROR_BAD_NET_NAME, ENOENT },
{ ERROR_FILE_EXISTS, EEXIST },
{ ERROR_CANNOT_MAKE, EACCES },
{ ERROR_FAIL_I24, EACCES },
{ ERROR_INVALID_PARAMETER, EINVAL },
{ ERROR_NO_PROC_SLOTS, EAGAIN },
{ ERROR_DRIVE_LOCKED, EACCES },
{ ERROR_BROKEN_PIPE, EPIPE },
{ ERROR_DISK_FULL, ENOSPC },
{ ERROR_INVALID_TARGET_HANDLE, EBADF },
{ ERROR_INVALID_HANDLE, EINVAL },
{ ERROR_WAIT_NO_CHILDREN, ECHILD },
{ ERROR_CHILD_NOT_COMPLETE, ECHILD },
{ ERROR_DIRECT_ACCESS_HANDLE, EBADF },
{ ERROR_NEGATIVE_SEEK, EINVAL },
{ ERROR_SEEK_ON_DEVICE, EACCES },
{ ERROR_DIR_NOT_EMPTY, ENOTEMPTY },
{ ERROR_NOT_LOCKED, EACCES },
{ ERROR_BAD_PATHNAME, ENOENT },
{ ERROR_MAX_THRDS_REACHED, EAGAIN },
{ ERROR_LOCK_FAILED, EACCES },
{ ERROR_ALREADY_EXISTS, EEXIST },
{ ERROR_FILENAME_EXCED_RANGE, ENOENT },
{ ERROR_NESTING_NOT_ALLOWED, EAGAIN },
{ ERROR_NOT_ENOUGH_QUOTA, ENOMEM }
};
static void
cpio_dosmaperr(unsigned long e)
{
int i;
if (e == 0) {
errno = 0;
return;
}
for (i = 0; i < sizeof(doserrors); i++) {
if (doserrors[i].winerr == e) {
errno = doserrors[i].doserr;
return;
}
}
/* fprintf(stderr, "unrecognized win32 error code: %lu", e); */
errno = EINVAL;
return;
}
#endif

View file

@ -0,0 +1,72 @@
/*-
* Copyright (c) 2009 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef CPIO_WINDOWS_H
#define CPIO_WINDOWS_H 1
#include <io.h>
#include <string.h>
#define getgrgid(id) NULL
#define getgrnam(name) NULL
#define getpwnam(name) NULL
#define getpwuid(id) NULL
#ifdef _MSC_VER
#define snprintf sprintf_s
#define strdup _strdup
#define open _open
#define read _read
#define close _close
#endif
struct passwd {
char *pw_name;
uid_t pw_uid;
gid_t pw_gid;
};
struct group {
char *gr_name;
gid_t gr_gid;
};
struct _timeval64i32 {
time_t tv_sec;
long tv_usec;
};
#define __timeval _timeval64i32
extern int futimes(int fd, const struct __timeval *times);
#ifndef HAVE_FUTIMES
#define HAVE_FUTIMES 1
#endif
extern int utimes(const char *name, const struct __timeval *times);
#ifndef HAVE_UTIMES
#define HAVE_UTIMES 1
#endif
#endif /* CPIO_WINDOWS_H */

View file

@ -0,0 +1,79 @@
############################################
#
# How to build bsdcpio_test
#
############################################
IF(ENABLE_CPIO AND ENABLE_TEST)
SET(bsdcpio_test_SOURCES
../cmdline.c
../../libarchive_fe/err.c
../../libarchive_fe/pathmatch.c
main.c
test.h
test_0.c
test_basic.c
test_cmdline.c
test_format_newc.c
test_gcpio_compat.c
test_option_B_upper.c
test_option_C_upper.c
test_option_J_upper.c
test_option_L_upper.c
test_option_Z_upper.c
test_option_a.c
test_option_c.c
test_option_d.c
test_option_f.c
test_option_help.c
test_option_l.c
test_option_lzma.c
test_option_m.c
test_option_t.c
test_option_u.c
test_option_version.c
test_option_y.c
test_option_z.c
test_owner_parse.c
test_passthrough_dotdot.c
test_passthrough_reverse.c
test_pathmatch.c
)
IF(WIN32 AND NOT CYGWIN)
LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h)
ENDIF(WIN32 AND NOT CYGWIN)
#
# Register target
#
ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES})
SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H)
#
# Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
#
GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
${CMAKE_CURRENT_LIST_FILE} ${bsdcpio_test_SOURCES})
SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR})
# list.h has a line DEFINE_TEST(testname) for every
# test. We can use that to define the tests for cmake by
# defining a DEFINE_TEST macro and reading list.h in.
MACRO (DEFINE_TEST _testname)
ADD_TEST_28(
NAME bsdcpio_${_testname}
COMMAND bsdcpio_test -vv
-p $<TARGET_FILE:bsdcpio>
-r ${CMAKE_CURRENT_SOURCE_DIR}
${_testname})
ENDMACRO (DEFINE_TEST _testname)
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
# Experimental new test handling
ADD_CUSTOM_TARGET(run_bsdcpio_test
COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR})
ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio)
ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test)
ENDIF(ENABLE_CPIO AND ENABLE_TEST)

View file

@ -1,15 +1,20 @@
DEFINE_TEST(test_0)
DEFINE_TEST(test_basic)
DEFINE_TEST(test_cmdline)
DEFINE_TEST(test_format_newc)
DEFINE_TEST(test_gcpio_compat)
DEFINE_TEST(test_option_B)
DEFINE_TEST(test_option_L)
DEFINE_TEST(test_option_B_upper)
DEFINE_TEST(test_option_C_upper)
DEFINE_TEST(test_option_J_upper)
DEFINE_TEST(test_option_L_upper)
DEFINE_TEST(test_option_Z_upper)
DEFINE_TEST(test_option_a)
DEFINE_TEST(test_option_c)
DEFINE_TEST(test_option_d)
DEFINE_TEST(test_option_ell)
DEFINE_TEST(test_option_f)
DEFINE_TEST(test_option_help)
DEFINE_TEST(test_option_l)
DEFINE_TEST(test_option_lzma)
DEFINE_TEST(test_option_m)
DEFINE_TEST(test_option_t)
DEFINE_TEST(test_option_u)
@ -17,4 +22,6 @@ DEFINE_TEST(test_option_version)
DEFINE_TEST(test_option_y)
DEFINE_TEST(test_option_z)
DEFINE_TEST(test_owner_parse)
DEFINE_TEST(test_passthrough_dotdot)
DEFINE_TEST(test_passthrough_reverse)
DEFINE_TEST(test_pathmatch)

File diff suppressed because it is too large Load diff

View file

@ -33,39 +33,95 @@
*/
#if defined(HAVE_CONFIG_H)
/* Most POSIX platforms use the 'configure' script to build config.h */
#include "../../config.h"
#include "config.h"
#elif defined(__FreeBSD__)
/* Building as part of FreeBSD system requires a pre-built config.h. */
#include "../config_freebsd.h"
#elif defined(_WIN32)
#include "config_freebsd.h"
#elif defined(_WIN32) && !defined(__CYGWIN__)
/* Win32 can't run the 'configure' script. */
#include "../config_windows.h"
#include "config_windows.h"
#else
/* Warn if the library hasn't been (automatically or manually) configured. */
#error Oops: No config.h and no pre-built configuration in test.h.
#endif
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h> /* Windows requires this before sys/stat.h */
#include <sys/stat.h>
#ifndef _WIN32
#include <unistd.h>
#endif
#include <wchar.h>
#ifdef USE_DMALLOC
#include <dmalloc.h>
#endif
#if HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_DIRECT_H
#include <direct.h>
#define dirent direct
#endif
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <wchar.h>
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
#ifdef __FreeBSD__
#include <sys/cdefs.h> /* For __FBSDID */
/*
* System-specific tweaks. We really want to minimize these
* as much as possible, since they make it harder to understand
* the mainline code.
*/
/* Windows (including Visual Studio and MinGW but not Cygwin) */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "../cpio_windows.h"
#if !defined(__BORLANDC__)
#define strdup _strdup
#endif
#define LOCALE_DE "deu"
#else
#define __FBSDID(a) /* null */
#define LOCALE_DE "de_DE.UTF-8"
#endif
/* Visual Studio */
#ifdef _MSC_VER
#define snprintf sprintf_s
#endif
/* Cygwin */
#if defined(__CYGWIN__)
/* Cygwin-1.7.x is lazy about populating nlinks, so don't
* expect it to be accurate. */
# define NLINKS_INACCURATE_FOR_DIRS
#endif
/* Haiku OS */
#if defined(__HAIKU__)
/* Haiku has typedefs in stdint.h (needed for int64_t) */
#include <stdint.h>
#endif
/* Get a real definition for __FBSDID if we can */
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
/* If not, define it so as to avoid dangling semicolons. */
#ifndef __FBSDID
#define __FBSDID(a) struct _undefined_hack
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
/*
@ -75,38 +131,81 @@
#define DEFINE_TEST(name) void name(void); void name(void)
/* An implementation of the standard assert() macro */
#define assert(e) test_assert(__FILE__, __LINE__, (e), #e, NULL)
#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL)
/* chdir() and error if it fails */
#define assertChdir(path) \
assertion_chdir(__FILE__, __LINE__, path)
/* Assert two integers are the same. Reports value of each one if not. */
#define assertEqualInt(v1,v2) \
test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
#define assertEqualInt(v1,v2) \
assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
/* Assert two strings are the same. Reports value of each one if not. */
#define assertEqualString(v1,v2) \
test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
/* As above, but v1 and v2 are wchar_t * */
#define assertEqualWString(v1,v2) \
test_assert_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
/* As above, but raw blocks of bytes. */
#define assertEqualMem(v1, v2, l) \
test_assert_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
/* Assert two files are the same; allow printf-style expansion of second name.
* See below for comments about variable arguments here...
*/
#define assertEqualFile \
test_setup(__FILE__, __LINE__);test_assert_equal_file
assertion_setup(__FILE__, __LINE__);assertion_equal_file
/* Assert that a file is empty; supports printf-style arguments. */
#define assertEmptyFile \
test_setup(__FILE__, __LINE__);test_assert_empty_file
assertion_setup(__FILE__, __LINE__);assertion_empty_file
/* Assert that a file is not empty; supports printf-style arguments. */
#define assertNonEmptyFile \
assertion_setup(__FILE__, __LINE__);assertion_non_empty_file
#define assertFileAtime(pathname, sec, nsec) \
assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec)
#define assertFileAtimeRecent(pathname) \
assertion_file_atime_recent(__FILE__, __LINE__, pathname)
#define assertFileBirthtime(pathname, sec, nsec) \
assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec)
#define assertFileBirthtimeRecent(pathname) \
assertion_file_birthtime_recent(__FILE__, __LINE__, pathname)
/* Assert that a file exists; supports printf-style arguments. */
#define assertFileExists \
test_setup(__FILE__, __LINE__);test_assert_file_exists
assertion_setup(__FILE__, __LINE__);assertion_file_exists
/* Assert that a file exists; supports printf-style arguments. */
#define assertFileNotExists \
test_setup(__FILE__, __LINE__);test_assert_file_not_exists
assertion_setup(__FILE__, __LINE__);assertion_file_not_exists
/* Assert that file contents match a string; supports printf-style arguments. */
#define assertFileContents \
test_setup(__FILE__, __LINE__);test_assert_file_contents
assertion_setup(__FILE__, __LINE__);assertion_file_contents
#define assertFileMtime(pathname, sec, nsec) \
assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
#define assertFileMtimeRecent(pathname) \
assertion_file_mtime_recent(__FILE__, __LINE__, pathname)
#define assertFileNLinks(pathname, nlinks) \
assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
#define assertFileSize(pathname, size) \
assertion_file_size(__FILE__, __LINE__, pathname, size)
#define assertTextFileContents \
assertion_setup(__FILE__, __LINE__);assertion_text_file_contents
#define assertIsDir(pathname, mode) \
assertion_is_dir(__FILE__, __LINE__, pathname, mode)
#define assertIsHardlink(path1, path2) \
assertion_is_hardlink(__FILE__, __LINE__, path1, path2)
#define assertIsNotHardlink(path1, path2) \
assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2)
#define assertIsReg(pathname, mode) \
assertion_is_reg(__FILE__, __LINE__, pathname, mode)
#define assertIsSymlink(pathname, contents) \
assertion_is_symlink(__FILE__, __LINE__, pathname, contents)
/* Create a directory, report error if it fails. */
#define assertMakeDir(dirname, mode) \
assertion_make_dir(__FILE__, __LINE__, dirname, mode)
#define assertMakeFile(path, mode, contents) \
assertion_make_file(__FILE__, __LINE__, path, mode, contents)
#define assertMakeHardlink(newfile, oldfile) \
assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile)
#define assertMakeSymlink(newfile, linkto) \
assertion_make_symlink(__FILE__, __LINE__, newfile, linkto)
#define assertUmask(mask) \
assertion_umask(__FILE__, __LINE__, mask)
/*
* This would be simple with C99 variadic macros, but I don't want to
@ -115,26 +214,60 @@
* but effective.
*/
#define skipping \
test_setup(__FILE__, __LINE__);test_skipping
assertion_setup(__FILE__, __LINE__);test_skipping
/* Function declarations. These are defined in test_utility.c. */
void failure(const char *fmt, ...);
void test_setup(const char *, int);
int assertion_assert(const char *, int, int, const char *, void *);
int assertion_chdir(const char *, int, const char *);
int assertion_empty_file(const char *, ...);
int assertion_equal_file(const char *, const char *, ...);
int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *);
int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *);
int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
int assertion_file_atime(const char *, int, const char *, long, long);
int assertion_file_atime_recent(const char *, int, const char *);
int assertion_file_birthtime(const char *, int, const char *, long, long);
int assertion_file_birthtime_recent(const char *, int, const char *);
int assertion_file_contents(const void *, int, const char *, ...);
int assertion_file_exists(const char *, ...);
int assertion_file_mtime(const char *, int, const char *, long, long);
int assertion_file_mtime_recent(const char *, int, const char *);
int assertion_file_nlinks(const char *, int, const char *, int);
int assertion_file_not_exists(const char *, ...);
int assertion_file_size(const char *, int, const char *, long);
int assertion_is_dir(const char *, int, const char *, int);
int assertion_is_hardlink(const char *, int, const char *, const char *);
int assertion_is_not_hardlink(const char *, int, const char *, const char *);
int assertion_is_reg(const char *, int, const char *, int);
int assertion_is_symlink(const char *, int, const char *, const char *);
int assertion_make_dir(const char *, int, const char *, int);
int assertion_make_file(const char *, int, const char *, int, const char *);
int assertion_make_hardlink(const char *, int, const char *newpath, const char *);
int assertion_make_symlink(const char *, int, const char *newpath, const char *);
int assertion_non_empty_file(const char *, ...);
int assertion_text_file_contents(const char *buff, const char *f);
int assertion_umask(const char *, int, int);
void assertion_setup(const char *, int);
void test_skipping(const char *fmt, ...);
int test_assert(const char *, int, int, const char *, void *);
int test_assert_empty_file(const char *, ...);
int test_assert_equal_file(const char *, const char *, ...);
int test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *);
int test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *);
int test_assert_file_contents(const void *, int, const char *, ...);
int test_assert_file_exists(const char *, ...);
int test_assert_file_not_exists(const char *, ...);
/* Like sprintf, then system() */
int systemf(const char * fmt, ...);
/* Delay until time() returns a value after this. */
void sleepUntilAfter(time_t);
/* Return true if this platform can create symlinks. */
int canSymlink(void);
/* Return true if this platform can run the "gzip" program. */
int canGzip(void);
/* Return true if this platform can run the "gunzip" program. */
int canGunzip(void);
/* Suck file into string allocated via malloc(). Call free() when done. */
/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
char *slurpfile(size_t *, const char *fmt, ...);
@ -147,4 +280,7 @@ void extract_reference_file(const char *);
*/
/* Pathname of exe to be tested. */
char *testprog;
const char *testprogfile;
/* Name of exe to use in printf-formatted command strings. */
/* On Windows, this includes leading/trailing quotes. */
const char *testprog;

View file

@ -29,16 +29,21 @@ __FBSDID("$FreeBSD$");
* This first test does basic sanity checks on the environment. For
* most of these, we just exit on failure.
*/
#if !defined(_WIN32) || defined(__CYGWIN__)
#define DEV_NULL "/dev/null"
#else
#define DEV_NULL "NUL"
#endif
DEFINE_TEST(test_0)
{
struct stat st;
failure("File %s does not exist?!", testprog);
if (!assertEqualInt(0, stat(testprog, &st)))
failure("File %s does not exist?!", testprogfile);
if (!assertEqualInt(0, stat(testprogfile, &st)))
exit(1);
failure("%s is not executable?!", testprog);
failure("%s is not executable?!", testprogfile);
if (!assert((st.st_mode & 0111) != 0))
exit(1);
@ -46,9 +51,9 @@ DEFINE_TEST(test_0)
* Try to succesfully run the program; this requires that
* we know some option that will succeed.
*/
if (0 == systemf("%s --version >/dev/null", testprog)) {
if (0 == systemf("%s --version >" DEV_NULL, testprog)) {
/* This worked. */
} else if (0 == systemf("%s -W version >/dev/null", testprog)) {
} else if (0 == systemf("%s -W version >" DEV_NULL, testprog)) {
/* This worked. */
} else {
failure("Unable to successfully run any of the following:\n"

View file

@ -23,71 +23,35 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_basic.c,v 1.4 2008/08/25 06:39:29 kientzle Exp $");
static void
verify_files(const char *target)
verify_files(const char *msg)
{
struct stat st, st2;
char buff[128];
int r;
/*
* Verify unpacked files.
*/
/* Regular file with 2 links. */
r = lstat("file", &st);
failure("Failed to stat file %s/file, errno=%d", target, errno);
assertEqualInt(r, 0);
if (r == 0) {
assert(S_ISREG(st.st_mode));
assertEqualInt(0644, st.st_mode & 0777);
assertEqualInt(10, st.st_size);
failure("file %s/file should have 2 links", target);
assertEqualInt(2, st.st_nlink);
}
assertIsReg("file", 0644);
failure(msg);
assertFileSize("file", 10);
assertFileNLinks("file", 2);
/* Another name for the same file. */
r = lstat("linkfile", &st2);
failure("Failed to stat file %s/linkfile, errno=%d", target, errno);
assertEqualInt(r, 0);
if (r == 0) {
assert(S_ISREG(st2.st_mode));
assertEqualInt(0644, st2.st_mode & 0777);
assertEqualInt(10, st2.st_size);
failure("file %s/linkfile should have 2 links", target);
assertEqualInt(2, st2.st_nlink);
/* Verify that the two are really hardlinked. */
assertEqualInt(st.st_dev, st2.st_dev);
failure("%s/linkfile and %s/file should be hardlinked",
target, target);
assertEqualInt(st.st_ino, st2.st_ino);
}
assertIsHardlink("linkfile", "file");
/* Symlink */
r = lstat("symlink", &st);
failure("Failed to stat file %s/symlink, errno=%d", target, errno);
assertEqualInt(r, 0);
if (r == 0) {
failure("symlink should be a symlink; actual mode is %o",
st.st_mode);
assert(S_ISLNK(st.st_mode));
if (S_ISLNK(st.st_mode)) {
r = readlink("symlink", buff, sizeof(buff));
assertEqualInt(r, 4);
buff[r] = '\0';
assertEqualString(buff, "file");
}
}
if (canSymlink())
assertIsSymlink("symlink", "file");
/* Another file with 1 link and different permissions. */
assertIsReg("file2", 0777);
assertFileSize("file2", 10);
assertFileNLinks("file2", 1);
/* dir */
r = lstat("dir", &st);
if (r == 0) {
assertEqualInt(r, 0);
assert(S_ISDIR(st.st_mode));
assertEqualInt(0775, st.st_mode & 0777);
}
assertIsDir("dir", 0775);
}
static void
@ -98,7 +62,7 @@ basic_cpio(const char *target,
{
int r;
if (!assertEqualInt(0, mkdir(target, 0775)))
if (!assertMakeDir(target, 0775))
return;
/* Use the cpio program to create an archive. */
@ -107,11 +71,11 @@ basic_cpio(const char *target,
failure("Error invoking %s -o %s", testprog, pack_options);
assertEqualInt(r, 0);
chdir(target);
assertChdir(target);
/* Verify stderr. */
failure("Expected: %s, options=%s", se, pack_options);
assertFileContents(se, strlen(se), "pack.err");
assertTextFileContents(se, "pack.err");
/*
* Use cpio to unpack the archive into another directory.
@ -123,11 +87,11 @@ basic_cpio(const char *target,
/* Verify stderr. */
failure("Error invoking %s -i %s in dir %s", testprog, unpack_options, target);
assertFileContents(se, strlen(se), "unpack.err");
assertTextFileContents(se, "unpack.err");
verify_files(target);
verify_files(pack_options);
chdir("..");
assertChdir("..");
}
static void
@ -135,70 +99,75 @@ passthrough(const char *target)
{
int r;
if (!assertEqualInt(0, mkdir(target, 0775)))
if (!assertMakeDir(target, 0775))
return;
/*
* Use cpio passthrough mode to copy files to another directory.
*/
r = systemf("%s -p -W quiet %s <filelist >%s/stdout 2>%s/stderr",
r = systemf("%s -p %s <filelist >%s/stdout 2>%s/stderr",
testprog, target, target, target);
failure("Error invoking %s -p", testprog);
assertEqualInt(r, 0);
chdir(target);
assertChdir(target);
/* Verify stderr. */
failure("Error invoking %s -p in dir %s",
testprog, target);
assertEmptyFile("stderr");
assertTextFileContents("1 block\n", "stderr");
verify_files(target);
chdir("..");
verify_files("passthrough");
assertChdir("..");
}
DEFINE_TEST(test_basic)
{
int fd;
int filelist;
int oldumask;
FILE *filelist;
const char *msg;
oldumask = umask(0);
assertUmask(0);
/*
* Create an assortment of files on disk.
*/
filelist = open("filelist", O_CREAT | O_WRONLY, 0644);
filelist = fopen("filelist", "w");
/* File with 10 bytes content. */
fd = open("file", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(10, write(fd, "123456789", 10));
close(fd);
write(filelist, "file\n", 5);
assertMakeFile("file", 0644, "1234567890");
fprintf(filelist, "file\n");
/* hardlink to above file. */
assertEqualInt(0, link("file", "linkfile"));
write(filelist, "linkfile\n", 9);
assertMakeHardlink("linkfile", "file");
fprintf(filelist, "linkfile\n");
/* Symlink to above file. */
assertEqualInt(0, symlink("file", "symlink"));
write(filelist, "symlink\n", 8);
if (canSymlink()) {
assertMakeSymlink("symlink", "file");
fprintf(filelist, "symlink\n");
}
/* Another file with different permissions. */
assertMakeFile("file2", 0777, "1234567890");
fprintf(filelist, "file2\n");
/* Directory. */
assertEqualInt(0, mkdir("dir", 0775));
write(filelist, "dir\n", 4);
assertMakeDir("dir", 0775);
fprintf(filelist, "dir\n");
/* All done. */
close(filelist);
fclose(filelist);
assertUmask(022);
/* Archive/dearchive with a variety of options. */
basic_cpio("copy", "", "", "1 block\n");
basic_cpio("copy_odc", "--format=odc", "", "1 block\n");
msg = canSymlink() ? "2 blocks\n" : "1 block\n";
basic_cpio("copy", "", "", msg);
basic_cpio("copy_odc", "--format=odc", "", msg);
basic_cpio("copy_newc", "-H newc", "", "2 blocks\n");
basic_cpio("copy_cpio", "-H odc", "", "1 block\n");
basic_cpio("copy_ustar", "-H ustar", "", "7 blocks\n");
basic_cpio("copy_cpio", "-H odc", "", msg);
msg = canSymlink() ? "9 blocks\n" : "8 blocks\n";
basic_cpio("copy_ustar", "-H ustar", "", msg);
/* Copy in one step using -p */
passthrough("passthrough");
umask(oldumask);
}

View file

@ -0,0 +1,107 @@
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
/*
* Test the command-line parsing.
*/
DEFINE_TEST(test_cmdline)
{
FILE *f;
/* Create an empty file. */
f = fopen("empty", "wb");
assert(f != NULL);
fclose(f);
failure("-Q is an invalid option on every cpio program I know of");
assert(0 != systemf("%s -i -Q <empty >1.out 2>1.err", testprog));
assertEmptyFile("1.out");
failure("-f requires an argument");
assert(0 != systemf("%s -if <empty >2.out 2>2.err", testprog));
assertEmptyFile("2.out");
failure("-f requires an argument");
assert(0 != systemf("%s -i -f <empty >3.out 2>3.err", testprog));
assertEmptyFile("3.out");
failure("--format requires an argument");
assert(0 != systemf("%s -i --format <empty >4.out 2>4.err", testprog));
assertEmptyFile("4.out");
failure("--badopt is an invalid option");
assert(0 != systemf("%s -i --badop <empty >5.out 2>5.err", testprog));
assertEmptyFile("5.out");
failure("--badopt is an invalid option");
assert(0 != systemf("%s -i --badopt <empty >6.out 2>6.err", testprog));
assertEmptyFile("6.out");
failure("--n is ambiguous");
assert(0 != systemf("%s -i --n <empty >7.out 2>7.err", testprog));
assertEmptyFile("7.out");
failure("--create forbids an argument");
assert(0 != systemf("%s --create=arg <empty >8.out 2>8.err", testprog));
assertEmptyFile("8.out");
failure("-i with empty input should succeed");
assert(0 == systemf("%s -i <empty >9.out 2>9.err", testprog));
assertEmptyFile("9.out");
failure("-o with empty input should succeed");
assert(0 == systemf("%s -o <empty >10.out 2>10.err", testprog));
failure("-i -p is nonsense");
assert(0 != systemf("%s -i -p <empty >11.out 2>11.err", testprog));
assertEmptyFile("11.out");
failure("-p -i is nonsense");
assert(0 != systemf("%s -p -i <empty >12.out 2>12.err", testprog));
assertEmptyFile("12.out");
failure("-i -o is nonsense");
assert(0 != systemf("%s -i -o <empty >13.out 2>13.err", testprog));
assertEmptyFile("13.out");
failure("-o -i is nonsense");
assert(0 != systemf("%s -o -i <empty >14.out 2>14.err", testprog));
assertEmptyFile("14.out");
failure("-o -p is nonsense");
assert(0 != systemf("%s -o -p <empty >15.out 2>15.err", testprog));
assertEmptyFile("15.out");
failure("-p -o is nonsense");
assert(0 != systemf("%s -p -o <empty >16.out 2>16.err", testprog));
assertEmptyFile("16.out");
failure("-p with empty input should fail");
assert(0 != systemf("%s -p <empty >17.out 2>17.err", testprog));
assertEmptyFile("17.out");
}

View file

@ -23,7 +23,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_format_newc.c,v 1.2 2008/08/22 02:09:10 kientzle Exp $");
/* Number of bytes needed to pad 'n' to multiple of 'block', assuming
* that 'block' is a power of two. This trick can be more easily
* remembered as -n & (block - 1), but many compilers quite reasonably
* warn about "-n" when n is an unsigned value. (~(n) + 1) is the
* same thing, but written in a way that won't offend anyone. */
#define PAD(n, block) ((~(n) + 1) & ((block) - 1))
static int
is_hex(const char *p, size_t l)
@ -63,60 +70,67 @@ from_hex(const char *p, size_t l)
DEFINE_TEST(test_format_newc)
{
int fd, list;
FILE *list;
int r;
int devmajor, devminor, ino, gid;
int uid = -1;
time_t t, t2, now;
char *p, *e;
size_t s;
mode_t oldmask;
size_t s, fs, ns;
oldmask = umask(0);
assertUmask(0);
#if !defined(_WIN32)
uid = getuid();
#endif
/*
* Create an assortment of files.
* TODO: Extend this to cover more filetypes.
*/
list = open("list", O_CREAT | O_WRONLY, 0644);
list = fopen("list", "w");
/* "file1" */
fd = open("file1", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(10, write(fd, "123456789", 10));
close(fd);
assertEqualInt(6, write(list, "file1\n", 6));
assertMakeFile("file1", 0644, "1234567890");
fprintf(list, "file1\n");
/* "hardlink" */
assertEqualInt(0, link("file1", "hardlink"));
assertEqualInt(9, write(list, "hardlink\n", 9));
assertMakeHardlink("hardlink", "file1");
fprintf(list, "hardlink\n");
/* Another hardlink, but this one won't be archived. */
assertEqualInt(0, link("file1", "hardlink2"));
assertMakeHardlink("hardlink2", "file1");
/* "symlink" */
assertEqualInt(0, symlink("file1", "symlink"));
assertEqualInt(8, write(list, "symlink\n", 8));
if (canSymlink()) {
assertMakeSymlink("symlink", "file1");
fprintf(list, "symlink\n");
}
/* "dir" */
assertEqualInt(0, mkdir("dir", 0775));
assertEqualInt(4, write(list, "dir\n", 4));
assertMakeDir("dir", 0775);
fprintf(list, "dir\n");
/* Record some facts about what we just created: */
now = time(NULL); /* They were all created w/in last two seconds. */
/* Use the cpio program to create an archive. */
close(list);
fclose(list);
r = systemf("%s -o --format=newc <list >newc.out 2>newc.err",
testprog);
if (!assertEqualInt(r, 0))
return;
/* Verify that nothing went to stderr. */
assertFileContents("2 blocks\n", 9, "newc.err");
if (canSymlink()) {
assertTextFileContents("2 blocks\n", "newc.err");
} else {
assertTextFileContents("1 block\n", "newc.err");
}
/* Verify that stdout is a well-formed cpio file in "newc" format. */
p = slurpfile(&s, "newc.out");
assertEqualInt(s, 1024);
assertEqualInt(s, canSymlink() ? 1024 : 512);
e = p;
/*
@ -128,8 +142,15 @@ DEFINE_TEST(test_format_newc)
assert(is_hex(e, 110)); /* Entire header is octal digits. */
assertEqualMem(e + 0, "070701", 6); /* Magic */
ino = from_hex(e + 6, 8); /* ino */
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Group members bits and others bits do not work. */
assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
#else
assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */
#endif
if (uid < 0)
uid = from_hex(e + 22, 8);
assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
gid = from_hex(e + 30, 8); /* gid */
assertEqualMem(e + 38, "00000003", 8); /* nlink */
t = from_hex(e + 46, 8); /* mtime */
@ -141,60 +162,81 @@ DEFINE_TEST(test_format_newc)
" first appearance should be empty, so this file size\n"
" field should be zero");
assertEqualInt(0, from_hex(e + 54, 8)); /* File size */
fs = from_hex(e + 54, 8);
fs += PAD(fs, 4);
devmajor = from_hex(e + 62, 8); /* devmajor */
devminor = from_hex(e + 70, 8); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000006", 8); /* Name size */
ns = from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "file1\0", 6); /* Name contents */
/* Since there's another link, no file contents here. */
/* But add in file size so that an error here doesn't cascade. */
e += 116 + from_hex(e + 54, 8) + (3 & -from_hex(e + 54, 8));
/* "symlink" pointing to "file1" */
assert(is_hex(e, 110));
assertEqualMem(e + 0, "070701", 6); /* Magic */
assert(is_hex(e + 6, 8)); /* ino */
assertEqualInt(0xa1ff, from_hex(e + 14, 8)); /* Mode */
assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000001", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000005", 8); /* File size */
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000008", 8); /* Name size */
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "symlink\0\0\0", 10); /* Name contents */
assertEqualMem(e + 120, "file1\0\0\0", 8); /* symlink target */
e += 120 + from_hex(e + 54, 8) + (3 & -from_hex(e + 54, 8));
e += 110 + fs + ns;
if (canSymlink()) {
/* "symlink" pointing to "file1" */
assert(is_hex(e, 110));
assertEqualMem(e + 0, "070701", 6); /* Magic */
assert(is_hex(e + 6, 8)); /* ino */
assertEqualInt(0xa1ff, from_hex(e + 14, 8)); /* Mode */
assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000001", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000005", 8); /* File size */
fs = from_hex(e + 54, 8);
fs += PAD(fs, 4);
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000008", 8); /* Name size */
ns = from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "symlink\0\0\0", 10); /* Name contents */
assertEqualMem(e + 110 + ns, "file1\0\0\0", 8); /* symlink target */
e += 110 + fs + ns;
}
/* "dir" */
assert(is_hex(e, 110));
assertEqualMem(e + 0, "070701", 6); /* Magic */
assert(is_hex(e + 6, 8)); /* ino */
assertEqualInt(0x41fd, from_hex(e + 14, 8)); /* Mode */
assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Group members bits and others bits do not work. */
assertEqualInt(0x41c0, from_hex(e + 14, 8) & 0xffc0); /* Mode */
#else
/* Mode: sgid bit sometimes propagates from parent dirs, ignore it. */
assertEqualInt(040775, from_hex(e + 14, 8) & ~02000);
#endif
assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
#ifndef NLINKS_INACCURATE_FOR_DIRS
assertEqualMem(e + 38, "00000002", 8); /* nlink */
#endif
t2 = from_hex(e + 46, 8); /* mtime */
failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000000", 8); /* File size */
fs = from_hex(e + 54, 8);
fs += PAD(fs, 4);
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000004", 8); /* Name size */
ns = from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "dir\0\0\0", 6); /* Name contents */
e += 116;
/* TODO: Verify other types of entries. */
e += 110 + fs + ns;
/* Hardlink identical to "file1" */
/* Since we only wrote two of the three links to this
@ -203,23 +245,32 @@ DEFINE_TEST(test_format_newc)
assertEqualMem(e + 0, "070701", 6); /* Magic */
failure("If these aren't the same, then the hardlink detection failed to match them.");
assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Group members bits and others bits do not work. */
assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
#else
assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
assertEqualInt(from_hex(e + 22, 8), getuid()); /* uid */
#endif
assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000003", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
fs = from_hex(e + 54, 8);
fs += PAD(fs, 4);
assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
assert(is_hex(e + 78, 8)); /* rdevmajor */
assert(is_hex(e + 86, 8)); /* rdevminor */
assertEqualMem(e + 94, "00000009", 8); /* Name size */
ns = from_hex(e + 94, 8);
ns += PAD(ns + 2, 4);
assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
assertEqualMem(e + 110, "hardlink\0\0", 10); /* Name contents */
assertEqualMem(e + 120, "123456789\0\0\0", 12); /* File contents */
e += 120 + from_hex(e + 54, 8) + (3 & -from_hex(e + 54, 8));
assertEqualMem(e + 110 + ns, "1234567890\0\0", 12); /* File contents */
e += 110 + ns + fs;
/* Last entry is end-of-archive marker. */
assert(is_hex(e, 110));
@ -240,6 +291,4 @@ DEFINE_TEST(test_format_newc)
assertEqualMem(e + 110, "TRAILER!!!\0\0", 12); /* Name */
free(p);
umask(oldmask);
}

View file

@ -23,19 +23,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_gcpio_compat.c,v 1.2 2008/08/22 02:27:06 kientzle Exp $");
static void
unpack_test(const char *from, const char *options, const char *se)
{
struct stat st, st2;
char buff[128];
int r;
/* Create a work dir named after the file we're unpacking. */
assertEqualInt(0, mkdir(from, 0775));
chdir(from);
assertMakeDir(from, 0775);
assertChdir(from);
/*
* Use cpio to unpack the sample archive
@ -48,80 +45,64 @@ unpack_test(const char *from, const char *options, const char *se)
assertEqualInt(r, 0);
/* Verify that nothing went to stderr. */
assertFileContents(se, strlen(se), "unpack.err");
if (canSymlink()) {
failure("Error invoking %s -i %s < %s",
testprog, options, from);
assertTextFileContents(se, "unpack.err");
}
/*
* Verify unpacked files.
*/
/* Regular file with 2 links. */
r = lstat("file", &st);
failure("Failed to stat file %s/file, errno=%d", from, errno);
assertEqualInt(r, 0);
if (r == 0) {
assert(S_ISREG(st.st_mode));
assertEqualInt(0644, st.st_mode & 0777);
failure("file %s/file", from);
assertEqualInt(10, st.st_size);
failure("file %s/file", from);
assertEqualInt(2, st.st_nlink);
}
assertIsReg("file", 0644);
failure("%s", from);
assertFileSize("file", 10);
assertFileSize("linkfile", 10);
failure("%s", from);
assertFileNLinks("file", 2);
/* Another name for the same file. */
r = lstat("linkfile", &st2);
failure("Failed to stat file %s/linkfile, errno=%d", from, errno);
assertEqualInt(r, 0);
if (r == 0) {
assert(S_ISREG(st2.st_mode));
assertEqualInt(0644, st2.st_mode & 0777);
failure("file %s/file", from);
assertEqualInt(10, st2.st_size);
failure("file %s/file", from);
assertEqualInt(2, st2.st_nlink);
failure("file and linkfile should be hardlinked");
assertEqualInt(st.st_dev, st2.st_dev);
failure("file %s/file", from);
assertEqualInt(st.st_ino, st2.st_ino);
}
failure("%s", from);
assertIsHardlink("linkfile", "file");
assertFileSize("file", 10);
assertFileSize("linkfile", 10);
/* Symlink */
r = lstat("symlink", &st);
failure("Failed to stat file %s/symlink, errno=%d", from, errno);
assertEqualInt(r, 0);
if (r == 0) {
failure("symlink should be a symlink; actual mode is %o",
st.st_mode);
assert(S_ISLNK(st.st_mode));
if (S_ISLNK(st.st_mode)) {
r = readlink("symlink", buff, sizeof(buff));
assertEqualInt(r, 4);
buff[r] = '\0';
assertEqualString(buff, "file");
}
}
if (canSymlink())
assertIsSymlink("symlink", "file");
/* dir */
r = lstat("dir", &st);
if (r == 0) {
assertEqualInt(r, 0);
assert(S_ISDIR(st.st_mode));
assertEqualInt(0775, st.st_mode & 0777);
}
assertIsDir("dir", 0775);
chdir("..");
assertChdir("..");
}
DEFINE_TEST(test_gcpio_compat)
{
int oldumask;
oldumask = umask(0);
assertUmask(0);
/* Dearchive sample files with a variety of options. */
unpack_test("test_gcpio_compat_ref.bin", "", "1 block\n");
unpack_test("test_gcpio_compat_ref.crc", "", "2 blocks\n");
unpack_test("test_gcpio_compat_ref.newc", "", "2 blocks\n");
unpack_test("test_gcpio_compat_ref.ustar", "", "7 blocks\n");
umask(oldumask);
if (canSymlink()) {
unpack_test("test_gcpio_compat_ref.bin",
"--no-preserve-owner", "1 block\n");
unpack_test("test_gcpio_compat_ref.crc",
"--no-preserve-owner", "2 blocks\n");
unpack_test("test_gcpio_compat_ref.newc",
"--no-preserve-owner", "2 blocks\n");
/* gcpio-2.9 only reads 6 blocks here */
unpack_test("test_gcpio_compat_ref.ustar",
"--no-preserve-owner", "7 blocks\n");
} else {
unpack_test("test_gcpio_compat_ref_nosym.bin",
"--no-preserve-owner", "1 block\n");
unpack_test("test_gcpio_compat_ref_nosym.crc",
"--no-preserve-owner", "2 blocks\n");
unpack_test("test_gcpio_compat_ref_nosym.newc",
"--no-preserve-owner", "2 blocks\n");
/* gcpio-2.9 only reads 6 blocks here */
unpack_test("test_gcpio_compat_ref_nosym.ustar",
"--no-preserve-owner", "7 blocks\n");
}
}

View file

@ -0,0 +1,52 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_B_upper)
{
struct stat st;
int r;
/*
* Create a file on disk.
*/
assertMakeFile("file", 0644, NULL);
/* Create an archive without -B; this should be 512 bytes. */
r = systemf("echo file | %s -o > small.cpio 2>small.err", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "small.err");
assertEqualInt(0, stat("small.cpio", &st));
assertEqualInt(512, st.st_size);
/* Create an archive with -B; this should be 5120 bytes. */
r = systemf("echo file | %s -oB > large.cpio 2>large.err", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "large.err");
assertEqualInt(0, stat("large.cpio", &st));
assertEqualInt(5120, st.st_size);
}

View file

@ -0,0 +1,62 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_C_upper)
{
int r;
/*
* Create a file on disk.
*/
assertMakeFile("file", 0644, NULL);
/* Create an archive without -C; this should be 512 bytes. */
r = systemf("echo file | %s -o > small.cpio 2>small.err", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "small.err");
assertFileSize("small.cpio", 512);
/* Create an archive with -C 513; this should be 513 bytes. */
r = systemf("echo file | %s -o -C 513 > 513.cpio 2>513.err",
testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "513.err");
assertFileSize("513.cpio", 513);
/* Create an archive with -C 12345; this should be 12345 bytes. */
r = systemf("echo file | %s -o -C12345 > 12345.cpio 2>12345.err",
testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "12345.err");
assertFileSize("12345.cpio", 12345);
/* Create an archive with invalid -C request */
assert(0 != systemf("echo file | %s -o -C > bad.cpio 2>bad.err",
testprog));
assertEmptyFile("bad.cpio");
}

View file

@ -0,0 +1,56 @@
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_J_upper)
{
char *p;
int r;
size_t s;
/* Create a file. */
assertMakeFile("f", 0644, "a");
/* Archive it with xz compression. */
r = systemf("echo f | %s -o -J >archive.out 2>archive.err",
testprog);
p = slurpfile(&s, "archive.err");
p[s] = '\0';
if (r != 0) {
if (strstr(p, "compression not available") != NULL) {
skipping("This version of bsdcpio was compiled "
"without xz support");
return;
}
failure("-J option is broken");
assertEqualInt(r, 0);
return;
}
/* Check that the archive file has an xz signature. */
p = slurpfile(&s, "archive.out");
assert(s > 2);
assertEqualMem(p, "\3757zXZ", 5);
}

View file

@ -0,0 +1,101 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_L.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $");
/* This is a little pointless, as Windows doesn't support symlinks
* (except for the seriously crippled CreateSymbolicLink API) so these
* tests won't run on Windows. */
#if defined(_WIN32) && !defined(__CYGWIN__)
#define CAT "type"
#else
#define CAT "cat"
#endif
DEFINE_TEST(test_option_L_upper)
{
FILE *filelist;
int r;
if (!canSymlink()) {
skipping("Symlink tests");
return;
}
filelist = fopen("filelist", "w");
/* Create a file and a symlink to the file. */
assertMakeFile("file", 0644, "1234567890");
fprintf(filelist, "file\n");
/* Symlink to above file. */
assertMakeSymlink("symlink", "file");
fprintf(filelist, "symlink\n");
fclose(filelist);
r = systemf(CAT " filelist | %s -pd copy >copy.out 2>copy.err", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "copy.err");
failure("Regular -p without -L should preserve symlinks.");
assertIsSymlink("copy/symlink", NULL);
r = systemf(CAT " filelist | %s -pd -L copy-L >copy-L.out 2>copy-L.err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("copy-L.out");
assertTextFileContents("1 block\n", "copy-L.err");
failure("-pdL should dereference symlinks and turn them into files.");
assertIsReg("copy-L/symlink", -1);
r = systemf(CAT " filelist | %s -o >archive.out 2>archive.err", testprog);
failure("Error invoking %s -o ", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "archive.err");
assertMakeDir("unpack", 0755);
assertChdir("unpack");
r = systemf(CAT " ../archive.out | %s -i >unpack.out 2>unpack.err", testprog);
failure("Error invoking %s -i", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "unpack.err");
assertChdir("..");
assertIsSymlink("unpack/symlink", NULL);
r = systemf(CAT " filelist | %s -oL >archive-L.out 2>archive-L.err", testprog);
failure("Error invoking %s -oL", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "archive-L.err");
assertMakeDir("unpack-L", 0755);
assertChdir("unpack-L");
r = systemf(CAT " ../archive-L.out | %s -i >unpack-L.out 2>unpack-L.err", testprog);
failure("Error invoking %s -i < archive-L.out", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "unpack-L.err");
assertChdir("..");
assertIsReg("unpack-L/symlink", -1);
}

View file

@ -0,0 +1,56 @@
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_Z_upper)
{
char *p;
int r;
size_t s;
/* Create a file. */
assertMakeFile("f", 0644, "a");
/* Archive it with compress compression. */
r = systemf("echo f | %s -oZ >archive.out 2>archive.err",
testprog);
p = slurpfile(&s, "archive.err");
p[s] = '\0';
if (r != 0) {
if (strstr(p, "compression not available") != NULL) {
skipping("This version of bsdcpio was compiled "
"without compress support");
return;
}
failure("-Z option is broken");
assertEqualInt(r, 0);
return;
}
/* Check that the archive file has a compress signature. */
p = slurpfile(&s, "archive.out");
assert(s > 2);
assertEqualMem(p, "\x1f\x9d", 2);
}

View file

@ -23,8 +23,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
#if defined(HAVE_UTIME_H)
#include <utime.h>
__FBSDID("$FreeBSD$");
#elif defined(HAVE_SYS_UTIME_H)
#include <sys/utime.h>
#endif
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_a.c,v 1.3 2008/08/24 06:21:00 kientzle Exp $");
static struct {
const char *name;
@ -53,19 +57,15 @@ test_create(void)
struct utimbuf times;
static const int numfiles = sizeof(files) / sizeof(files[0]);
int i;
int fd;
for (i = 0; i < numfiles; ++i) {
fd = open(files[i].name, O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
/*
* Note: Have to write at least one byte to the file.
* cpio doesn't bother reading the file if it's zero length,
* so the atime never gets changed in that case, which
* makes the tests below rather pointless.
*/
assertEqualInt(1, write(fd, "a", 1));
close(fd);
assertMakeFile(files[i].name, 0644, "a");
/* If utime() isn't supported on your platform, just
* #ifdef this section out. Most of the test below is
@ -83,26 +83,21 @@ test_create(void)
}
/* Wait until the atime on the last file is actually in the past. */
/* If utime() is supported above, there's no sleep here which
* makes the test faster. */
while (files[numfiles - 1].atime_sec >= time(NULL))
sleep(1);
sleepUntilAfter(files[numfiles - 1].atime_sec);
}
DEFINE_TEST(test_option_a)
{
struct stat st;
int r;
int f;
char buff[64];
char *p;
/* Create all of the test files. */
test_create();
/* Sanity check; verify that atimes really do get modified. */
f = open(files[0].name, O_RDONLY);
assertEqualInt(1, read(f,buff, 1));
assertEqualInt(0, close(f));
assert((p = slurpfile(NULL, "f0")) != NULL);
free(p);
assertEqualInt(0, stat("f0", &st));
if (st.st_atime == files[0].atime_sec) {
skipping("Cannot verify -a option\n"
@ -118,7 +113,7 @@ DEFINE_TEST(test_option_a)
/* Copy the file without -a; should change the atime. */
r = systemf("echo %s | %s -pd copy-no-a > copy-no-a.out 2>copy-no-a.err", files[1].name, testprog);
assertEqualInt(r, 0);
assertEmptyFile("copy-no-a.err");
assertTextFileContents("1 block\n", "copy-no-a.err");
assertEmptyFile("copy-no-a.out");
assertEqualInt(0, stat(files[1].name, &st));
failure("Copying file without -a should have changed atime.");
@ -127,7 +122,7 @@ DEFINE_TEST(test_option_a)
/* Archive the file without -a; should change the atime. */
r = systemf("echo %s | %s -o > archive-no-a.out 2>archive-no-a.err", files[2].name, testprog);
assertEqualInt(r, 0);
assertEmptyFile("copy-no-a.err");
assertTextFileContents("1 block\n", "copy-no-a.err");
assertEqualInt(0, stat(files[2].name, &st));
failure("Archiving file without -a should have changed atime.");
assert(st.st_atime != files[2].atime_sec);
@ -142,7 +137,7 @@ DEFINE_TEST(test_option_a)
r = systemf("echo %s | %s -pad copy-a > copy-a.out 2>copy-a.err",
files[3].name, testprog);
assertEqualInt(r, 0);
assertEmptyFile("copy-a.err");
assertTextFileContents("1 block\n", "copy-a.err");
assertEmptyFile("copy-a.out");
assertEqualInt(0, stat(files[3].name, &st));
failure("Copying file with -a should not have changed atime.");
@ -152,7 +147,7 @@ DEFINE_TEST(test_option_a)
r = systemf("echo %s | %s -oa > archive-a.out 2>archive-a.err",
files[4].name, testprog);
assertEqualInt(r, 0);
assertEmptyFile("copy-a.err");
assertTextFileContents("1 block\n", "copy-a.err");
assertEqualInt(0, stat(files[4].name, &st));
failure("Archiving file with -a should not have changed atime.");
assertEqualInt(st.st_atime, files[4].atime_sec);

View file

@ -53,44 +53,47 @@ from_octal(const char *p, size_t l)
DEFINE_TEST(test_option_c)
{
int fd, filelist;
FILE *filelist;
int r;
int uid = -1;
int dev, ino, gid;
time_t t, now;
char *p, *e;
size_t s;
mode_t oldmask;
oldmask = umask(0);
assertUmask(0);
#if !defined(_WIN32)
uid = getuid();
#endif
/*
* Create an assortment of files.
* TODO: Extend this to cover more filetypes.
*/
filelist = open("filelist", O_CREAT | O_WRONLY, 0644);
filelist = fopen("filelist", "w");
/* "file" */
fd = open("file", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(10, write(fd, "123456789", 10));
close(fd);
assertEqualInt(5, write(filelist, "file\n", 5));
assertMakeFile("file", 0644, "1234567890");
fprintf(filelist, "file\n");
/* "symlink" */
assertEqualInt(0, symlink("file", "symlink"));
assertEqualInt(8, write(filelist, "symlink\n", 8));
if (canSymlink()) {
assertMakeSymlink("symlink", "file");
fprintf(filelist, "symlink\n");
}
/* "dir" */
assertEqualInt(0, mkdir("dir", 0775));
assertMakeDir("dir", 0775);
/* Record some facts about what we just created: */
now = time(NULL); /* They were all created w/in last two seconds. */
assertEqualInt(4, write(filelist, "dir\n", 4));
fprintf(filelist, "dir\n");
/* Use the cpio program to create an archive. */
close(filelist);
fclose(filelist);
r = systemf("%s -oc <filelist >basic.out 2>basic.err", testprog);
/* Verify that nothing went to stderr. */
assertFileContents("1 block\n", 8, "basic.err");
assertTextFileContents("1 block\n", "basic.err");
/* Assert that the program finished. */
failure("%s -oc crashed", testprog);
@ -114,8 +117,15 @@ DEFINE_TEST(test_option_c)
dev = from_octal(e + 6, 6);
assert(is_octal(e + 12, 6)); /* ino */
ino = from_octal(e + 12, 6);
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Group members bits and others bits do not work. */
assertEqualMem(e + 18, "100666", 6); /* Mode */
#else
assertEqualMem(e + 18, "100644", 6); /* Mode */
assertEqualInt(from_octal(e + 24, 6), getuid()); /* uid */
#endif
if (uid < 0)
uid = from_octal(e + 24, 6);
assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
assert(is_octal(e + 30, 6)); /* gid */
gid = from_octal(e + 30, 6);
assertEqualMem(e + 36, "000001", 6); /* nlink */
@ -128,31 +138,37 @@ DEFINE_TEST(test_option_c)
assertEqualMem(e + 59, "000005", 6); /* Name size */
assertEqualMem(e + 65, "00000000012", 11); /* File size */
assertEqualMem(e + 76, "file\0", 5); /* Name contents */
assertEqualMem(e + 81, "123456789\0", 10); /* File contents */
assertEqualMem(e + 81, "1234567890", 10); /* File contents */
e += 91;
/* Second entry is "symlink" pointing to "file" */
assert(is_octal(e, 76)); /* Entire header is octal digits. */
assertEqualMem(e + 0, "070707", 6); /* Magic */
assertEqualInt(dev, from_octal(e + 6, 6)); /* dev */
assert(dev != from_octal(e + 12, 6)); /* ino */
assertEqualMem(e + 18, "120777", 6); /* Mode */
assertEqualInt(from_octal(e + 24, 6), getuid()); /* uid */
assertEqualInt(gid, from_octal(e + 30, 6)); /* gid */
assertEqualMem(e + 36, "000001", 6); /* nlink */
failure("file entries should have rdev == 0 (dev was 0%o)",
from_octal(e + 6, 6));
assertEqualMem(e + 42, "000000", 6); /* rdev */
t = from_octal(e + 48, 11); /* mtime */
assert(t <= now); /* File wasn't created in future. */
assert(t >= now - 2); /* File was created w/in last 2 secs. */
assertEqualMem(e + 59, "000010", 6); /* Name size */
assertEqualMem(e + 65, "00000000004", 11); /* File size */
assertEqualMem(e + 76, "symlink\0", 8); /* Name contents */
assertEqualMem(e + 84, "file", 4); /* Symlink target. */
e += 88;
/* "symlink" pointing to "file" */
if (canSymlink()) {
assert(is_octal(e, 76)); /* Entire header is octal digits. */
assertEqualMem(e + 0, "070707", 6); /* Magic */
assertEqualInt(dev, from_octal(e + 6, 6)); /* dev */
assert(ino != from_octal(e + 12, 6)); /* ino */
#if !defined(_WIN32) || defined(__CYGWIN__)
/* On Windows, symbolic link and group members bits and
* others bits do not work. */
assertEqualMem(e + 18, "120777", 6); /* Mode */
#endif
assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
assertEqualInt(gid, from_octal(e + 30, 6)); /* gid */
assertEqualMem(e + 36, "000001", 6); /* nlink */
failure("file entries should have rdev == 0 (dev was 0%o)",
from_octal(e + 6, 6));
assertEqualMem(e + 42, "000000", 6); /* rdev */
t = from_octal(e + 48, 11); /* mtime */
assert(t <= now); /* File wasn't created in future. */
assert(t >= now - 2); /* File was created w/in last 2 secs. */
assertEqualMem(e + 59, "000010", 6); /* Name size */
assertEqualMem(e + 65, "00000000004", 11); /* File size */
assertEqualMem(e + 76, "symlink\0", 8); /* Name contents */
assertEqualMem(e + 84, "file", 4); /* Symlink target. */
e += 88;
}
/* Second entry is "dir" */
/* "dir" */
assert(is_octal(e, 76));
assertEqualMem(e + 0, "070707", 6); /* Magic */
/* Dev should be same as first entry. */
@ -161,12 +177,21 @@ DEFINE_TEST(test_option_c)
/* Ino must be different from first entry. */
assert(is_octal(e + 12, 6)); /* ino */
assert(dev != from_octal(e + 12, 6));
assertEqualMem(e + 18, "040775", 6); /* Mode */
assertEqualInt(from_octal(e + 24, 6), getuid()); /* uid */
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Group members bits and others bits do not work. */
assertEqualMem(e + 18, "040777", 6); /* Mode */
#else
/* Accept 042775 to accomodate systems where sgid bit propagates. */
if (memcmp(e + 18, "042775", 6) != 0)
assertEqualMem(e + 18, "040775", 6); /* Mode */
#endif
assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
/* Gid should be same as first entry. */
assert(is_octal(e + 30, 6)); /* gid */
assertEqualInt(gid, from_octal(e + 30, 6));
#ifndef NLINKS_INACCURATE_FOR_DIRS
assertEqualMem(e + 36, "000002", 6); /* Nlink */
#endif
t = from_octal(e + 48, 11); /* mtime */
assert(t <= now); /* File wasn't created in future. */
assert(t >= now - 2); /* File was created w/in last 2 secs. */
@ -193,6 +218,4 @@ DEFINE_TEST(test_option_c)
assertEqualMem(e + 76, "TRAILER!!!\0", 11); /* Name */
free(p);
umask(oldmask);
}

View file

@ -28,41 +28,37 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_d)
{
struct stat st;
int r, fd;
int r;
/*
* Create a file in a directory.
*/
assertEqualInt(0, mkdir("dir", 0755));
fd = open("dir/file", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
close(fd);
assertMakeDir("dir", 0755);
assertMakeFile("dir/file", 0644, NULL);
/* Create an archive. */
r = systemf("echo dir/file | %s -o > archive.cpio 2>archive.err", testprog);
assertEqualInt(r, 0);
assertFileContents("1 block\n", 8, "archive.err");
assertEqualInt(0, stat("archive.cpio", &st));
assertEqualInt(512, st.st_size);
assertTextFileContents("1 block\n", "archive.err");
assertFileSize("archive.cpio", 512);
/* Dearchive without -d, this should fail. */
assertEqualInt(0, mkdir("without-d", 0755));
assertEqualInt(0, chdir("without-d"));
assertMakeDir("without-d", 0755);
assertChdir("without-d");
r = systemf("%s -i < ../archive.cpio >out 2>err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("out");
/* And the file should not be restored. */
assert(0 != stat("dir/file", &st));
assertFileNotExists("dir/file");
/* Dearchive with -d, this should succeed. */
assertEqualInt(0, chdir(".."));
assertEqualInt(0, mkdir("with-d", 0755));
assertEqualInt(0, chdir("with-d"));
assertChdir("..");
assertMakeDir("with-d", 0755);
assertChdir("with-d");
r = systemf("%s -id < ../archive.cpio >out 2>err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("out");
assertFileContents("1 block\n", 8, "err");
assertTextFileContents("1 block\n", "err");
/* And the file should be restored. */
assertEqualInt(0, stat("dir/file", &st));
assertFileExists("dir/file");
}

View file

@ -33,34 +33,44 @@ unpack(const char *dirname, const char *option)
{
int r;
assertEqualInt(0, mkdir(dirname, 0755));
assertEqualInt(0, chdir(dirname));
assertMakeDir(dirname, 0755);
assertChdir(dirname);
extract_reference_file("test_option_f.cpio");
r = systemf("%s -i %s < test_option_f.cpio > copy-no-a.out 2>copy-no-a.err", testprog, option);
assertEqualInt(0, r);
assertEqualInt(0, chdir(".."));
assertChdir("..");
}
DEFINE_TEST(test_option_f)
{
/* Calibrate: No -f option, so everything should be extracted. */
unpack("t0", "");
assertEqualInt(0, access("t0/a123", F_OK));
assertEqualInt(0, access("t0/a234", F_OK));
assertEqualInt(0, access("t0/b123", F_OK));
assertEqualInt(0, access("t0/b234", F_OK));
unpack("t0", "--no-preserve-owner");
assertFileExists("t0/a123");
assertFileExists("t0/a234");
assertFileExists("t0/b123");
assertFileExists("t0/b234");
/* Don't extract 'a*' files. */
unpack("t1", "-f 'a*'");
assert(0 != access("t1/a123", F_OK));
assert(0 != access("t1/a234", F_OK));
assertEqualInt(0, access("t1/b123", F_OK));
assertEqualInt(0, access("t1/b234", F_OK));
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Single quotes isn't used by command.exe. */
unpack("t1", "--no-preserve-owner -f a*");
#else
unpack("t1", "--no-preserve-owner -f 'a*'");
#endif
assertFileNotExists("t1/a123");
assertFileNotExists("t1/a234");
assertFileExists("t1/b123");
assertFileExists("t1/b234");
/* Don't extract 'b*' files. */
unpack("t2", "-f 'b*'");
assertEqualInt(0, access("t2/a123", F_OK));
assertEqualInt(0, access("t2/a234", F_OK));
assert(0 != access("t2/b123", F_OK));
assert(0 != access("t2/b234", F_OK));
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Single quotes isn't used by command.exe. */
unpack("t2", "--no-preserve-owner -f b*");
#else
unpack("t2", "--no-preserve-owner -f 'b*'");
#endif
assertFileExists("t2/a123");
assertFileExists("t2/a234");
assertFileNotExists("t2/b123");
assertFileNotExists("t2/b234");
}

View file

@ -51,6 +51,7 @@ DEFINE_TEST(test_option_help)
/* Exercise --help option. */
r = systemf("%s --help >help.stdout 2>help.stderr", testprog);
assertEqualInt(r, 0);
failure("--help should generate nothing to stderr.");
assertEmptyFile("help.stderr");
/* Help message should start with name of program. */
@ -67,6 +68,7 @@ DEFINE_TEST(test_option_help)
/* -h option should generate the same output. */
r = systemf("%s -h >h.stdout 2>h.stderr", testprog);
assertEqualInt(r, 0);
failure("-h should generate nothing to stderr.");
assertEmptyFile("h.stderr");
failure("stdout should be same for -h and --help");
@ -74,6 +76,7 @@ DEFINE_TEST(test_option_help)
/* -W help should be another synonym. */
r = systemf("%s -W help >Whelp.stdout 2>Whelp.stderr", testprog);
assertEqualInt(r, 0);
failure("-W help should generate nothing to stderr.");
assertEmptyFile("Whelp.stderr");
failure("stdout should be same for -W help and --help");

View file

@ -0,0 +1,50 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_l)
{
int r;
/* Create a file. */
assertMakeFile("f", 0644, "a");
/* Copy the file to the "copy" dir. */
r = systemf("echo f | %s -pd copy >copy.out 2>copy.err",
testprog);
assertEqualInt(r, 0);
/* Check that the copy is a true copy and not a link. */
assertIsNotHardlink("f", "copy/f");
/* Copy the file to the "link" dir with the -l option. */
r = systemf("echo f | %s -pld link >link.out 2>link.err",
testprog);
assertEqualInt(r, 0);
/* Check that this is a link and not a copy. */
assertIsHardlink("f", "link/f");
}

View file

@ -0,0 +1,56 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_lzma)
{
char *p;
int r;
size_t s;
/* Create a file. */
assertMakeFile("f", 0644, "a");
/* Archive it with lzma compression. */
r = systemf("echo f | %s -o --lzma >archive.out 2>archive.err",
testprog);
p = slurpfile(&s, "archive.err");
p[s] = '\0';
if (r != 0) {
if (strstr(p, "compression not available") != NULL) {
skipping("This version of bsdcpio was compiled "
"without lzma support");
return;
}
failure("--lzma option is broken");
assertEqualInt(r, 0);
return;
}
/* Check that the archive file has an lzma signature. */
p = slurpfile(&s, "archive.out");
assert(s > 2);
assertEqualMem(p, "\x5d\00\00", 3);
}

View file

@ -28,9 +28,7 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_m)
{
struct stat st;
int r;
time_t now;
/*
* The reference archive has one file with an mtime in 1970, 1
@ -38,33 +36,28 @@ DEFINE_TEST(test_option_m)
*/
/* Restored without -m, the result should have a current mtime. */
assertEqualInt(0, mkdir("without-m", 0755));
assertEqualInt(0, chdir("without-m"));
assertMakeDir("without-m", 0755);
assertChdir("without-m");
extract_reference_file("test_option_m.cpio");
r = systemf("%s -i < test_option_m.cpio >out 2>err", testprog);
now = time(NULL);
r = systemf("%s --no-preserve-owner -i < test_option_m.cpio >out 2>err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("out");
assertFileContents("1 block\n", 8, "err");
assertEqualInt(0, stat("file", &st));
assertTextFileContents("1 block\n", "err");
/* Should have been created within the last few seconds. */
assert(st.st_mtime <= now);
assert(st.st_mtime > now - 5);
assertFileMtimeRecent("file");
/* With -m, it should have an mtime in 1970. */
assertEqualInt(0, chdir(".."));
assertEqualInt(0, mkdir("with-m", 0755));
assertEqualInt(0, chdir("with-m"));
assertChdir("..");
assertMakeDir("with-m", 0755);
assertChdir("with-m");
extract_reference_file("test_option_m.cpio");
r = systemf("%s -im < test_option_m.cpio >out 2>err", testprog);
now = time(NULL);
r = systemf("%s --no-preserve-owner -im < test_option_m.cpio >out 2>err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("out");
assertFileContents("1 block\n", 8, "err");
assertEqualInt(0, stat("file", &st));
assertTextFileContents("1 block\n", "err");
/*
* mtime in reference archive is '1' == 1 second after
* midnight Jan 1, 1970 UTC.
*/
assertEqualInt(1, st.st_mtime);
assertFileMtime("file", 1, 0);
}

View file

@ -28,20 +28,68 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_t)
{
char *p;
int r;
/* List reference archive, make sure the TOC is correct. */
extract_reference_file("test_option_t.cpio");
r = systemf("%s -it < test_option_t.cpio >t.out 2>t.err", testprog);
r = systemf("%s -it < test_option_t.cpio >it.out 2>it.err", testprog);
assertEqualInt(r, 0);
assertFileContents("1 block\n", 8, "t.err");
assertTextFileContents("1 block\n", "it.err");
extract_reference_file("test_option_t.stdout");
assertEqualFile("t.out", "test_option_t.stdout");
p = slurpfile(NULL, "test_option_t.stdout");
assertTextFileContents(p, "it.out");
free(p);
/* We accept plain "-t" as a synonym for "-it" */
r = systemf("%s -t < test_option_t.cpio >t.out 2>t.err", testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "t.err");
extract_reference_file("test_option_t.stdout");
p = slurpfile(NULL, "test_option_t.stdout");
assertTextFileContents(p, "t.out");
free(p);
/* But "-ot" is an error. */
assert(0 != systemf("%s -ot < test_option_t.cpio >ot.out 2>ot.err",
testprog));
assertEmptyFile("ot.out");
/* List reference archive verbosely, make sure the TOC is correct. */
r = systemf("%s -itv < test_option_t.cpio >tv.out 2>tv.err", testprog);
assertEqualInt(r, 0);
assertFileContents("1 block\n", 8, "tv.err");
assertTextFileContents("1 block\n", "tv.err");
extract_reference_file("test_option_tv.stdout");
assertEqualFile("tv.out", "test_option_tv.stdout");
/* This doesn't work because the usernames on different systems
* are different and cpio now looks up numeric UIDs on
* the local system. */
/* assertEqualFile("tv.out", "test_option_tv.stdout"); */
/* List reference archive with numeric IDs, verify TOC is correct. */
r = systemf("%s -itnv < test_option_t.cpio >itnv.out 2>itnv.err",
testprog);
assertEqualInt(r, 0);
assertTextFileContents("1 block\n", "itnv.err");
p = slurpfile(NULL, "itnv.out");
/* Since -n uses numeric UID/GID, this part should be the
* same on every system. */
assertEqualMem(p, "-rw-r--r-- 1 1000 1000 0 ",42);
/* Date varies depending on local timezone. */
if (memcmp(p + 42, "Dec 31 1969", 12) == 0) {
/* East of Greenwich we get Dec 31, 1969. */
} else {
/* West of Greenwich get Jan 1, 1970 */
assertEqualMem(p + 42, "Jan ", 4);
/* Some systems format "Jan 01", some "Jan 1" */
assert(p[46] == ' ' || p[46] == '0');
assertEqualMem(p + 47, "1 1970 ", 8);
}
assertEqualMem(p + 54, " file", 5);
free(p);
/* But "-n" without "-t" is an error. */
assert(0 != systemf("%s -in < test_option_t.cpio >in.out 2>in.err",
testprog));
assertEmptyFile("in.out");
}

View file

@ -1,5 +1,6 @@
$FreeBSD$
$FreeBSD: src/usr.bin/cpio/test/test_option_tv.stdout.uu,v 1.2 2008/11/29 20:22:02 kientzle Exp $
begin 644 test_option_tv.stdout
G+7)W+7(M+7(M+2`@(#$@("`H;G5L;"D@("AN=6QL*2`P(&9I;&4*
M+7)W+7(M+7(M+2`@(#$@=&EM("`@("`@=&EM("`@("`@("`@("`@(#`@1&5C
/(#,Q("`Q.38Y(&9I;&4*
`
end

View file

@ -23,7 +23,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
#if defined(HAVE_UTIME_H)
#include <utime.h>
#elif defined(HAVE_SYS_UTIME_H)
#include <sys/utime.h>
#endif
__FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_u)
@ -31,14 +35,10 @@ DEFINE_TEST(test_option_u)
struct utimbuf times;
char *p;
size_t s;
int fd;
int r;
/* Create a file. */
fd = open("f", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(1, write(fd, "a", 1));
close(fd);
assertMakeFile("f", 0644, "a");
/* Copy the file to the "copy" dir. */
r = systemf("echo f | %s -pd copy >copy.out 2>copy.err",
@ -51,10 +51,7 @@ DEFINE_TEST(test_option_u)
assertEqualMem(p, "a", 1);
/* Recreate the file with a single "b" */
fd = open("f", O_CREAT | O_TRUNC | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(1, write(fd, "b", 1));
close(fd);
assertMakeFile("f", 0644, "b");
/* Set the mtime to the distant past. */
memset(&times, 0, sizeof(times));

View file

@ -74,10 +74,14 @@ verify(const char *p, size_t s)
/* Skip a single trailing a,b,c, or d. */
if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
++q;
/* All terminated by a newline. */
/* All terminated by end-of-line: \r, \r\n, or \n */
assert(s >= 1);
failure("Version: %s", p);
assertEqualMem(q, "\n", 1);
if (*q == '\x0d') {
if (q[1] != '\0')
assertEqualMem(q, "\x0d\x0a", 2);
} else
assertEqualMem(q, "\x0a", 1);
}

View file

@ -23,30 +23,35 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD$");
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_y.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $");
DEFINE_TEST(test_option_y)
{
char *p;
int fd;
int r;
size_t s;
/* Create a file. */
fd = open("f", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(1, write(fd, "a", 1));
close(fd);
assertMakeFile("f", 0644, "a");
/* Archive it with bzip2 compression. */
r = systemf("echo f | %s -oy >archive.out 2>archive.err",
testprog);
assertFileContents("1 block\n", 8, "archive.err");
failure("-y (bzip) option seems to be broken");
if (assertEqualInt(r, 0)) {
/* Check that the archive file has a bzip2 signature. */
p = slurpfile(&s, "archive.out");
assert(s > 2);
assertEqualMem(p, "BZh9", 4);
p = slurpfile(&s, "archive.err");
p[s] = '\0';
if (r != 0) {
if (strstr(p, "compression not available") != NULL) {
skipping("This version of bsdcpio was compiled "
"without bzip2 support");
return;
}
failure("-y option is broken");
assertEqualInt(r, 0);
return;
}
assertTextFileContents("1 block\n", "archive.err");
/* Check that the archive file has a bzip2 signature. */
p = slurpfile(&s, "archive.out");
assert(s > 2);
assertEqualMem(p, "BZh9", 4);
}

View file

@ -28,25 +28,29 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_z)
{
char *p;
int fd;
int r;
size_t s;
/* Create a file. */
fd = open("f", O_CREAT | O_WRONLY, 0644);
assert(fd >= 0);
assertEqualInt(1, write(fd, "a", 1));
close(fd);
assertMakeFile("f", 0644, "a");
/* Archive it with gzip compression. */
r = systemf("echo f | %s -oz >archive.out 2>archive.err",
testprog);
failure("-z option seems to be broken");
assertEqualInt(r, 0);
if (r == 0) {
/* Check that the archive file has a gzip signature. */
p = slurpfile(&s, "archive.out");
assert(s > 2);
assertEqualMem(p, "\x1f\x8b\x08\x00", 4);
p = slurpfile(&s, "archive.err");
p[s] = '\0';
if (r != 0) {
if (strstr(p, "compression not available") != NULL) {
skipping("This version of bsdcpio was compiled "
"without gzip support");
return;
}
failure("-z option is broken");
assertEqualInt(r, 0);
return;
}
/* Check that the archive file has a gzip signature. */
p = slurpfile(&s, "archive.out");
assert(s > 4);
assertEqualMem(p, "\x1f\x8b\x08\x00", 4);
}

View file

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,25 +26,86 @@
__FBSDID("$FreeBSD$");
#include "../cpio.h"
#include "err.h"
#if !defined(_WIN32)
#define ROOT "root"
static int root_uids[] = { 0 };
static int root_gids[] = { 0 };
#elif defined(__CYGWIN__)
/* On cygwin, the Administrator user most likely exists (unless
* it has been renamed or is in a non-English localization), but
* its primary group membership depends on how the user set up
* their /etc/passwd. Likely values are 513 (None), 545 (Users),
* or 544 (Administrators). Just check for one of those...
* TODO: Handle non-English localizations...e.g. French 'Administrateur'
* Use CreateWellKnownSID() and LookupAccountName()?
*/
#define ROOT "Administrator"
static int root_uids[] = { 500 };
static int root_gids[] = { 513, 545, 544 };
#endif
#if defined(ROOT)
static int
int_in_list(int i, int *l, size_t n)
{
while (n-- > 0)
if (*l++ == i)
return (1);
failure("%d", i);
return (0);
}
#endif
DEFINE_TEST(test_owner_parse)
{
#if !defined(ROOT)
skipping("No uid/gid configuration for this OS");
#else
int uid, gid;
cpio_progname = "Ignore this message";
assertEqualInt(0, owner_parse("root", &uid, &gid));
assertEqualInt(0, uid);
assert(NULL == owner_parse(ROOT, &uid, &gid));
assert(int_in_list(uid, root_uids,
sizeof(root_uids)/sizeof(root_uids[0])));
assertEqualInt(-1, gid);
assertEqualInt(0, owner_parse("root:", &uid, &gid));
assertEqualInt(0, uid);
assertEqualInt(0, gid);
assert(NULL == owner_parse(ROOT ":", &uid, &gid));
assert(int_in_list(uid, root_uids,
sizeof(root_uids)/sizeof(root_uids[0])));
assert(int_in_list(gid, root_gids,
sizeof(root_gids)/sizeof(root_gids[0])));
assertEqualInt(0, owner_parse("root.", &uid, &gid));
assertEqualInt(0, uid);
assertEqualInt(0, gid);
assert(NULL == owner_parse(ROOT ".", &uid, &gid));
assert(int_in_list(uid, root_uids,
sizeof(root_uids)/sizeof(root_uids[0])));
assert(int_in_list(gid, root_gids,
sizeof(root_gids)/sizeof(root_gids[0])));
assert(NULL == owner_parse("111", &uid, &gid));
assertEqualInt(111, uid);
assertEqualInt(-1, gid);
assert(NULL == owner_parse("112:", &uid, &gid));
assertEqualInt(112, uid);
/* Can't assert gid, since we don't know gid for user #112. */
assert(NULL == owner_parse("113.", &uid, &gid));
assertEqualInt(113, uid);
/* Can't assert gid, since we don't know gid for user #113. */
assert(NULL == owner_parse(":114", &uid, &gid));
assertEqualInt(-1, uid);
assertEqualInt(114, gid);
assert(NULL == owner_parse(".115", &uid, &gid));
assertEqualInt(-1, uid);
assertEqualInt(115, gid);
assert(NULL == owner_parse("116:117", &uid, &gid));
assertEqualInt(116, uid);
assertEqualInt(117, gid);
/*
* TODO: Lookup current user/group name, build strings and
@ -52,17 +113,9 @@ DEFINE_TEST(test_owner_parse)
* users.
*/
/*
* TODO: Rework owner_parse to either return a char * pointing
* to an error message or accept a function pointer to an
* error-reporting routine so that the following tests don't
* generate any output.
*
* Alternatively, redirect stderr temporarily to suppress the output.
*/
assertEqualInt(1, owner_parse(":nonexistentgroup", &uid, &gid));
assertEqualInt(1, owner_parse("root:nonexistentgroup", &uid, &gid));
assertEqualInt(1,
assert(NULL != owner_parse(":nonexistentgroup", &uid, &gid));
assert(NULL != owner_parse(ROOT ":nonexistentgroup", &uid, &gid));
assert(NULL !=
owner_parse("nonexistentuser:nonexistentgroup", &uid, &gid));
#endif
}

View file

@ -0,0 +1,76 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_dotdot.c,v 1.4 2008/08/24 06:21:00 kientzle Exp $");
/*
* Verify that "cpio -p .." works.
*/
DEFINE_TEST(test_passthrough_dotdot)
{
int r;
FILE *filelist;
assertUmask(0);
/*
* Create an assortment of files on disk.
*/
filelist = fopen("filelist", "w");
/* Directory. */
assertMakeDir("dir", 0755);
assertChdir("dir");
fprintf(filelist, ".\n");
/* File with 10 bytes content. */
assertMakeFile("file", 0642, "1234567890");
fprintf(filelist, "file\n");
/* All done. */
fclose(filelist);
/*
* Use cpio passthrough mode to copy files to another directory.
*/
r = systemf("%s -pdvm .. <../filelist >../stdout 2>../stderr",
testprog);
failure("Error invoking %s -pd ..", testprog);
assertEqualInt(r, 0);
assertChdir("..");
/* Verify stderr and stdout. */
assertTextFileContents("../.\n../file\n1 block\n", "stderr");
assertEmptyFile("stdout");
/* Regular file. */
assertIsReg("file", 0642);
assertFileSize("file", 10);
assertFileNLinks("file", 1);
}

View file

@ -0,0 +1,85 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_reverse.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $");
/*
* As reported by Bernd Walter: Some people are in the habit of
* using "find -d" to generate a list for cpio -p because that
* copies the top-level dir last, which preserves owner and mode
* information. That's not necessary for bsdcpio (libarchive defers
* restoring directory information), but bsdcpio should still generate
* the correct results with this usage.
*/
DEFINE_TEST(test_passthrough_reverse)
{
int r;
FILE *filelist;
assertUmask(0);
/*
* Create an assortment of files on disk.
*/
filelist = fopen("filelist", "w");
/* Directory. */
assertMakeDir("dir", 0743);
/* File with 10 bytes content. */
assertMakeFile("dir/file", 0644, "1234567890");
fprintf(filelist, "dir/file\n");
/* Write dir last. */
fprintf(filelist, "dir\n");
/* All done. */
fclose(filelist);
/*
* Use cpio passthrough mode to copy files to another directory.
*/
r = systemf("%s -pdvm out <filelist >stdout 2>stderr", testprog);
failure("Error invoking %s -pd out", testprog);
assertEqualInt(r, 0);
assertChdir("out");
/* Verify stderr and stdout. */
assertTextFileContents("out/dir/file\nout/dir\n1 block\n",
"../stderr");
assertEmptyFile("../stdout");
/* dir */
assertIsDir("dir", 0743);
/* Regular file. */
assertIsReg("dir/file", 0644);
assertFileSize("dir/file", 10);
assertFileNLinks("dir/file", 1);
}

View file

@ -25,7 +25,7 @@
#include "test.h"
__FBSDID("$FreeBSD$");
#include "../pathmatch.h"
#include "pathmatch.h"
/*
* Verify that the pattern matcher implements the wildcard logic specified
@ -38,128 +38,206 @@ __FBSDID("$FreeBSD$");
*
* The specification in SUSv2 is a bit incomplete, I assume the following:
* Trailing '-' in [...] is not special.
*
* TODO: Figure out if there's a good way to extend this to handle
* Windows paths that use '\' as a path separator. <sigh>
*/
DEFINE_TEST(test_pathmatch)
{
assertEqualInt(1, pathmatch("*","", 0));
assertEqualInt(1, pathmatch("*","a", 0));
assertEqualInt(1, pathmatch("*","abcd", 0));
assertEqualInt(1, lafe_pathmatch("a/b/c", "a/b/c", 0));
assertEqualInt(0, lafe_pathmatch("a/b/", "a/b/c", 0));
assertEqualInt(0, lafe_pathmatch("a/b", "a/b/c", 0));
assertEqualInt(0, lafe_pathmatch("a/b/c", "a/b/", 0));
assertEqualInt(0, lafe_pathmatch("a/b/c", "a/b", 0));
/* Empty pattern only matches empty string. */
assertEqualInt(1, lafe_pathmatch("","", 0));
assertEqualInt(0, lafe_pathmatch("","a", 0));
assertEqualInt(1, lafe_pathmatch("*","", 0));
assertEqualInt(1, lafe_pathmatch("*","a", 0));
assertEqualInt(1, lafe_pathmatch("*","abcd", 0));
/* SUSv2: * matches / */
assertEqualInt(1, pathmatch("*","abcd/efgh/ijkl", 0));
assertEqualInt(1, pathmatch("abcd*efgh/ijkl","abcd/efgh/ijkl", 0));
assertEqualInt(1, pathmatch("abcd***efgh/ijkl","abcd/efgh/ijkl", 0));
assertEqualInt(1, pathmatch("abcd***/efgh/ijkl","abcd/efgh/ijkl", 0));
assertEqualInt(0, pathmatch("?", "", 0));
assertEqualInt(0, pathmatch("?", "\0", 0));
assertEqualInt(1, pathmatch("?", "a", 0));
assertEqualInt(0, pathmatch("?", "ab", 0));
assertEqualInt(1, pathmatch("?", ".", 0));
assertEqualInt(1, pathmatch("?", "?", 0));
assertEqualInt(1, pathmatch("a", "a", 0));
assertEqualInt(0, pathmatch("a", "ab", 0));
assertEqualInt(0, pathmatch("a", "ab", 0));
assertEqualInt(1, pathmatch("a?c", "abc", 0));
assertEqualInt(1, lafe_pathmatch("*","abcd/efgh/ijkl", 0));
assertEqualInt(1, lafe_pathmatch("abcd*efgh/ijkl","abcd/efgh/ijkl", 0));
assertEqualInt(1, lafe_pathmatch("abcd***efgh/ijkl","abcd/efgh/ijkl", 0));
assertEqualInt(1, lafe_pathmatch("abcd***/efgh/ijkl","abcd/efgh/ijkl", 0));
assertEqualInt(0, lafe_pathmatch("?", "", 0));
assertEqualInt(0, lafe_pathmatch("?", "\0", 0));
assertEqualInt(1, lafe_pathmatch("?", "a", 0));
assertEqualInt(0, lafe_pathmatch("?", "ab", 0));
assertEqualInt(1, lafe_pathmatch("?", ".", 0));
assertEqualInt(1, lafe_pathmatch("?", "?", 0));
assertEqualInt(1, lafe_pathmatch("a", "a", 0));
assertEqualInt(0, lafe_pathmatch("a", "ab", 0));
assertEqualInt(0, lafe_pathmatch("a", "ab", 0));
assertEqualInt(1, lafe_pathmatch("a?c", "abc", 0));
/* SUSv2: ? matches / */
assertEqualInt(1, pathmatch("a?c", "a/c", 0));
assertEqualInt(1, pathmatch("a?*c*", "a/c", 0));
assertEqualInt(1, pathmatch("*a*", "a/c", 0));
assertEqualInt(1, pathmatch("*a*", "/a/c", 0));
assertEqualInt(1, pathmatch("*a*", "defaaaaaaa", 0));
assertEqualInt(0, pathmatch("a*", "defghi", 0));
assertEqualInt(0, pathmatch("*a*", "defghi", 0));
assertEqualInt(1, pathmatch("abc[def", "abc[def", 0));
assertEqualInt(0, pathmatch("abc[def]", "abc[def", 0));
assertEqualInt(0, pathmatch("abc[def", "abcd", 0));
assertEqualInt(1, pathmatch("abc[def]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[def]", "abce", 0));
assertEqualInt(1, pathmatch("abc[def]", "abcf", 0));
assertEqualInt(0, pathmatch("abc[def]", "abcg", 0));
assertEqualInt(1, pathmatch("abc[d*f]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[d*f]", "abc*", 0));
assertEqualInt(0, pathmatch("abc[d*f]", "abcdefghi", 0));
assertEqualInt(0, pathmatch("abc[d*", "abcdefghi", 0));
assertEqualInt(1, pathmatch("abc[d*", "abc[defghi", 0));
assertEqualInt(1, pathmatch("abc[d-f]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[d-f]", "abce", 0));
assertEqualInt(1, pathmatch("abc[d-f]", "abcf", 0));
assertEqualInt(0, pathmatch("abc[d-f]", "abcg", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abce", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abcf", 0));
assertEqualInt(0, pathmatch("abc[d-fh-k]", "abcg", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abch", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abci", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abcj", 0));
assertEqualInt(1, pathmatch("abc[d-fh-k]", "abck", 0));
assertEqualInt(0, pathmatch("abc[d-fh-k]", "abcl", 0));
assertEqualInt(0, pathmatch("abc[d-fh-k]", "abc-", 0));
assertEqualInt(1, lafe_pathmatch("a?c", "a/c", 0));
assertEqualInt(1, lafe_pathmatch("a?*c*", "a/c", 0));
assertEqualInt(1, lafe_pathmatch("*a*", "a/c", 0));
assertEqualInt(1, lafe_pathmatch("*a*", "/a/c", 0));
assertEqualInt(1, lafe_pathmatch("*a*", "defaaaaaaa", 0));
assertEqualInt(0, lafe_pathmatch("a*", "defghi", 0));
assertEqualInt(0, lafe_pathmatch("*a*", "defghi", 0));
/* Character classes */
assertEqualInt(1, lafe_pathmatch("abc[def", "abc[def", 0));
assertEqualInt(0, lafe_pathmatch("abc[def]", "abc[def", 0));
assertEqualInt(0, lafe_pathmatch("abc[def", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[def]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[def]", "abce", 0));
assertEqualInt(1, lafe_pathmatch("abc[def]", "abcf", 0));
assertEqualInt(0, lafe_pathmatch("abc[def]", "abcg", 0));
assertEqualInt(1, lafe_pathmatch("abc[d*f]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[d*f]", "abc*", 0));
assertEqualInt(0, lafe_pathmatch("abc[d*f]", "abcdefghi", 0));
assertEqualInt(0, lafe_pathmatch("abc[d*", "abcdefghi", 0));
assertEqualInt(1, lafe_pathmatch("abc[d*", "abc[defghi", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-f]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-f]", "abce", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-f]", "abcf", 0));
assertEqualInt(0, lafe_pathmatch("abc[d-f]", "abcg", 0));
assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abca", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abce", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abcf", 0));
assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abcg", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abch", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abci", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abcj", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abck", 0));
assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abcl", 0));
assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abc-", 0));
/* [] matches nothing, [!] is the same as ? */
assertEqualInt(0, lafe_pathmatch("abc[]efg", "abcdefg", 0));
assertEqualInt(0, lafe_pathmatch("abc[]efg", "abcqefg", 0));
assertEqualInt(0, lafe_pathmatch("abc[]efg", "abcefg", 0));
assertEqualInt(1, lafe_pathmatch("abc[!]efg", "abcdefg", 0));
assertEqualInt(1, lafe_pathmatch("abc[!]efg", "abcqefg", 0));
assertEqualInt(0, lafe_pathmatch("abc[!]efg", "abcefg", 0));
/* I assume: Trailing '-' is non-special. */
assertEqualInt(0, pathmatch("abc[d-fh-]", "abcl", 0));
assertEqualInt(1, pathmatch("abc[d-fh-]", "abch", 0));
assertEqualInt(1, pathmatch("abc[d-fh-]", "abc-", 0));
assertEqualInt(1, pathmatch("abc[d-fh-]", "abc-", 0));
assertEqualInt(0, lafe_pathmatch("abc[d-fh-]", "abcl", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-]", "abch", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-]", "abc-", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-fh-]", "abc-", 0));
/* ']' can be backslash-quoted within a character class. */
assertEqualInt(1, pathmatch("abc[\\]]", "abc]", 0));
assertEqualInt(1, pathmatch("abc[\\]d]", "abc]", 0));
assertEqualInt(1, pathmatch("abc[\\]d]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[d\\]]", "abc]", 0));
assertEqualInt(1, pathmatch("abc[d\\]]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[d]e]", "abcde]", 0));
assertEqualInt(1, pathmatch("abc[d\\]e]", "abc]", 0));
assertEqualInt(0, pathmatch("abc[d\\]e]", "abcd]e", 0));
assertEqualInt(0, pathmatch("abc[d]e]", "abc]", 0));
assertEqualInt(1, lafe_pathmatch("abc[\\]]", "abc]", 0));
assertEqualInt(1, lafe_pathmatch("abc[\\]d]", "abc]", 0));
assertEqualInt(1, lafe_pathmatch("abc[\\]d]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[d\\]]", "abc]", 0));
assertEqualInt(1, lafe_pathmatch("abc[d\\]]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[d]e]", "abcde]", 0));
assertEqualInt(1, lafe_pathmatch("abc[d\\]e]", "abc]", 0));
assertEqualInt(0, lafe_pathmatch("abc[d\\]e]", "abcd]e", 0));
assertEqualInt(0, lafe_pathmatch("abc[d]e]", "abc]", 0));
/* backslash-quoted chars can appear as either end of a range. */
assertEqualInt(1, pathmatch("abc[\\d-f]gh", "abcegh", 0));
assertEqualInt(0, pathmatch("abc[\\d-f]gh", "abcggh", 0));
assertEqualInt(0, pathmatch("abc[\\d-f]gh", "abc\\gh", 0));
assertEqualInt(1, pathmatch("abc[d-\\f]gh", "abcegh", 0));
assertEqualInt(1, pathmatch("abc[\\d-\\f]gh", "abcegh", 0));
assertEqualInt(1, pathmatch("abc[\\d-\\f]gh", "abcegh", 0));
assertEqualInt(1, lafe_pathmatch("abc[\\d-f]gh", "abcegh", 0));
assertEqualInt(0, lafe_pathmatch("abc[\\d-f]gh", "abcggh", 0));
assertEqualInt(0, lafe_pathmatch("abc[\\d-f]gh", "abc\\gh", 0));
assertEqualInt(1, lafe_pathmatch("abc[d-\\f]gh", "abcegh", 0));
assertEqualInt(1, lafe_pathmatch("abc[\\d-\\f]gh", "abcegh", 0));
assertEqualInt(1, lafe_pathmatch("abc[\\d-\\f]gh", "abcegh", 0));
/* backslash-quoted '-' isn't special. */
assertEqualInt(0, pathmatch("abc[d\\-f]gh", "abcegh", 0));
assertEqualInt(1, pathmatch("abc[d\\-f]gh", "abc-gh", 0));
assertEqualInt(0, lafe_pathmatch("abc[d\\-f]gh", "abcegh", 0));
assertEqualInt(1, lafe_pathmatch("abc[d\\-f]gh", "abc-gh", 0));
/* Leading '!' negates a character class. */
assertEqualInt(0, pathmatch("abc[!d]", "abcd", 0));
assertEqualInt(1, pathmatch("abc[!d]", "abce", 0));
assertEqualInt(1, pathmatch("abc[!d]", "abcc", 0));
assertEqualInt(0, pathmatch("abc[!d-z]", "abcq", 0));
assertEqualInt(1, pathmatch("abc[!d-gi-z]", "abch", 0));
assertEqualInt(1, pathmatch("abc[!fgijkl]", "abch", 0));
assertEqualInt(0, pathmatch("abc[!fghijkl]", "abch", 0));
assertEqualInt(0, lafe_pathmatch("abc[!d]", "abcd", 0));
assertEqualInt(1, lafe_pathmatch("abc[!d]", "abce", 0));
assertEqualInt(1, lafe_pathmatch("abc[!d]", "abcc", 0));
assertEqualInt(0, lafe_pathmatch("abc[!d-z]", "abcq", 0));
assertEqualInt(1, lafe_pathmatch("abc[!d-gi-z]", "abch", 0));
assertEqualInt(1, lafe_pathmatch("abc[!fgijkl]", "abch", 0));
assertEqualInt(0, lafe_pathmatch("abc[!fghijkl]", "abch", 0));
/* Backslash quotes next character. */
assertEqualInt(0, pathmatch("abc\\[def]", "abc\\d", 0));
assertEqualInt(1, pathmatch("abc\\[def]", "abc[def]", 0));
assertEqualInt(0, pathmatch("abc\\\\[def]", "abc[def]", 0));
assertEqualInt(0, pathmatch("abc\\\\[def]", "abc\\[def]", 0));
assertEqualInt(1, pathmatch("abc\\\\[def]", "abc\\d", 0));
assertEqualInt(0, lafe_pathmatch("abc\\[def]", "abc\\d", 0));
assertEqualInt(1, lafe_pathmatch("abc\\[def]", "abc[def]", 0));
assertEqualInt(0, lafe_pathmatch("abc\\\\[def]", "abc[def]", 0));
assertEqualInt(0, lafe_pathmatch("abc\\\\[def]", "abc\\[def]", 0));
assertEqualInt(1, lafe_pathmatch("abc\\\\[def]", "abc\\d", 0));
assertEqualInt(1, lafe_pathmatch("abcd\\", "abcd\\", 0));
assertEqualInt(0, lafe_pathmatch("abcd\\", "abcd\\[", 0));
assertEqualInt(0, lafe_pathmatch("abcd\\", "abcde", 0));
assertEqualInt(0, lafe_pathmatch("abcd\\[", "abcd\\", 0));
/*
* Because '.' and '/' have special meanings, we can
* identify many equivalent paths even if they're expressed
* differently.
* differently. (But quoting a character with '\\' suppresses
* special meanings!)
*/
assertEqualInt(1, pathmatch("./abc/./def/", "abc/def/", 0));
assertEqualInt(1, pathmatch("abc/def", "./././abc/./def", 0));
assertEqualInt(1, pathmatch("abc/def/././//", "./././abc/./def/", 0));
assertEqualInt(1, pathmatch(".////abc/.//def", "./././abc/./def", 0));
assertEqualInt(1, pathmatch("./abc?def/", "abc/def/", 0));
assertEqualInt(0, lafe_pathmatch("a/b/", "a/bc", 0));
assertEqualInt(1, lafe_pathmatch("a/./b", "a/b", 0));
assertEqualInt(0, lafe_pathmatch("a\\/./b", "a/b", 0));
assertEqualInt(0, lafe_pathmatch("a/\\./b", "a/b", 0));
assertEqualInt(0, lafe_pathmatch("a/.\\/b", "a/b", 0));
assertEqualInt(0, lafe_pathmatch("a\\/\\.\\/b", "a/b", 0));
assertEqualInt(1, lafe_pathmatch("./abc/./def/", "abc/def/", 0));
assertEqualInt(1, lafe_pathmatch("abc/def", "./././abc/./def", 0));
assertEqualInt(1, lafe_pathmatch("abc/def/././//", "./././abc/./def/", 0));
assertEqualInt(1, lafe_pathmatch(".////abc/.//def", "./././abc/./def", 0));
assertEqualInt(1, lafe_pathmatch("./abc?def/", "abc/def/", 0));
failure("\"?./\" is not the same as \"/./\"");
assertEqualInt(0, pathmatch("./abc?./def/", "abc/def/", 0));
assertEqualInt(0, lafe_pathmatch("./abc?./def/", "abc/def/", 0));
failure("Trailing '/' should match no trailing '/'");
assertEqualInt(1, pathmatch("./abc/./def/", "abc/def", 0));
assertEqualInt(1, lafe_pathmatch("./abc/./def/", "abc/def", 0));
failure("Trailing '/./' is still the same directory.");
assertEqualInt(1, pathmatch("./abc/./def/./", "abc/def", 0));
assertEqualInt(1, lafe_pathmatch("./abc/./def/./", "abc/def", 0));
failure("Trailing '/.' is still the same directory.");
assertEqualInt(1, pathmatch("./abc/./def/.", "abc/def", 0));
assertEqualInt(1, pathmatch("./abc/./def", "abc/def/", 0));
assertEqualInt(1, lafe_pathmatch("./abc/./def/.", "abc/def", 0));
assertEqualInt(1, lafe_pathmatch("./abc/./def", "abc/def/", 0));
failure("Trailing '/./' is still the same directory.");
assertEqualInt(1, pathmatch("./abc/./def", "abc/def/./", 0));
assertEqualInt(1, lafe_pathmatch("./abc/./def", "abc/def/./", 0));
failure("Trailing '/.' is still the same directory.");
assertEqualInt(1, pathmatch("./abc*/./def", "abc/def/.", 0));
assertEqualInt(1, lafe_pathmatch("./abc*/./def", "abc/def/.", 0));
/* Matches not anchored at beginning. */
assertEqualInt(0,
lafe_pathmatch("bcd", "abcd", PATHMATCH_NO_ANCHOR_START));
assertEqualInt(1,
lafe_pathmatch("abcd", "abcd", PATHMATCH_NO_ANCHOR_START));
assertEqualInt(0,
lafe_pathmatch("^bcd", "abcd", PATHMATCH_NO_ANCHOR_START));
assertEqualInt(1,
lafe_pathmatch("b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START));
assertEqualInt(0,
lafe_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START));
assertEqualInt(0,
lafe_pathmatch("^b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START));
/* Matches not anchored at end. */
assertEqualInt(0,
lafe_pathmatch("bcd", "abcd", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("abcd", "abcd", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("abcd", "abcd/", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("abcd", "abcd/.", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(0,
lafe_pathmatch("abc", "abcd", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("a/b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(0,
lafe_pathmatch("a/b/c$", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("a/b/c$", "a/b/c", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("a/b/c$", "a/b/c/", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("a/b/c/", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(0,
lafe_pathmatch("a/b/c/$", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("a/b/c/$", "a/b/c/", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(1,
lafe_pathmatch("a/b/c/$", "a/b/c", PATHMATCH_NO_ANCHOR_END));
assertEqualInt(0,
lafe_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
}

View file

@ -0,0 +1,46 @@
default: all
archive_entry.3.html: ../mdoc2man.awk ../../libarchive/archive_entry.3
groff -mdoc -T html ../../libarchive/archive_entry.3 > archive_entry.3.html
archive_read.3.html: ../mdoc2man.awk ../../libarchive/archive_read.3
groff -mdoc -T html ../../libarchive/archive_read.3 > archive_read.3.html
archive_read_disk.3.html: ../mdoc2man.awk ../../libarchive/archive_read_disk.3
groff -mdoc -T html ../../libarchive/archive_read_disk.3 > archive_read_disk.3.html
archive_util.3.html: ../mdoc2man.awk ../../libarchive/archive_util.3
groff -mdoc -T html ../../libarchive/archive_util.3 > archive_util.3.html
archive_write.3.html: ../mdoc2man.awk ../../libarchive/archive_write.3
groff -mdoc -T html ../../libarchive/archive_write.3 > archive_write.3.html
archive_write_disk.3.html: ../mdoc2man.awk ../../libarchive/archive_write_disk.3
groff -mdoc -T html ../../libarchive/archive_write_disk.3 > archive_write_disk.3.html
cpio.5.html: ../mdoc2man.awk ../../libarchive/cpio.5
groff -mdoc -T html ../../libarchive/cpio.5 > cpio.5.html
libarchive-formats.5.html: ../mdoc2man.awk ../../libarchive/libarchive-formats.5
groff -mdoc -T html ../../libarchive/libarchive-formats.5 > libarchive-formats.5.html
libarchive.3.html: ../mdoc2man.awk ../../libarchive/libarchive.3
groff -mdoc -T html ../../libarchive/libarchive.3 > libarchive.3.html
libarchive_internals.3.html: ../mdoc2man.awk ../../libarchive/libarchive_internals.3
groff -mdoc -T html ../../libarchive/libarchive_internals.3 > libarchive_internals.3.html
mtree.5.html: ../mdoc2man.awk ../../libarchive/mtree.5
groff -mdoc -T html ../../libarchive/mtree.5 > mtree.5.html
tar.5.html: ../mdoc2man.awk ../../libarchive/tar.5
groff -mdoc -T html ../../libarchive/tar.5 > tar.5.html
bsdtar.1.html: ../mdoc2man.awk ../../tar/bsdtar.1
groff -mdoc -T html ../../tar/bsdtar.1 > bsdtar.1.html
bsdcpio.1.html: ../mdoc2man.awk ../../cpio/bsdcpio.1
groff -mdoc -T html ../../cpio/bsdcpio.1 > bsdcpio.1.html
all: archive_entry.3.html archive_read.3.html archive_read_disk.3.html archive_util.3.html archive_write.3.html archive_write_disk.3.html cpio.5.html libarchive-formats.5.html libarchive.3.html libarchive_internals.3.html mtree.5.html tar.5.html bsdtar.1.html bsdcpio.1.html

View file

@ -0,0 +1,694 @@
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Thu Feb 4 20:36:29 2010 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; }
pre { margin-top: 0; margin-bottom: 0; }
table { margin-top: 0; margin-bottom: 0; }
</style>
<title></title>
</head>
<body>
<hr>
<p valign="top">archive_entry(3) FreeBSD Library Functions
Manual archive_entry(3)</p>
<p style="margin-top: 1em" valign="top"><b>NAME</b></p>
<p style="margin-left:8%;"><b>archive_entry_acl_add_entry</b>,
<b>archive_entry_acl_add_entry_w</b>,
<b>archive_entry_acl_clear</b>,
<b>archive_entry_acl_count</b>,
<b>archive_entry_acl_next</b>,
<b>archive_entry_acl_next_w</b>,
<b>archive_entry_acl_reset</b>,
<b>archive_entry_acl_text_w</b>, <b>archive_entry_atime</b>,
<b>archive_entry_atime_nsec</b>, <b>archive_entry_clear</b>,
<b>archive_entry_clone</b>,
<b>archive_entry_copy_fflags_text</b>,
<b>archive_entry_copy_fflags_text_w</b>,
<b>archive_entry_copy_gname</b>,
<b>archive_entry_copy_gname_w</b>,
<b>archive_entry_copy_hardlink</b>,
<b>archive_entry_copy_hardlink_w</b>,
<b>archive_entry_copy_link</b>,
<b>archive_entry_copy_link_w</b>,
<b>archive_entry_copy_pathname_w</b>,
<b>archive_entry_copy_sourcepath</b>,
<b>archive_entry_copy_stat</b>,
<b>archive_entry_copy_symlink</b>,
<b>archive_entry_copy_symlink_w</b>,
<b>archive_entry_copy_uname</b>,
<b>archive_entry_copy_uname_w</b>, <b>archive_entry_dev</b>,
<b>archive_entry_devmajor</b>,
<b>archive_entry_devminor</b>,
<b>archive_entry_filetype</b>, <b>archive_entry_fflags</b>,
<b>archive_entry_fflags_text</b>, <b>archive_entry_free</b>,
<b>archive_entry_gid</b>, <b>archive_entry_gname</b>,
<b>archive_entry_hardlink</b>, <b>archive_entry_ino</b>,
<b>archive_entry_mode</b>, <b>archive_entry_mtime</b>,
<b>archive_entry_mtime_nsec</b>, <b>archive_entry_nlink</b>,
<b>archive_entry_new</b>, <b>archive_entry_pathname</b>,
<b>archive_entry_pathname_w</b>, <b>archive_entry_rdev</b>,
<b>archive_entry_rdevmajor</b>,
<b>archive_entry_rdevminor</b>,
<b>archive_entry_set_atime</b>,
<b>archive_entry_set_ctime</b>,
<b>archive_entry_set_dev</b>,
<b>archive_entry_set_devmajor</b>,
<b>archive_entry_set_devminor</b>,
<b>archive_entry_set_filetype</b>,
<b>archive_entry_set_fflags</b>,
<b>archive_entry_set_gid</b>,
<b>archive_entry_set_gname</b>,
<b>archive_entry_set_hardlink</b>,
<b>archive_entry_set_link</b>,
<b>archive_entry_set_mode</b>,
<b>archive_entry_set_mtime</b>,
<b>archive_entry_set_pathname</b>,
<b>archive_entry_set_rdevmajor</b>,
<b>archive_entry_set_rdevminor</b>,
<b>archive_entry_set_size</b>,
<b>archive_entry_set_symlink</b>,
<b>archive_entry_set_uid</b>,
<b>archive_entry_set_uname</b>, <b>archive_entry_size</b>,
<b>archive_entry_sourcepath</b>, <b>archive_entry_stat</b>,
<b>archive_entry_symlink</b>, <b>archive_entry_uid</b>,
<b>archive_entry_uname</b> &mdash; functions for
manipulating archive entry descriptions</p>
<p style="margin-top: 1em" valign="top"><b>SYNOPSIS</b></p>
<p style="margin-left:8%;"><b>#include
&lt;archive_entry.h&gt;</b></p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p valign="top"><b>archive_entry_acl_add_entry</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;type</i>, <i>int&nbsp;permset</i>,
<i>int&nbsp;tag</i>, <i>int&nbsp;qual</i>,
<i>const&nbsp;char&nbsp;*name</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p valign="top"><b>archive_entry_acl_add_entry_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;type</i>, <i>int&nbsp;permset</i>,
<i>int&nbsp;tag</i>, <i>int&nbsp;qual</i>,
<i>const&nbsp;wchar_t&nbsp;*name</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_acl_clear</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_entry_acl_count</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;type</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_entry_acl_next</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;want_type</i>, <i>int&nbsp;*type</i>,
<i>int&nbsp;*permset</i>, <i>int&nbsp;*tag</i>,
<i>int&nbsp;*qual</i>,
<i>const&nbsp;char&nbsp;**name</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_entry_acl_next_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;want_type</i>, <i>int&nbsp;*type</i>,
<i>int&nbsp;*permset</i>, <i>int&nbsp;*tag</i>,
<i>int&nbsp;*qual</i>,
<i>const&nbsp;wchar_t&nbsp;**name</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_entry_acl_reset</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;want_type</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const wchar_t
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_acl_text_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;flags</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>time_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_atime</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>long</i></p>
<p style="margin-left:14%;"><b>archive_entry_atime_nsec</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>struct
archive_entry *</i></p>
<p style="margin-left:14%;"><b>archive_entry_clear</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>struct
archive_entry *</i></p>
<p style="margin-left:14%;"><b>archive_entry_clone</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char *
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_fflags_text_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const wchar_t
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_fflags_text_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;wchar_t&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_gname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_gname_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;wchar_t&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_hardlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_hardlink_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;wchar_t&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_sourcepath</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_pathname_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;wchar_t&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_stat</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;struct&nbsp;stat&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_symlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_symlink_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;wchar_t&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_uname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_copy_uname_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;wchar_t&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>dev_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_dev</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>dev_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_devmajor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>dev_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_devminor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>mode_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_filetype</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p valign="top"><b>archive_entry_fflags</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>unsigned&nbsp;long&nbsp;*set</i>,
<i>unsigned&nbsp;long&nbsp;*clear</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_fflags_text</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_free</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_gname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_hardlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>ino_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_ino</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>mode_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_mode</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>time_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_mtime</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>long</i></p>
<p style="margin-left:14%;"><b>archive_entry_mtime_nsec</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>unsigned
int</i></p>
<p style="margin-left:14%;"><b>archive_entry_nlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>struct
archive_entry *</i></p>
<p style="margin-left:14%;"><b>archive_entry_new</b>(<i>void</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_pathname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const wchar_t
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_pathname_w</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>dev_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_rdev</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>dev_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_rdevmajor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>dev_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_rdevminor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_dev</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>dev_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_devmajor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>dev_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_devminor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>dev_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_filetype</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>unsigned&nbsp;int</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p valign="top"><b>archive_entry_set_fflags</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>unsigned&nbsp;long&nbsp;set</i>,
<i>unsigned&nbsp;long&nbsp;clear</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_gid</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>gid_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_gname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_hardlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_ino</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>unsigned&nbsp;long</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_link</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_mode</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>mode_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_mtime</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>time_t</i>, <i>long&nbsp;nanos</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_nlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>unsigned&nbsp;int</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_pathname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_rdev</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>dev_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_rdevmajor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>dev_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_rdevminor</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>dev_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_size</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int64_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_symlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_uid</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>uid_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_entry_set_uname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int64_t</i></p>
<p style="margin-left:14%;"><b>archive_entry_size</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_sourcepath</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const struct
stat *</i></p>
<p style="margin-left:14%;"><b>archive_entry_stat</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_symlink</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_entry_uname</b>(<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-top: 1em" valign="top"><b>DESCRIPTION</b></p>
<p style="margin-left:8%;">These functions create and
manipulate data objects that represent entries within an
archive. You can think of a struct archive_entry as a
heavy-duty version of struct stat: it includes everything
from struct stat plus associated pathname, textual group and
user names, etc. These objects are used by libarchive(3) to
represent the metadata associated with a particular entry in
an archive.</p>
<p style="margin-left:8%; margin-top: 1em"><b>Create and
Destroy</b> <br>
There are functions to allocate, destroy, clear, and copy
<i>archive_entry</i> objects:</p>
<p valign="top"><b>archive_entry_clear</b>()</p>
<p style="margin-left:20%;">Erases the object, resetting
all internal fields to the same state as a newly-created
object. This is provided to allow you to quickly recycle
objects without thrashing the heap.</p>
<p valign="top"><b>archive_entry_clone</b>()</p>
<p style="margin-left:20%;">A deep copy operation; all text
fields are duplicated.</p>
<p valign="top"><b>archive_entry_free</b>()</p>
<p style="margin-left:20%;">Releases the struct
archive_entry object.</p>
<p valign="top"><b>archive_entry_new</b>()</p>
<p style="margin-left:20%;">Allocate and return a blank
struct archive_entry object.</p>
<p style="margin-left:8%; margin-top: 1em"><b>Set and Get
Functions</b> <br>
Most of the functions here set or read entries in an object.
Such functions have one of the following forms:</p>
<p valign="top"><b>archive_entry_set_XXXX</b>()</p>
<p style="margin-left:20%;">Stores the provided data in the
object. In particular, for strings, the pointer is stored,
not the referenced string.</p>
<p valign="top"><b>archive_entry_copy_XXXX</b>()</p>
<p style="margin-left:20%;">As above, except that the
referenced data is copied into the object.</p>
<p valign="top"><b>archive_entry_XXXX</b>()</p>
<p style="margin-left:20%;">Returns the specified data. In
the case of strings, a const-qualified pointer to the string
is returned.</p>
<p style="margin-left:8%;">String data can be set or
accessed as wide character strings or normal <i>char</i>
strings. The functions that use wide character strings are
suffixed with <b>_w</b>. Note that these are different
representations of the same data: For example, if you store
a narrow string and read the corresponding wide string, the
object will transparently convert formats using the current
locale. Similarly, if you store a wide string and then store
a narrow string for the same data, the previously-set wide
string will be discarded in favor of the new data.</p>
<p style="margin-left:8%; margin-top: 1em">There are a few
set/get functions that merit additional description:</p>
<p valign="top"><b>archive_entry_set_link</b>()</p>
<p style="margin-left:20%;">This function sets the symlink
field if it is already set. Otherwise, it sets the hardlink
field.</p>
<p style="margin-left:8%; margin-top: 1em"><b>File
Flags</b> <br>
File flags are transparently converted between a bitmap
representation and a textual format. For example, if you set
the bitmap and ask for text, the library will build a
canonical text format. However, if you set a text format and
request a text format, you will get back the same text, even
if it is ill-formed. If you need to canonicalize a textual
flags string, you should first set the text form, then
request the bitmap form, then use that to set the bitmap
form. Setting the bitmap format will clear the internal text
representation and force it to be reconstructed when you
next request the text form.</p>
<p style="margin-left:8%; margin-top: 1em">The bitmap
format consists of two integers, one containing bits that
should be set, the other specifying bits that should be
cleared. Bits not mentioned in either bitmap will be
ignored. Usually, the bitmap of bits to be cleared will be
set to zero. In unusual circumstances, you can force a
fully-specified set of file flags by setting the bitmap of
flags to clear to the complement of the bitmap of flags to
set. (This differs from fflagstostr(3), which only includes
names for set bits.) Converting a bitmap to a textual string
is a platform-specific operation; bits that are not
meaningful on the current platform will be ignored.</p>
<p style="margin-left:8%; margin-top: 1em">The canonical
text format is a comma-separated list of flag names. The
<b>archive_entry_copy_fflags_text</b>() and
<b>archive_entry_copy_fflags_text_w</b>() functions parse
the provided text and sets the internal bitmap values. This
is a platform-specific operation; names that are not
meaningful on the current platform will be ignored. The
function returns a pointer to the start of the first name
that was not recognized, or NULL if every name was
recognized. Note that every name--including names that
follow an unrecognized name--will be evaluated, and the
bitmaps will be set to reflect every name that is
recognized. (In particular, this differs from
strtofflags(3), which stops parsing at the first
unrecognized name.)</p>
<p style="margin-left:8%; margin-top: 1em"><b>ACL
Handling</b> <br>
XXX This needs serious help. XXX</p>
<p style="margin-left:8%; margin-top: 1em">An
&lsquo;&lsquo;Access Control List&rsquo;&rsquo; (ACL) is a
list of permissions that grant access to particular users or
groups beyond what would normally be provided by standard
POSIX mode bits. The ACL handling here addresses some
deficiencies in the POSIX.1e draft 17 ACL specification. In
particular, POSIX.1e draft 17 specifies several different
formats, but none of those formats include both textual
user/group names and numeric UIDs/GIDs.</p>
<p style="margin-left:8%; margin-top: 1em">XXX explain ACL
stuff XXX</p>
<p style="margin-top: 1em" valign="top"><b>SEE ALSO</b></p>
<p style="margin-left:8%;">archive(3)</p>
<p style="margin-top: 1em" valign="top"><b>HISTORY</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
first appeared in FreeBSD&nbsp;5.3.</p>
<p style="margin-top: 1em" valign="top"><b>AUTHORS</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
was written by Tim Kientzle
&lang;kientzle@acm.org&rang;.</p>
<p style="margin-left:8%; margin-top: 1em">FreeBSD&nbsp;8.0
May&nbsp;12, 2008 FreeBSD&nbsp;8.0</p>
<hr>
</body>
</html>

View file

@ -0,0 +1,820 @@
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Thu Feb 4 20:36:31 2010 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; }
pre { margin-top: 0; margin-bottom: 0; }
table { margin-top: 0; margin-bottom: 0; }
</style>
<title></title>
</head>
<body>
<hr>
<p valign="top">archive_read(3) FreeBSD Library Functions
Manual archive_read(3)</p>
<p style="margin-top: 1em" valign="top"><b>NAME</b></p>
<p style="margin-left:8%;"><b>archive_read_new</b>,
<b>archive_read_set_filter_options</b>,
<b>archive_read_set_format_options</b>,
<b>archive_read_set_options</b>,
<b>archive_read_support_compression_all</b>,
<b>archive_read_support_compression_bzip2</b>,
<b>archive_read_support_compression_compress</b>,
<b>archive_read_support_compression_gzip</b>,
<b>archive_read_support_compression_lzma</b>,
<b>archive_read_support_compression_none</b>,
<b>archive_read_support_compression_xz</b>,
<b>archive_read_support_compression_program</b>,
<b>archive_read_support_compression_program_signature</b>,
<b>archive_read_support_format_all</b>,
<b>archive_read_support_format_ar</b>,
<b>archive_read_support_format_cpio</b>,
<b>archive_read_support_format_empty</b>,
<b>archive_read_support_format_iso9660</b>,
<b>archive_read_support_format_mtree,
archive_read_support_format_raw,
archive_read_support_format_tar</b>,
<b>archive_read_support_format_zip</b>,
<b>archive_read_open</b>, <b>archive_read_open2</b>,
<b>archive_read_open_fd</b>, <b>archive_read_open_FILE</b>,
<b>archive_read_open_filename</b>,
<b>archive_read_open_memory</b>,
<b>archive_read_next_header</b>,
<b>archive_read_next_header2</b>, <b>archive_read_data</b>,
<b>archive_read_data_block</b>,
<b>archive_read_data_skip</b>,
<b>archive_read_data_into_buffer</b>,
<b>archive_read_data_into_fd</b>,
<b>archive_read_extract</b>, <b>archive_read_extract2</b>,
<b>archive_read_extract_set_progress_callback</b>,
<b>archive_read_close</b>, <b>archive_read_finish</b>
&mdash; functions for reading streaming archives</p>
<p style="margin-top: 1em" valign="top"><b>SYNOPSIS</b></p>
<p style="margin-left:8%;"><b>#include
&lt;archive.h&gt;</b></p>
<p style="margin-left:8%; margin-top: 1em"><i>struct
archive *</i></p>
<p style="margin-left:14%;"><b>archive_read_new</b>(<i>void</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_all</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_bzip2</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_compress</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_gzip</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_lzma</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_none</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_compression_xz</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_support_compression_program</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*cmd</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_support_compression_program_signature</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*cmd</i>,
<i>const&nbsp;void&nbsp;*signature</i>,
<i>size_t&nbsp;signature_length</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_all</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_ar</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_cpio</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_empty</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_iso9660</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_mtree</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_raw</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_tar</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_support_format_zip</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_set_filter_options</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_set_format_options</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_set_options</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_open</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*client_data</i>,
<i>archive_open_callback&nbsp;*</i>,
<i>archive_read_callback&nbsp;*</i>,
<i>archive_close_callback&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_open2</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*client_data</i>,
<i>archive_open_callback&nbsp;*</i>,
<i>archive_read_callback&nbsp;*</i>,
<i>archive_skip_callback&nbsp;*</i>,
<i>archive_close_callback&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_open_FILE</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>FILE&nbsp;*file</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_open_fd</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int&nbsp;fd</i>, <i>size_t&nbsp;block_size</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_open_filename</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*filename</i>,
<i>size_t&nbsp;block_size</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_open_memory</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*buff</i>, <i>size_t&nbsp;size</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_next_header</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive_entry&nbsp;**</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_next_header2</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>ssize_t</i></p>
<p style="margin-left:14%;"><b>archive_read_data</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*buff</i>, <i>size_t&nbsp;len</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_data_block</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;void&nbsp;**buff</i>, <i>size_t&nbsp;*len</i>,
<i>off_t&nbsp;*offset</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_data_skip</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_data_into_buffer</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*</i>, <i>ssize_t&nbsp;len</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_data_into_fd</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int&nbsp;fd</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_extract</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>int&nbsp;flags</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_extract2</b>(<i>struct&nbsp;archive&nbsp;*src</i>,
<i>struct&nbsp;archive_entry&nbsp;*</i>,
<i>struct&nbsp;archive&nbsp;*dest</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p valign="top"><b>archive_read_extract_set_progress_callback</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;(*func)(void&nbsp;*)</i>,
<i>void&nbsp;*user_data</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_close</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_finish</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-top: 1em" valign="top"><b>DESCRIPTION</b></p>
<p style="margin-left:8%;">These functions provide a
complete API for reading streaming archives. The general
process is to first create the struct archive object, set
options, initialize the reader, iterate over the archive
headers and associated data, then close the archive and
release all resources. The following summary describes the
functions in approximately the order they would be used:</p>
<p valign="top"><b>archive_read_new</b>()</p>
<p style="margin-left:20%;">Allocates and initializes a
struct archive object suitable for reading from an
archive.</p>
<p valign="top"><b>archive_read_support_compression_bzip2</b>(),
<b>archive_read_support_compression_compress</b>(),
<b>archive_read_support_compression_gzip</b>(),
<b>archive_read_support_compression_lzma</b>(),
<b>archive_read_support_compression_none</b>(),
<b>archive_read_support_compression_xz</b>()</p>
<p style="margin-left:20%;">Enables auto-detection code and
decompression support for the specified compression. Returns
<b>ARCHIVE_OK</b> if the compression is fully supported, or
<b>ARCHIVE_WARN</b> if the compression is supported only
through an external program. Note that decompression using
an external program is usually slower than decompression
through built-in libraries. Note that
&lsquo;&lsquo;none&rsquo;&rsquo; is always enabled by
default.</p>
<p valign="top"><b>archive_read_support_compression_all</b>()</p>
<p style="margin-left:20%;">Enables all available
decompression filters.</p>
<p valign="top"><b>archive_read_support_compression_program</b>()</p>
<p style="margin-left:20%;">Data is fed through the
specified external program before being dearchived. Note
that this disables automatic detection of the compression
format, so it makes no sense to specify this in conjunction
with any other decompression option.</p>
<p valign="top"><b>archive_read_support_compression_program_signature</b>()</p>
<p style="margin-left:20%;">This feeds data through the
specified external program but only if the initial bytes of
the data match the specified signature value.</p>
<p valign="top"><b>archive_read_support_format_all</b>(),
<b>archive_read_support_format_ar</b>(),
<b>archive_read_support_format_cpio</b>(),
<b>archive_read_support_format_empty</b>(),
<b>archive_read_support_format_iso9660</b>(),
<b>archive_read_support_format_mtree</b>(),
<b>archive_read_support_format_tar</b>(),
<b>archive_read_support_format_zip</b>()</p>
<p style="margin-left:20%;">Enables support---including
auto-detection code---for the specified archive format. For
example, <b>archive_read_support_format_tar</b>() enables
support for a variety of standard tar formats, old-style
tar, ustar, pax interchange format, and many common
variants. For convenience,
<b>archive_read_support_format_all</b>() enables support for
all available formats. Only empty archives are supported by
default.</p>
<p valign="top"><b>archive_read_support_format_raw</b>()</p>
<p style="margin-left:20%;">The
&lsquo;&lsquo;raw&rsquo;&rsquo; format handler allows
libarchive to be used to read arbitrary data. It treats any
data stream as an archive with a single entry. The pathname
of this entry is &lsquo;&lsquo;data&rsquo;&rsquo;; all other
entry fields are unset. This is not enabled by
<b>archive_read_support_format_all</b>() in order to avoid
erroneous handling of damaged archives.</p>
<p valign="top"><b>archive_read_set_filter_options</b>(),
<b>archive_read_set_format_options</b>(),
<b>archive_read_set_options</b>()</p>
<p style="margin-left:20%;">Specifies options that will be
passed to currently-registered filters (including
decompression filters) and/or format readers. The argument
is a comma-separated list of individual options. Individual
options have one of the following forms:</p>
<p valign="top"><i>option=value</i></p>
<p style="margin-left:32%;">The option/value pair will be
provided to every module. Modules that do not accept an
option with this name will ignore it.</p>
<p valign="top"><i>option</i></p>
<p style="margin-left:32%; margin-top: 1em">The option will
be provided to every module with a value of
&lsquo;&lsquo;1&rsquo;&rsquo;.</p>
<p valign="top"><i>!option</i></p>
<p style="margin-left:32%;">The option will be provided to
every module with a NULL value.</p>
<p valign="top"><i>module:option=value</i>,
<i>module:option</i>, <i>module:!option</i></p>
<p style="margin-left:32%;">As above, but the corresponding
option and value will be provided only to modules whose name
matches <i>module</i>.</p>
<p style="margin-left:20%;">The return value will be
<b>ARCHIVE_OK</b> if any module accepts the option, or
<b>ARCHIVE_WARN</b> if no module accepted the option, or
<b>ARCHIVE_FATAL</b> if there was a fatal error while
attempting to process the option.</p>
<p style="margin-left:20%; margin-top: 1em">The currently
supported options are:</p>
<p valign="top">Format iso9660 <b><br>
joliet</b></p>
<p style="margin-left:45%; margin-top: 1em">Support Joliet
extensions. Defaults to enabled, use <b>!joliet</b> to
disable.</p>
<p valign="top"><b>archive_read_open</b>()</p>
<p style="margin-left:20%;">The same as
<b>archive_read_open2</b>(), except that the skip callback
is assumed to be NULL.</p>
<p valign="top"><b>archive_read_open2</b>()</p>
<p style="margin-left:20%;">Freeze the settings, open the
archive, and prepare for reading entries. This is the most
generic version of this call, which accepts four callback
functions. Most clients will want to use
<b>archive_read_open_filename</b>(),
<b>archive_read_open_FILE</b>(),
<b>archive_read_open_fd</b>(), or
<b>archive_read_open_memory</b>() instead. The library
invokes the client-provided functions to obtain raw bytes
from the archive.</p>
<p valign="top"><b>archive_read_open_FILE</b>()</p>
<p style="margin-left:20%;">Like
<b>archive_read_open</b>(), except that it accepts a <i>FILE
*</i> pointer. This function should not be used with tape
drives or other devices that require strict I/O
blocking.</p>
<p valign="top"><b>archive_read_open_fd</b>()</p>
<p style="margin-left:20%;">Like
<b>archive_read_open</b>(), except that it accepts a file
descriptor and block size rather than a set of function
pointers. Note that the file descriptor will not be
automatically closed at end-of-archive. This function is
safe for use with tape drives or other blocked devices.</p>
<p valign="top"><b>archive_read_open_file</b>()</p>
<p style="margin-left:20%;">This is a deprecated synonym
for <b>archive_read_open_filename</b>().</p>
<p valign="top"><b>archive_read_open_filename</b>()</p>
<p style="margin-left:20%;">Like
<b>archive_read_open</b>(), except that it accepts a simple
filename and a block size. A NULL filename represents
standard input. This function is safe for use with tape
drives or other blocked devices.</p>
<p valign="top"><b>archive_read_open_memory</b>()</p>
<p style="margin-left:20%;">Like
<b>archive_read_open</b>(), except that it accepts a pointer
and size of a block of memory containing the archive
data.</p>
<p valign="top"><b>archive_read_next_header</b>()</p>
<p style="margin-left:20%;">Read the header for the next
entry and return a pointer to a struct archive_entry. This
is a convenience wrapper around
<b>archive_read_next_header2</b>() that reuses an internal
struct archive_entry object for each request.</p>
<p valign="top"><b>archive_read_next_header2</b>()</p>
<p style="margin-left:20%;">Read the header for the next
entry and populate the provided struct archive_entry.</p>
<p valign="top"><b>archive_read_data</b>()</p>
<p style="margin-left:20%;">Read data associated with the
header just read. Internally, this is a convenience function
that calls <b>archive_read_data_block</b>() and fills any
gaps with nulls so that callers see a single continuous
stream of data.</p>
<p valign="top"><b>archive_read_data_block</b>()</p>
<p style="margin-left:20%;">Return the next available block
of data for this entry. Unlike <b>archive_read_data</b>(),
the <b>archive_read_data_block</b>() function avoids copying
data and allows you to correctly handle sparse files, as
supported by some archive formats. The library guarantees
that offsets will increase and that blocks will not overlap.
Note that the blocks returned from this function can be much
larger than the block size read from disk, due to
compression and internal buffer optimizations.</p>
<p valign="top"><b>archive_read_data_skip</b>()</p>
<p style="margin-left:20%;">A convenience function that
repeatedly calls <b>archive_read_data_block</b>() to skip
all of the data for this archive entry.</p>
<p valign="top"><b>archive_read_data_into_buffer</b>()</p>
<p style="margin-left:20%;">This function is deprecated and
will be removed. Use <b>archive_read_data</b>() instead.</p>
<p valign="top"><b>archive_read_data_into_fd</b>()</p>
<p style="margin-left:20%;">A convenience function that
repeatedly calls <b>archive_read_data_block</b>() to copy
the entire entry to the provided file descriptor.</p>
<p valign="top"><b>archive_read_extract</b>(),
<b>archive_read_extract_set_skip_file</b>()</p>
<p style="margin-left:20%;">A convenience function that
wraps the corresponding archive_write_disk(3) interfaces.
The first call to <b>archive_read_extract</b>() creates a
restore object using archive_write_disk_new(3) and
archive_write_disk_set_standard_lookup(3), then
transparently invokes archive_write_disk_set_options(3),
archive_write_header(3), archive_write_data(3), and
archive_write_finish_entry(3) to create the entry on disk
and copy data into it. The <i>flags</i> argument is passed
unmodified to archive_write_disk_set_options(3).</p>
<p valign="top"><b>archive_read_extract2</b>()</p>
<p style="margin-left:20%;">This is another version of
<b>archive_read_extract</b>() that allows you to provide
your own restore object. In particular, this allows you to
override the standard lookup functions using
archive_write_disk_set_group_lookup(3), and
archive_write_disk_set_user_lookup(3). Note that
<b>archive_read_extract2</b>() does not accept a
<i>flags</i> argument; you should use
<b>archive_write_disk_set_options</b>() to set the restore
options yourself.</p>
<p valign="top"><b>archive_read_extract_set_progress_callback</b>()</p>
<p style="margin-left:20%;">Sets a pointer to a
user-defined callback that can be used for updating progress
displays during extraction. The progress function will be
invoked during the extraction of large regular files. The
progress function will be invoked with the pointer provided
to this call. Generally, the data pointed to should include
a reference to the archive object and the archive_entry
object so that various statistics can be retrieved for the
progress display.</p>
<p valign="top"><b>archive_read_close</b>()</p>
<p style="margin-left:20%;">Complete the archive and invoke
the close callback.</p>
<p valign="top"><b>archive_read_finish</b>()</p>
<p style="margin-left:20%;">Invokes
<b>archive_read_close</b>() if it was not invoked manually,
then release all resources. Note: In libarchive 1.x, this
function was declared to return <i>void</i>, which made it
impossible to detect certain errors when
<b>archive_read_close</b>() was invoked implicitly from this
function. The declaration is corrected beginning with
libarchive 2.0.</p>
<p style="margin-left:8%; margin-top: 1em">Note that the
library determines most of the relevant information about
the archive by inspection. In particular, it automatically
detects gzip(1) or bzip2(1) compression and transparently
performs the appropriate decompression. It also
automatically detects the archive format.</p>
<p style="margin-left:8%; margin-top: 1em">A complete
description of the struct archive and struct archive_entry
objects can be found in the overview manual page for
libarchive(3).</p>
<p style="margin-top: 1em" valign="top"><b>CLIENT
CALLBACKS</b></p>
<p style="margin-left:8%;">The callback functions must
match the following prototypes:</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
ssize_t</i></p>
<p valign="top"><b>archive_read_callback</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*client_data</i>,
<i>const&nbsp;void&nbsp;**buffer</i>)</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
int</i></p>
<p valign="top"><b>archive_skip_callback</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*client_data</i>,
<i>size_t&nbsp;request</i>)</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
int</i> <b>archive_open_callback</b>(<i>struct archive
*</i>, <i>void *client_data</i>)</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
int</i> <b>archive_close_callback</b>(<i>struct archive
*</i>, <i>void *client_data</i>)</p>
<p style="margin-left:8%; margin-top: 1em">The open
callback is invoked by <b>archive_open</b>(). It should
return <b>ARCHIVE_OK</b> if the underlying file or data
source is successfully opened. If the open fails, it should
call <b>archive_set_error</b>() to register an error code
and message and return <b>ARCHIVE_FATAL</b>.</p>
<p style="margin-left:8%; margin-top: 1em">The read
callback is invoked whenever the library requires raw bytes
from the archive. The read callback should read data into a
buffer, set the const void **buffer argument to point to the
available data, and return a count of the number of bytes
available. The library will invoke the read callback again
only after it has consumed this data. The library imposes no
constraints on the size of the data blocks returned. On
end-of-file, the read callback should return zero. On error,
the read callback should invoke <b>archive_set_error</b>()
to register an error code and message and return -1.</p>
<p style="margin-left:8%; margin-top: 1em">The skip
callback is invoked when the library wants to ignore a block
of data. The return value is the number of bytes actually
skipped, which may differ from the request. If the callback
cannot skip data, it should return zero. If the skip
callback is not provided (the function pointer is NULL ),
the library will invoke the read function instead and simply
discard the result. A skip callback can provide significant
performance gains when reading uncompressed archives from
slow disk drives or other media that can skip quickly.</p>
<p style="margin-left:8%; margin-top: 1em">The close
callback is invoked by archive_close when the archive
processing is complete. The callback should return
<b>ARCHIVE_OK</b> on success. On failure, the callback
should invoke <b>archive_set_error</b>() to register an
error code and message and return <b>ARCHIVE_FATAL.</b></p>
<p style="margin-top: 1em" valign="top"><b>EXAMPLE</b></p>
<p style="margin-left:8%;">The following illustrates basic
usage of the library. In this example, the callback
functions are simply wrappers around the standard open(2),
read(2), and close(2) system calls.</p>
<p style="margin-left:17%; margin-top: 1em">void <br>
list_archive(const char *name) <br>
{ <br>
struct mydata *mydata; <br>
struct archive *a; <br>
struct archive_entry *entry;</p>
<p style="margin-left:17%; margin-top: 1em">mydata =
malloc(sizeof(struct mydata)); <br>
a = archive_read_new(); <br>
mydata-&gt;name = name; <br>
archive_read_support_compression_all(a); <br>
archive_read_support_format_all(a); <br>
archive_read_open(a, mydata, myopen, myread, myclose); <br>
while (archive_read_next_header(a, &amp;entry) ==
ARCHIVE_OK) { <br>
printf(&quot;%s\n&quot;,archive_entry_pathname(entry)); <br>
archive_read_data_skip(a); <br>
} <br>
archive_read_finish(a); <br>
free(mydata); <br>
}</p>
<p style="margin-left:17%; margin-top: 1em">ssize_t <br>
myread(struct archive *a, void *client_data, const void
**buff) <br>
{ <br>
struct mydata *mydata = client_data;</p>
<p style="margin-left:17%; margin-top: 1em">*buff =
mydata-&gt;buff; <br>
return (read(mydata-&gt;fd, mydata-&gt;buff, 10240)); <br>
}</p>
<p style="margin-left:17%; margin-top: 1em">int <br>
myopen(struct archive *a, void *client_data) <br>
{ <br>
struct mydata *mydata = client_data;</p>
<p style="margin-left:17%; margin-top: 1em">mydata-&gt;fd =
open(mydata-&gt;name, O_RDONLY); <br>
return (mydata-&gt;fd &gt;= 0 ? ARCHIVE_OK : ARCHIVE_FATAL);
<br>
}</p>
<p style="margin-left:17%; margin-top: 1em">int <br>
myclose(struct archive *a, void *client_data) <br>
{ <br>
struct mydata *mydata = client_data;</p>
<p style="margin-left:17%; margin-top: 1em">if
(mydata-&gt;fd &gt; 0) <br>
close(mydata-&gt;fd); <br>
return (ARCHIVE_OK); <br>
}</p>
<p style="margin-top: 1em" valign="top"><b>RETURN
VALUES</b></p>
<p style="margin-left:8%;">Most functions return zero on
success, non-zero on error. The possible return codes
include: <b>ARCHIVE_OK</b> (the operation succeeded),
<b>ARCHIVE_WARN</b> (the operation succeeded but a
non-critical error was encountered), <b>ARCHIVE_EOF</b>
(end-of-archive was encountered), <b>ARCHIVE_RETRY</b> (the
operation failed but can be retried), and
<b>ARCHIVE_FATAL</b> (there was a fatal error; the archive
should be closed immediately). Detailed error codes and
textual descriptions are available from the
<b>archive_errno</b>() and <b>archive_error_string</b>()
functions.</p>
<p style="margin-left:8%; margin-top: 1em"><b>archive_read_new</b>()
returns a pointer to a freshly allocated struct archive
object. It returns NULL on error.</p>
<p style="margin-left:8%; margin-top: 1em"><b>archive_read_data</b>()
returns a count of bytes actually read or zero at the end of
the entry. On error, a value of <b>ARCHIVE_FATAL</b>,
<b>ARCHIVE_WARN</b>, or <b>ARCHIVE_RETRY</b> is returned and
an error code and textual description can be retrieved from
the <b>archive_errno</b>() and <b>archive_error_string</b>()
functions.</p>
<p style="margin-left:8%; margin-top: 1em">The library
expects the client callbacks to behave similarly. If there
is an error, you can use <b>archive_set_error</b>() to set
an appropriate error code and description, then return one
of the non-zero values above. (Note that the value
eventually returned to the client may not be the same; many
errors that are not critical at the level of basic I/O can
prevent the archive from being properly read, thus most I/O
errors eventually cause <b>ARCHIVE_FATAL</b> to be
returned.)</p>
<p style="margin-top: 1em" valign="top"><b>SEE ALSO</b></p>
<p style="margin-left:8%;">tar(1), archive(3),
archive_util(3), tar(5)</p>
<p style="margin-top: 1em" valign="top"><b>HISTORY</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
first appeared in FreeBSD&nbsp;5.3.</p>
<p style="margin-top: 1em" valign="top"><b>AUTHORS</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
was written by Tim Kientzle
&lang;kientzle@acm.org&rang;.</p>
<p style="margin-top: 1em" valign="top"><b>BUGS</b></p>
<p style="margin-left:8%;">Many traditional archiver
programs treat empty files as valid empty archives. For
example, many implementations of tar(1) allow you to append
entries to an empty file. Of course, it is impossible to
determine the format of an empty file by inspecting the
contents, so this library treats empty files as having a
special &lsquo;&lsquo;empty&rsquo;&rsquo; format.</p>
<p style="margin-left:8%; margin-top: 1em">FreeBSD&nbsp;8.0
April&nbsp;13, 2009 FreeBSD&nbsp;8.0</p>
<hr>
</body>
</html>

View file

@ -0,0 +1,341 @@
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Thu Feb 4 20:36:31 2010 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; }
pre { margin-top: 0; margin-bottom: 0; }
table { margin-top: 0; margin-bottom: 0; }
</style>
<title></title>
</head>
<body>
<hr>
<p valign="top">archive_read_disk(3) FreeBSD Library
Functions Manual archive_read_disk(3)</p>
<p style="margin-top: 1em" valign="top"><b>NAME</b></p>
<p style="margin-left:8%;"><b>archive_read_disk_new</b>,
<b>archive_read_disk_set_symlink_logical</b>,
<b>archive_read_disk_set_symlink_physical</b>,
<b>archive_read_disk_set_symlink_hybrid</b>,
<b>archive_read_disk_entry_from_file</b>,
<b>archive_read_disk_gname</b>,
<b>archive_read_disk_uname</b>,
<b>archive_read_disk_set_uname_lookup</b>,
<b>archive_read_disk_set_gname_lookup</b>,
<b>archive_read_disk_set_standard_lookup</b>,
<b>archive_read_close</b>, <b>archive_read_finish</b>
&mdash; functions for reading objects from disk</p>
<p style="margin-top: 1em" valign="top"><b>SYNOPSIS</b></p>
<p style="margin-left:8%;"><b>#include
&lt;archive.h&gt;</b></p>
<p style="margin-left:8%; margin-top: 1em"><i>struct
archive *</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_new</b>(<i>void</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_set_symlink_logical</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_set_symlink_physical</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_set_symlink_hybrid</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_gname</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>gid_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_uname</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>uid_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_disk_set_gname_lookup</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*(*lookup)(void&nbsp;*,&nbsp;gid_t)</i>,
<i>void&nbsp;(*cleanup)(void&nbsp;*)</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_disk_set_uname_lookup</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*(*lookup)(void&nbsp;*,&nbsp;uid_t)</i>,
<i>void&nbsp;(*cleanup)(void&nbsp;*)</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_disk_set_standard_lookup</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_read_disk_entry_from_file</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive_entry&nbsp;*</i>, <i>int&nbsp;fd</i>,
<i>const&nbsp;struct&nbsp;stat&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_close</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_read_finish</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-top: 1em" valign="top"><b>DESCRIPTION</b></p>
<p style="margin-left:8%;">These functions provide an API
for reading information about objects on disk. In
particular, they provide an interface for populating struct
archive_entry objects.</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_disk_new</b>()</p>
<p style="margin-left:20%;">Allocates and initializes a
struct archive object suitable for reading object
information from disk.</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_disk_set_symlink_logical</b>(),
<b>archive_read_disk_set_symlink_physical</b>(),
<b>archive_read_disk_set_symlink_hybrid</b>()</p>
<p style="margin-left:20%;">This sets the mode used for
handling symbolic links. The
&lsquo;&lsquo;logical&rsquo;&rsquo; mode follows all
symbolic links. The &lsquo;&lsquo;physical&rsquo;&rsquo;
mode does not follow any symbolic links. The
&lsquo;&lsquo;hybrid&rsquo;&rsquo; mode currently behaves
identically to the &lsquo;&lsquo;logical&rsquo;&rsquo;
mode.</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_disk_gname</b>(),
<b>archive_read_disk_uname</b>()</p>
<p style="margin-left:20%;">Returns a user or group name
given a gid or uid value. By default, these always return a
NULL string.</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_disk_set_gname_lookup</b>(),
<b>archive_read_disk_set_uname_lookup</b>()</p>
<p style="margin-left:20%;">These allow you to override the
functions used for user and group name lookups. You may also
provide a void * pointer to a private data structure and a
cleanup function for that data. The cleanup function will be
invoked when the struct archive object is destroyed or when
new lookup functions are registered.</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_disk_set_standard_lookup</b>()</p>
<p style="margin-left:20%;">This convenience function
installs a standard set of user and group name lookup
functions. These functions use getpwid(3) and getgrid(3) to
convert ids to names, defaulting to NULL if the names cannot
be looked up. These functions also implement a simple memory
cache to reduce the number of calls to getpwid(3) and
getgrid(3).</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_disk_entry_from_file</b>()</p>
<p style="margin-left:20%;">Populates a struct
archive_entry object with information about a particular
file. The archive_entry object must have already been
created with archive_entry_new(3) and at least one of the
source path or path fields must already be set. (If both are
set, the source path will be used.)</p>
<p style="margin-left:20%; margin-top: 1em">Information is
read from disk using the path name from the struct
archive_entry object. If a file descriptor is provided, some
information will be obtained using that file descriptor, on
platforms that support the appropriate system calls.</p>
<p style="margin-left:20%; margin-top: 1em">If a pointer to
a struct stat is provided, information from that structure
will be used instead of reading from the disk where
appropriate. This can provide performance benefits in
scenarios where struct stat information has already been
read from the disk as a side effect of some other operation.
(For example, directory traversal libraries often provide
this information.)</p>
<p style="margin-left:20%; margin-top: 1em">Where
necessary, user and group ids are converted to user and
group names using the currently registered lookup functions
above. This affects the file ownership fields and ACL values
in the struct archive_entry object.</p>
<p style="margin-top: 1em" valign="top"><b>archive_read_close</b>()</p>
<p style="margin-left:20%;">This currently does
nothing.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_finish</b>()</p>
<p style="margin-left:20%;">Invokes
<b>archive_write_close</b>() if it was not invoked manually,
then releases all resources.</p>
<p style="margin-left:8%;">More information about the
<i>struct archive</i> object and the overall design of the
library can be found in the libarchive(3) overview.</p>
<p style="margin-top: 1em" valign="top"><b>EXAMPLE</b></p>
<p style="margin-left:8%;">The following illustrates basic
usage of the library by showing how to use it to copy an
item on disk into an archive.</p>
<p style="margin-left:17%; margin-top: 1em">void <br>
file_to_archive(struct archive *a, const char *name) <br>
{ <br>
char buff[8192]; <br>
size_t bytes_read; <br>
struct archive *ard; <br>
struct archive_entry *entry; <br>
int fd;</p>
<p style="margin-left:17%; margin-top: 1em">ard =
archive_read_disk_new(); <br>
archive_read_disk_set_standard_lookup(ard); <br>
entry = archive_entry_new(); <br>
fd = open(name, O_RDONLY); <br>
if (fd &lt; 0) <br>
return; <br>
archive_entry_copy_sourcepath(entry, name); <br>
archive_read_disk_entry_from_file(ard, entry, fd, NULL);
<br>
archive_write_header(a, entry); <br>
while ((bytes_read = read(fd, buff, sizeof(buff))) &gt; 0)
<br>
archive_write_data(a, buff, bytes_read); <br>
archive_write_finish_entry(a); <br>
archive_read_finish(ard); <br>
archive_entry_free(entry); <br>
}</p>
<p style="margin-top: 1em" valign="top"><b>RETURN
VALUES</b></p>
<p style="margin-left:8%;">Most functions return
<b>ARCHIVE_OK</b> (zero) on success, or one of several
negative error codes for errors. Specific error codes
include: <b>ARCHIVE_RETRY</b> for operations that might
succeed if retried, <b>ARCHIVE_WARN</b> for unusual
conditions that do not prevent further operations, and
<b>ARCHIVE_FATAL</b> for serious errors that make remaining
operations impossible. The archive_errno(3) and
archive_error_string(3) functions can be used to retrieve an
appropriate error code and a textual error message. (See
archive_util(3) for details.)</p>
<p style="margin-left:8%; margin-top: 1em"><b>archive_read_disk_new</b>()
returns a pointer to a newly-allocated struct archive object
or NULL if the allocation failed for any reason.</p>
<p style="margin-left:8%; margin-top: 1em"><b>archive_read_disk_gname</b>()
and <b>archive_read_disk_uname</b>() return const char *
pointers to the textual name or NULL if the lookup failed
for any reason. The returned pointer points to internal
storage that may be reused on the next call to either of
these functions; callers should copy the string if they need
to continue accessing it.</p>
<p style="margin-top: 1em" valign="top"><b>SEE ALSO</b></p>
<p style="margin-left:8%;">archive_read(3),
archive_write(3), archive_write_disk(3), tar(1),
libarchive(3)</p>
<p style="margin-top: 1em" valign="top"><b>HISTORY</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
first appeared in FreeBSD&nbsp;5.3. The
<b>archive_read_disk</b> interface was added to
<b>libarchive 2.6</b> and first appeared in
FreeBSD&nbsp;8.0.</p>
<p style="margin-top: 1em" valign="top"><b>AUTHORS</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
was written by Tim Kientzle
&lang;kientzle@freebsd.org&rang;.</p>
<p style="margin-top: 1em" valign="top"><b>BUGS</b></p>
<p style="margin-left:8%;">The
&lsquo;&lsquo;standard&rsquo;&rsquo; user name and group
name lookup functions are not the defaults because
getgrid(3) and getpwid(3) are sometimes too large for
particular applications. The current design allows the
application author to use a more compact implementation when
appropriate.</p>
<p style="margin-left:8%; margin-top: 1em">The full list of
metadata read from disk by
<b>archive_read_disk_entry_from_file</b>() is necessarily
system-dependent.</p>
<p style="margin-left:8%; margin-top: 1em">The
<b>archive_read_disk_entry_from_file</b>() function reads as
much information as it can from disk. Some method should be
provided to limit this so that clients who do not need ACLs,
for instance, can avoid the extra work needed to look up
such information.</p>
<p style="margin-left:8%; margin-top: 1em">This API should
provide a set of methods for walking a directory tree. That
would make it a direct parallel of the archive_read(3) API.
When such methods are implemented, the
&lsquo;&lsquo;hybrid&rsquo;&rsquo; symbolic link mode will
make sense.</p>
<p style="margin-left:8%; margin-top: 1em">FreeBSD&nbsp;8.0
March&nbsp;10, 2009 FreeBSD&nbsp;8.0</p>
<hr>
</body>
</html>

View file

@ -0,0 +1,210 @@
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Thu Feb 4 20:36:32 2010 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; }
pre { margin-top: 0; margin-bottom: 0; }
table { margin-top: 0; margin-bottom: 0; }
</style>
<title></title>
</head>
<body>
<hr>
<p valign="top">archive_util(3) FreeBSD Library Functions
Manual archive_util(3)</p>
<p style="margin-top: 1em" valign="top"><b>NAME</b></p>
<p style="margin-left:8%;"><b>archive_clear_error</b>,
<b>archive_compression</b>, <b>archive_compression_name</b>,
<b>archive_copy_error</b>, <b>archive_errno</b>,
<b>archive_error_string</b>, <b>archive_file_count</b>,
<b>archive_format</b>, <b>archive_format_name</b>,
<b>archive_set_error</b> &mdash; libarchive utility
functions</p>
<p style="margin-top: 1em" valign="top"><b>SYNOPSIS</b></p>
<p style="margin-left:8%;"><b>#include
&lt;archive.h&gt;</b></p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_clear_error</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_compression</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_compression_name</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p style="margin-left:14%;"><b>archive_copy_error</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_errno</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_error_string</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_file_count</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_format</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>const char
*</i></p>
<p style="margin-left:14%;"><b>archive_format_name</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>void</i></p>
<p valign="top"><b>archive_set_error</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int&nbsp;error_code</i>,
<i>const&nbsp;char&nbsp;*fmt</i>, <i>...</i>);</p>
<p style="margin-top: 1em" valign="top"><b>DESCRIPTION</b></p>
<p style="margin-left:8%;">These functions provide access
to various information about the struct archive object used
in the libarchive(3) library.</p>
<p valign="top"><b>archive_clear_error</b>()</p>
<p style="margin-left:20%;">Clears any error information
left over from a previous call. Not generally used in client
code.</p>
<p valign="top"><b>archive_compression</b>()</p>
<p style="margin-left:20%;">Returns a numeric code
indicating the current compression. This value is set by
<b>archive_read_open</b>().</p>
<p valign="top"><b>archive_compression_name</b>()</p>
<p style="margin-left:20%;">Returns a text description of
the current compression suitable for display.</p>
<p valign="top"><b>archive_copy_error</b>()</p>
<p style="margin-left:20%;">Copies error information from
one archive to another.</p>
<p valign="top"><b>archive_errno</b>()</p>
<p style="margin-left:20%;">Returns a numeric error code
(see errno(2)) indicating the reason for the most recent
error return.</p>
<p valign="top"><b>archive_error_string</b>()</p>
<p style="margin-left:20%;">Returns a textual error message
suitable for display. The error message here is usually more
specific than that obtained from passing the result of
<b>archive_errno</b>() to strerror(3).</p>
<p valign="top"><b>archive_file_count</b>()</p>
<p style="margin-left:20%;">Returns a count of the number
of files processed by this archive object. The count is
incremented by calls to archive_write_header or
archive_read_next_header.</p>
<p valign="top"><b>archive_format</b>()</p>
<p style="margin-left:20%;">Returns a numeric code
indicating the format of the current archive entry. This
value is set by a successful call to
<b>archive_read_next_header</b>(). Note that it is common
for this value to change from entry to entry. For example, a
tar archive might have several entries that utilize GNU tar
extensions and several entries that do not. These entries
will have different format codes.</p>
<p valign="top"><b>archive_format_name</b>()</p>
<p style="margin-left:20%;">A textual description of the
format of the current entry.</p>
<p valign="top"><b>archive_set_error</b>()</p>
<p style="margin-left:20%;">Sets the numeric error code and
error description that will be returned by
<b>archive_errno</b>() and <b>archive_error_string</b>().
This function should be used within I/O callbacks to set
system-specific error codes and error descriptions. This
function accepts a printf-like format string and arguments.
However, you should be careful to use only the following
printf format specifiers: &lsquo;&lsquo;%c&rsquo;&rsquo;,
&lsquo;&lsquo;%d&rsquo;&rsquo;,
&lsquo;&lsquo;%jd&rsquo;&rsquo;,
&lsquo;&lsquo;%jo&rsquo;&rsquo;,
&lsquo;&lsquo;%ju&rsquo;&rsquo;,
&lsquo;&lsquo;%jx&rsquo;&rsquo;,
&lsquo;&lsquo;%ld&rsquo;&rsquo;,
&lsquo;&lsquo;%lo&rsquo;&rsquo;,
&lsquo;&lsquo;%lu&rsquo;&rsquo;,
&lsquo;&lsquo;%lx&rsquo;&rsquo;,
&lsquo;&lsquo;%o&rsquo;&rsquo;,
&lsquo;&lsquo;%u&rsquo;&rsquo;,
&lsquo;&lsquo;%s&rsquo;&rsquo;,
&lsquo;&lsquo;%x&rsquo;&rsquo;,
&lsquo;&lsquo;%%&rsquo;&rsquo;. Field-width specifiers and
other printf features are not uniformly supported and should
not be used.</p>
<p style="margin-top: 1em" valign="top"><b>SEE ALSO</b></p>
<p style="margin-left:8%;">archive_read(3),
archive_write(3), libarchive(3), printf(3)</p>
<p style="margin-top: 1em" valign="top"><b>HISTORY</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
first appeared in FreeBSD&nbsp;5.3.</p>
<p style="margin-top: 1em" valign="top"><b>AUTHORS</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
was written by Tim Kientzle
&lang;kientzle@acm.org&rang;.</p>
<p style="margin-left:8%; margin-top: 1em">FreeBSD&nbsp;8.0
January&nbsp;8, 2005 FreeBSD&nbsp;8.0</p>
<hr>
</body>
</html>

View file

@ -0,0 +1,845 @@
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Thu Feb 4 20:36:33 2010 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; }
pre { margin-top: 0; margin-bottom: 0; }
table { margin-top: 0; margin-bottom: 0; }
</style>
<title></title>
</head>
<body>
<hr>
<p valign="top">archive_write(3) FreeBSD Library Functions
Manual archive_write(3)</p>
<p style="margin-top: 1em" valign="top"><b>NAME</b></p>
<p style="margin-left:8%;"><b>archive_write_new</b>,
<b>archive_write_set_format_cpio</b>,
<b>archive_write_set_format_pax</b>,
<b>archive_write_set_format_pax_restricted</b>,
<b>archive_write_set_format_shar</b>,
<b>archive_write_set_format_shar_binary</b>,
<b>archive_write_set_format_ustar</b>,
<b>archive_write_get_bytes_per_block</b>,
<b>archive_write_set_bytes_per_block</b>,
<b>archive_write_set_bytes_in_last_block</b>,
<b>archive_write_set_compression_bzip2</b>,
<b>archive_write_set_compression_compress</b>,
<b>archive_write_set_compression_gzip</b>,
<b>archive_write_set_compression_none</b>,
<b>archive_write_set_compression_program</b>,
<b>archive_write_set_compressor_options</b>,
<b>archive_write_set_format_options</b>,
<b>archive_write_set_options</b>, <b>archive_write_open</b>,
<b>archive_write_open_fd</b>,
<b>archive_write_open_FILE</b>,
<b>archive_write_open_filename</b>,
<b>archive_write_open_memory</b>,
<b>archive_write_header</b>, <b>archive_write_data</b>,
<b>archive_write_finish_entry</b>,
<b>archive_write_close</b>, <b>archive_write_finish</b>
&mdash; functions for creating archives</p>
<p style="margin-top: 1em" valign="top"><b>SYNOPSIS</b></p>
<p style="margin-left:8%;"><b>#include
&lt;archive.h&gt;</b></p>
<p style="margin-left:8%; margin-top: 1em"><i>struct
archive *</i></p>
<p style="margin-left:14%;"><b>archive_write_new</b>(<i>void</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_get_bytes_per_block</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_bytes_per_block</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int&nbsp;bytes_per_block</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_bytes_in_last_block</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_compression_bzip2</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_compression_compress</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_compression_gzip</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_compression_none</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_compression_program</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*&nbsp;cmd</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_cpio</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_pax</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_pax_restricted</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_shar</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_shar_binary</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_ustar</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_format_options</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_compressor_options</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_set_options</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_write_open</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*client_data</i>,
<i>archive_open_callback&nbsp;*</i>,
<i>archive_write_callback&nbsp;*</i>,
<i>archive_close_callback&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_open_fd</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int&nbsp;fd</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_open_FILE</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>FILE&nbsp;*file</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_open_filename</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;char&nbsp;*filename</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p valign="top"><b>archive_write_open_memory</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*buffer</i>, <i>size_t&nbsp;bufferSize</i>,
<i>size_t&nbsp;*outUsed</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_header</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive_entry&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>ssize_t</i></p>
<p style="margin-left:14%;"><b>archive_write_data</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>const&nbsp;void&nbsp;*</i>, <i>size_t</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_finish_entry</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_close</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-left:8%; margin-top: 1em"><i>int</i></p>
<p style="margin-left:14%;"><b>archive_write_finish</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
<p style="margin-top: 1em" valign="top"><b>DESCRIPTION</b></p>
<p style="margin-left:8%;">These functions provide a
complete API for creating streaming archive files. The
general process is to first create the struct archive
object, set any desired options, initialize the archive,
append entries, then close the archive and release all
resources. The following summary describes the functions in
approximately the order they are ordinarily used:</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_new</b>()</p>
<p style="margin-left:20%;">Allocates and initializes a
struct archive object suitable for writing a tar
archive.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_set_bytes_per_block</b>()</p>
<p style="margin-left:20%;">Sets the block size used for
writing the archive data. Every call to the write callback
function, except possibly the last one, will use this value
for the length. The third parameter is a boolean that
specifies whether or not the final block written will be
padded to the full block size. If it is zero, the last block
will not be padded. If it is non-zero, padding will be added
both before and after compression. The default is to use a
block size of 10240 bytes and to pad the last block. Note
that a block size of zero will suppress internal blocking
and cause writes to be sent directly to the write callback
as they occur.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_get_bytes_per_block</b>()</p>
<p style="margin-left:20%;">Retrieve the block size to be
used for writing. A value of -1 here indicates that the
library should use default values. A value of zero indicates
that internal blocking is suppressed.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_set_bytes_in_last_block</b>()</p>
<p style="margin-left:20%;">Sets the block size used for
writing the last block. If this value is zero, the last
block will be padded to the same size as the other blocks.
Otherwise, the final block will be padded to a multiple of
this size. In particular, setting it to 1 will cause the
final block to not be padded. For compressed output, any
padding generated by this option is applied only after the
compression. The uncompressed data is always unpadded. The
default is to pad the last block to the full block size
(note that <b>archive_write_open_filename</b>() will set
this based on the file type). Unlike the other
&lsquo;&lsquo;set&rsquo;&rsquo; functions, this function can
be called after the archive is opened.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_get_bytes_in_last_block</b>()</p>
<p style="margin-left:20%;">Retrieve the currently-set
value for last block size. A value of -1 here indicates that
the library should use default values.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_set_format_cpio</b>(),
<b>archive_write_set_format_pax</b>(),
<b>archive_write_set_format_pax_restricted</b>(),
<b>archive_write_set_format_shar</b>(),
<b>archive_write_set_format_shar_binary</b>(),
<b>archive_write_set_format_ustar</b>()</p>
<p style="margin-left:20%;">Sets the format that will be
used for the archive. The library can write POSIX
octet-oriented cpio format archives, POSIX-standard
&lsquo;&lsquo;pax interchange&rsquo;&rsquo; format archives,
traditional &lsquo;&lsquo;shar&rsquo;&rsquo; archives,
enhanced &lsquo;&lsquo;binary&rsquo;&rsquo; shar archives
that store a variety of file attributes and handle binary
files, and POSIX-standard &lsquo;&lsquo;ustar&rsquo;&rsquo;
archives. The pax interchange format is a
backwards-compatible tar format that adds key/value
attributes to each entry and supports arbitrary filenames,
linknames, uids, sizes, etc. &lsquo;&lsquo;Restricted pax
interchange format&rsquo;&rsquo; is the library default;
this is the same as pax format, but suppresses the pax
extended header for most normal files. In most cases, this
will result in ordinary ustar archives.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_set_compression_bzip2</b>(),
<b>archive_write_set_compression_compress</b>(),
<b>archive_write_set_compression_gzip</b>(),
<b>archive_write_set_compression_none</b>()</p>
<p style="margin-left:20%;">The resulting archive will be
compressed as specified. Note that the compressed output is
always properly blocked.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_set_compression_program</b>()</p>
<p style="margin-left:20%;">The archive will be fed into
the specified compression program. The output of that
program is blocked and written to the client write
callbacks.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_set_compressor_options</b>(),
<b>archive_write_set_format_options</b>(),
<b>archive_write_set_options</b>()</p>
<p style="margin-left:20%;">Specifies options that will be
passed to the currently-enabled compressor and/or format
writer. The argument is a comma-separated list of individual
options. Individual options have one of the following
forms:</p>
<p valign="top"><i>option=value</i></p>
<p style="margin-left:32%;">The option/value pair will be
provided to every module. Modules that do not accept an
option with this name will ignore it.</p>
<p valign="top"><i>option</i></p>
<p style="margin-left:32%; margin-top: 1em">The option will
be provided to every module with a value of
&lsquo;&lsquo;1&rsquo;&rsquo;.</p>
<p valign="top"><i>!option</i></p>
<p style="margin-left:32%;">The option will be provided to
every module with a NULL value.</p>
<p valign="top"><i>module:option=value</i>,
<i>module:option</i>, <i>module:!option</i></p>
<p style="margin-left:32%;">As above, but the corresponding
option and value will be provided only to modules whose name
matches <i>module</i>.</p>
<p style="margin-left:20%;">The return value will be
<b>ARCHIVE_OK</b> if any module accepts the option, or
<b>ARCHIVE_WARN</b> if no module accepted the option, or
<b>ARCHIVE_FATAL</b> if there was a fatal error while
attempting to process the option.</p>
<p style="margin-left:20%; margin-top: 1em">The currently
supported options are:</p>
<p valign="top">Compressor gzip <b><br>
compression-level</b></p>
<p style="margin-left:45%;">The value is interpreted as a
decimal integer specifying the gzip compression level.</p>
<p valign="top">Compressor xz <b><br>
compression-level</b></p>
<p style="margin-left:45%;">The value is interpreted as a
decimal integer specifying the compression level.</p>
<p valign="top">Format mtree <b><br>
cksum</b>, <b>device</b>, <b>flags</b>, <b>gid</b>,
<b>gname</b>, <b>indent</b>, <b>link</b>, <b>md5</b>,
<b>mode</b>, <b>nlink</b>, <b>rmd160</b>, <b>sha1</b>,
<b>sha256</b>, <b>sha384</b>, <b>sha512</b>, <b>size</b>,
<b>time</b>, <b>uid</b>, <b>uname</b></p>
<p style="margin-left:45%;">Enable a particular keyword in
the mtree output. Prefix with an exclamation mark to disable
the corresponding keyword. The default is equivalent to
&lsquo;&lsquo;device, flags, gid, gname, link, mode, nlink,
size, time, type, uid, uname&rsquo;&rsquo;.</p>
<p valign="top"><b>all</b></p>
<p style="margin-left:45%; margin-top: 1em">Enables all of
the above keywords.</p>
<p valign="top"><b>use-set</b></p>
<p style="margin-left:45%;">Enables generation of
<b>/set</b> lines that specify default values for the
following files and/or directories.</p>
<p valign="top"><b>indent</b></p>
<p style="margin-left:45%; margin-top: 1em">XXX needs
explanation XXX</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_open</b>()</p>
<p style="margin-left:20%;">Freeze the settings, open the
archive, and prepare for writing entries. This is the most
generic form of this function, which accepts pointers to
three callback functions which will be invoked by the
compression layer to write the constructed archive.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_open_fd</b>()</p>
<p style="margin-left:20%;">A convenience form of
<b>archive_write_open</b>() that accepts a file descriptor.
The <b>archive_write_open_fd</b>() function is safe for use
with tape drives or other block-oriented devices.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_open_FILE</b>()</p>
<p style="margin-left:20%;">A convenience form of
<b>archive_write_open</b>() that accepts a <i>FILE *</i>
pointer. Note that <b>archive_write_open_FILE</b>() is not
safe for writing to tape drives or other devices that
require correct blocking.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_open_file</b>()</p>
<p style="margin-left:20%;">A deprecated synonym for
<b>archive_write_open_filename</b>().</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_open_filename</b>()</p>
<p style="margin-left:20%;">A convenience form of
<b>archive_write_open</b>() that accepts a filename. A NULL
argument indicates that the output should be written to
standard output; an argument of
&lsquo;&lsquo;-&rsquo;&rsquo; will open a file with that
name. If you have not invoked
<b>archive_write_set_bytes_in_last_block</b>(), then
<b>archive_write_open_filename</b>() will adjust the
last-block padding depending on the file: it will enable
padding when writing to standard output or to a character or
block device node, it will disable padding otherwise. You
can override this by manually invoking
<b>archive_write_set_bytes_in_last_block</b>() before
calling <b>archive_write_open</b>(). The
<b>archive_write_open_filename</b>() function is safe for
use with tape drives or other block-oriented devices.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_open_memory</b>()</p>
<p style="margin-left:20%;">A convenience form of
<b>archive_write_open</b>() that accepts a pointer to a
block of memory that will receive the archive. The final
<i>size_t *</i> argument points to a variable that will be
updated after each write to reflect how much of the buffer
is currently in use. You should be careful to ensure that
this variable remains allocated until after the archive is
closed.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_header</b>()</p>
<p style="margin-left:20%;">Build and write a header using
the data in the provided struct archive_entry structure. See
archive_entry(3) for information on creating and populating
struct archive_entry objects.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_data</b>()</p>
<p style="margin-left:20%;">Write data corresponding to the
header just written. Returns number of bytes written or -1
on error.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_finish_entry</b>()</p>
<p style="margin-left:20%;">Close out the entry just
written. In particular, this writes out the final padding
required by some formats. Ordinarily, clients never need to
call this, as it is called automatically by
<b>archive_write_next_header</b>() and
<b>archive_write_close</b>() as needed.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_close</b>()</p>
<p style="margin-left:20%;">Complete the archive and invoke
the close callback.</p>
<p style="margin-top: 1em" valign="top"><b>archive_write_finish</b>()</p>
<p style="margin-left:20%;">Invokes
<b>archive_write_close</b>() if it was not invoked manually,
then releases all resources. Note that this function was
declared to return <i>void</i> in libarchive 1.x, which made
it impossible to detect errors when
<b>archive_write_close</b>() was invoked implicitly from
this function. This is corrected beginning with libarchive
2.0.</p>
<p style="margin-left:8%;">More information about the
<i>struct archive</i> object and the overall design of the
library can be found in the libarchive(3) overview.</p>
<p style="margin-top: 1em" valign="top"><b>IMPLEMENTATION</b></p>
<p style="margin-left:8%;">Compression support is built-in
to libarchive, which uses zlib and bzlib to handle gzip and
bzip2 compression, respectively.</p>
<p style="margin-top: 1em" valign="top"><b>CLIENT
CALLBACKS</b></p>
<p style="margin-left:8%;">To use this library, you will
need to define and register callback functions that will be
invoked to write data to the resulting archive. These
functions are registered by calling
<b>archive_write_open</b>():</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
int</i> <b>archive_open_callback</b>(<i>struct archive
*</i>, <i>void *client_data</i>)</p>
<p style="margin-left:8%; margin-top: 1em">The open
callback is invoked by <b>archive_write_open</b>(). It
should return <b>ARCHIVE_OK</b> if the underlying file or
data source is successfully opened. If the open fails, it
should call <b>archive_set_error</b>() to register an error
code and message and return <b>ARCHIVE_FATAL</b>.</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
ssize_t</i></p>
<p valign="top"><b>archive_write_callback</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>void&nbsp;*client_data</i>,
<i>const&nbsp;void&nbsp;*buffer</i>,
<i>size_t&nbsp;length</i>)</p>
<p style="margin-left:8%; margin-top: 1em">The write
callback is invoked whenever the library needs to write raw
bytes to the archive. For correct blocking, each call to the
write callback function should translate into a single
write(2) system call. This is especially critical when
writing archives to tape drives. On success, the write
callback should return the number of bytes actually written.
On error, the callback should invoke
<b>archive_set_error</b>() to register an error code and
message and return -1.</p>
<p style="margin-left:17%; margin-top: 1em"><i>typedef
int</i> <b>archive_close_callback</b>(<i>struct archive
*</i>, <i>void *client_data</i>)</p>
<p style="margin-left:8%; margin-top: 1em">The close
callback is invoked by archive_close when the archive
processing is complete. The callback should return
<b>ARCHIVE_OK</b> on success. On failure, the callback
should invoke <b>archive_set_error</b>() to register an
error code and message and return <b>ARCHIVE_FATAL.</b></p>
<p style="margin-top: 1em" valign="top"><b>EXAMPLE</b></p>
<p style="margin-left:8%;">The following sketch illustrates
basic usage of the library. In this example, the callback
functions are simply wrappers around the standard open(2),
write(2), and close(2) system calls.</p>
<p style="margin-left:17%; margin-top: 1em">#ifdef
__linux__</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="17%"></td>
<td width="12%">
<p valign="top">#define</p></td>
<td width="13%">
<p valign="top">_FILE_OFFSET_BITS 64</p></td>
<td width="58%">
</td>
</table>
<p style="margin-left:17%;">#endif <br>
#include &lt;sys/stat.h&gt; <br>
#include &lt;archive.h&gt; <br>
#include &lt;archive_entry.h&gt; <br>
#include &lt;fcntl.h&gt; <br>
#include &lt;stdlib.h&gt; <br>
#include &lt;unistd.h&gt;</p>
<p style="margin-left:17%; margin-top: 1em">struct mydata
{</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">const char *name;</p></td>
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">int fd;</p></td>
</table>
<p style="margin-left:17%;">};</p>
<p style="margin-left:17%; margin-top: 1em">int <br>
myopen(struct archive *a, void *client_data) <br>
{ <br>
struct mydata *mydata = client_data;</p>
<p style="margin-left:17%; margin-top: 1em">mydata-&gt;fd =
open(mydata-&gt;name, O_WRONLY | O_CREAT, 0644); <br>
if (mydata-&gt;fd &gt;= 0) <br>
return (ARCHIVE_OK); <br>
else <br>
return (ARCHIVE_FATAL); <br>
}</p>
<p style="margin-left:17%; margin-top: 1em">ssize_t <br>
mywrite(struct archive *a, void *client_data, const void
*buff, size_t n) <br>
{ <br>
struct mydata *mydata = client_data;</p>
<p style="margin-left:17%; margin-top: 1em">return
(write(mydata-&gt;fd, buff, n)); <br>
}</p>
<p style="margin-left:17%; margin-top: 1em">int <br>
myclose(struct archive *a, void *client_data) <br>
{ <br>
struct mydata *mydata = client_data;</p>
<p style="margin-left:17%; margin-top: 1em">if
(mydata-&gt;fd &gt; 0) <br>
close(mydata-&gt;fd); <br>
return (0); <br>
}</p>
<p style="margin-left:17%; margin-top: 1em">void <br>
write_archive(const char *outname, const char **filename)
<br>
{ <br>
struct mydata *mydata = malloc(sizeof(struct mydata)); <br>
struct archive *a; <br>
struct archive_entry *entry; <br>
struct stat st; <br>
char buff[8192]; <br>
int len; <br>
int fd;</p>
<p style="margin-left:17%; margin-top: 1em">a =
archive_write_new(); <br>
mydata-&gt;name = outname; <br>
archive_write_set_compression_gzip(a); <br>
archive_write_set_format_ustar(a); <br>
archive_write_open(a, mydata, myopen, mywrite, myclose);
<br>
while (*filename) { <br>
stat(*filename, &amp;st); <br>
entry = archive_entry_new(); <br>
archive_entry_copy_stat(entry, &amp;st); <br>
archive_entry_set_pathname(entry, *filename); <br>
archive_write_header(a, entry); <br>
fd = open(*filename, O_RDONLY); <br>
len = read(fd, buff, sizeof(buff)); <br>
while ( len &gt; 0 ) {</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">archive_write_data(a, buff, len);</p></td>
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">len = read(fd, buff, sizeof(buff));</p></td>
</table>
<p style="margin-left:17%;">} <br>
archive_entry_free(entry); <br>
filename++; <br>
} <br>
archive_write_finish(a); <br>
}</p>
<p style="margin-left:17%; margin-top: 1em">int main(int
argc, const char **argv) <br>
{</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">const char *outname;</p></td>
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">argv++;</p></td>
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">outname = argv++;</p></td>
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">write_archive(outname, argv);</p></td>
<tr valign="top" align="left">
<td width="29%"></td>
<td width="71%">
<p valign="top">return 0;</p></td>
</table>
<p style="margin-left:17%;">}</p>
<p style="margin-top: 1em" valign="top"><b>RETURN
VALUES</b></p>
<p style="margin-left:8%;">Most functions return
<b>ARCHIVE_OK</b> (zero) on success, or one of several
non-zero error codes for errors. Specific error codes
include: <b>ARCHIVE_RETRY</b> for operations that might
succeed if retried, <b>ARCHIVE_WARN</b> for unusual
conditions that do not prevent further operations, and
<b>ARCHIVE_FATAL</b> for serious errors that make remaining
operations impossible. The <b>archive_errno</b>() and
<b>archive_error_string</b>() functions can be used to
retrieve an appropriate error code and a textual error
message.</p>
<p style="margin-left:8%; margin-top: 1em"><b>archive_write_new</b>()
returns a pointer to a newly-allocated struct archive
object.</p>
<p style="margin-left:8%; margin-top: 1em"><b>archive_write_data</b>()
returns a count of the number of bytes actually written. On
error, -1 is returned and the <b>archive_errno</b>() and
<b>archive_error_string</b>() functions will return
appropriate values. Note that if the client-provided write
callback function returns a non-zero value, that error will
be propagated back to the caller through whatever API
function resulted in that call, which may include
<b>archive_write_header</b>(), <b>archive_write_data</b>(),
<b>archive_write_close</b>(), or
<b>archive_write_finish</b>(). The client callback can call
<b>archive_set_error</b>() to provide values that can then
be retrieved by <b>archive_errno</b>() and
<b>archive_error_string</b>().</p>
<p style="margin-top: 1em" valign="top"><b>SEE ALSO</b></p>
<p style="margin-left:8%;">tar(1), libarchive(3),
tar(5)</p>
<p style="margin-top: 1em" valign="top"><b>HISTORY</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
first appeared in FreeBSD&nbsp;5.3.</p>
<p style="margin-top: 1em" valign="top"><b>AUTHORS</b></p>
<p style="margin-left:8%;">The <b>libarchive</b> library
was written by Tim Kientzle
&lang;kientzle@acm.org&rang;.</p>
<p style="margin-top: 1em" valign="top"><b>BUGS</b></p>
<p style="margin-left:8%;">There are many peculiar bugs in
historic tar implementations that may cause certain programs
to reject archives written by this library. For example,
several historic implementations calculated header checksums
incorrectly and will thus reject valid archives; GNU tar
does not fully support pax interchange format; some old tar
implementations required specific field terminations.</p>
<p style="margin-left:8%; margin-top: 1em">The default pax
interchange format eliminates most of the historic tar
limitations and provides a generic key/value attribute
facility for vendor-defined extensions. One oversight in
POSIX is the failure to provide a standard attribute for
large device numbers. This library uses
&lsquo;&lsquo;SCHILY.devminor&rsquo;&rsquo; and
&lsquo;&lsquo;SCHILY.devmajor&rsquo;&rsquo; for device
numbers that exceed the range supported by the
backwards-compatible ustar header. These keys are compatible
with Joerg Schilling&rsquo;s <b>star</b> archiver. Other
implementations may not recognize these keys and will thus
be unable to correctly restore device nodes with large
device numbers from archives created by this library.</p>
<p style="margin-left:8%; margin-top: 1em">FreeBSD&nbsp;8.0
May&nbsp;11, 2008 FreeBSD&nbsp;8.0</p>
<hr>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more