mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-13 03:22:40 -04:00
Core/Dep: Remove libzip
--HG-- branch : trunk
This commit is contained in:
@@ -58,12 +58,10 @@ if(WIN32)
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/dep/zlib
|
||||
${CMAKE_SOURCE_DIR}/dep/libzip/lib
|
||||
)
|
||||
else()
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/dep/libzip/lib
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Dieter Baron <dillo@giga.or.at>
|
||||
Thomas Klausner <tk@giga.or.at>
|
||||
@@ -1,99 +0,0 @@
|
||||
# $NiH: CMakeLists.txt,v 1.1 2007/03/04 10:35:17 wiz Exp $
|
||||
|
||||
# XXX: TODO
|
||||
# 1. pkgconfig file not yet built.
|
||||
# 2. installation not tested.
|
||||
# 3. Problems generating html pages.
|
||||
# 4. distribution tarball not checked for unwanted/missing content.
|
||||
# 5. create usable libtool .la file
|
||||
|
||||
PROJECT(libzip C)
|
||||
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
INCLUDE(CheckSymbolExists)
|
||||
|
||||
SET(PACKAGE "libzip")
|
||||
SET(PACKAGE_NAME ${PACKAGE})
|
||||
SET(PACKAGE_VERSION_MAJOR "0")
|
||||
SET(PACKAGE_VERSION_MINOR "9")
|
||||
SET(PACKAGE_VERSION_PATCH "3")
|
||||
SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
|
||||
SET(PACKAGE_VERSION ${VERSION})
|
||||
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
|
||||
ADD_SUBDIRECTORY(lib)
|
||||
ADD_SUBDIRECTORY(man)
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(regress)
|
||||
|
||||
# Checks
|
||||
|
||||
CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
|
||||
CHECK_FUNCTION_EXISTS(MoveFileEx HAVE_MOVEFILEEX)
|
||||
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
|
||||
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
||||
|
||||
INCLUDE(FindZLIB)
|
||||
CHECK_SYMBOL_EXISTS(ZEXPORT zlib.h HAVE_ZEXPORT)
|
||||
IF(NOT HAVE_ZEXPORT)
|
||||
MESSAGE(FATAL_ERROR "-- ZLIB version too old, please install at least v1.1.2")
|
||||
ENDIF(NOT HAVE_ZEXPORT)
|
||||
|
||||
# Targets
|
||||
|
||||
# XXX: pkgconfig file
|
||||
|
||||
# installation
|
||||
|
||||
# XXX: pkgconfig file
|
||||
|
||||
# packaging
|
||||
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "library for manipulating zip archives")
|
||||
SET(CPACK_PACKAGE_VENDOR "Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at>")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
|
||||
# XXX: provide a license file
|
||||
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
|
||||
SET(CPACK_GENERATOR "TGZ")
|
||||
SET(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
SET(CPACK_SOURCE_IGNORE_FILES
|
||||
".a$"
|
||||
".cmake$"
|
||||
".o$"
|
||||
".so$"
|
||||
"/.deps/"
|
||||
"/.libs/"
|
||||
"/CMakeFiles/"
|
||||
"/CVS/"
|
||||
"/autom4te.cache/"
|
||||
"/build"
|
||||
"/broken"
|
||||
"/docs/"
|
||||
"AdditionalInfo.txt$"
|
||||
"CMakeCache.txt$"
|
||||
"Makefile$"
|
||||
"\\\\.sh$"
|
||||
"_CPack_"
|
||||
"config.h$"
|
||||
"config.log$"
|
||||
"config.status$"
|
||||
"dccsend$"
|
||||
"dccserver$"
|
||||
"html$"
|
||||
"install_manifest.txt$"
|
||||
"stamp-h1$"
|
||||
"tar.bz2"
|
||||
"tar.gz"
|
||||
"~$"
|
||||
)
|
||||
SET(CPACK_SOURCE_STRIP_FILES "")
|
||||
INCLUDE(CPack)
|
||||
|
||||
# write out config file
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake-config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
@@ -1,229 +0,0 @@
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
@@ -1,16 +0,0 @@
|
||||
# not GPL, thus no COPYING
|
||||
AUTOMAKE_OPTIONS=dist-bzip2 foreign
|
||||
|
||||
ACLOCAL_AMFLAGS= -I m4
|
||||
|
||||
SUBDIRS=lib src man regress
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libzip.pc
|
||||
|
||||
EXTRA_DIST= LICENSE \
|
||||
CMakeLists.txt \
|
||||
cmake-config.h.in \
|
||||
libzip.pc.in \
|
||||
libzip-uninstalled.pc.in \
|
||||
m4
|
||||
@@ -1,784 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(srcdir)/libzip-uninstalled.pc.in $(srcdir)/libzip.pc.in \
|
||||
$(top_srcdir)/configure AUTHORS INSTALL NEWS THANKS TODO \
|
||||
compile config.guess config.sub depcomp install-sh ltmain.sh \
|
||||
missing mkinstalldirs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = libzip.pc libzip-uninstalled.pc
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
|
||||
DATA = $(pkgconfig_DATA)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANFMT = @MANFMT@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
# not GPL, thus no COPYING
|
||||
AUTOMAKE_OPTIONS = dist-bzip2 foreign
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = lib src man regress
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libzip.pc
|
||||
EXTRA_DIST = LICENSE \
|
||||
CMakeLists.txt \
|
||||
cmake-config.h.in \
|
||||
libzip.pc.in \
|
||||
libzip-uninstalled.pc.in \
|
||||
m4
|
||||
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
libzip.pc: $(top_builddir)/config.status $(srcdir)/libzip.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
libzip-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/libzip-uninstalled.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
install-pkgconfigDATA: $(pkgconfig_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgconfigDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-pkgconfigDATA
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-pkgconfigDATA
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||
ctags-recursive install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-pkgconfigDATA install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-pkgconfigDATA
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,57 +0,0 @@
|
||||
0.9.3 [2010/02/01]
|
||||
|
||||
* Include m4/ directory in distribution; some packagers need it.
|
||||
|
||||
0.9.2 [2010/01/31]
|
||||
|
||||
* Avoid passing uninitialized data to deflate().
|
||||
* Fix memory leak when closing zip archives.
|
||||
|
||||
0.9.1 [2010/01/24]
|
||||
|
||||
* Fix infinite loop on reading some broken files.
|
||||
* Optimization in time conversion (don't call localtime()).
|
||||
* Clear data descriptor flag in central directory, fixing Open Office files.
|
||||
* Allow more than 64k entries.
|
||||
|
||||
0.9 [2008/07/25]
|
||||
|
||||
* on Windows, explictly set dllimport/dllexport
|
||||
* remove erroneous references to GPL
|
||||
* add support for torrentzip
|
||||
* new functions: zip_get_archive_flag, zip_set_archive_flag
|
||||
* zip_source_zip: add flag to force recompression
|
||||
* zip_sorce_file: only keep file open while reading from it
|
||||
|
||||
0.8 [2007/06/06]
|
||||
|
||||
* fix for zip archives larger than 2GiB
|
||||
* fix zip_error_strerror to include libzip error string
|
||||
* add support for reading streamed zip files
|
||||
* new functions: zip_add_dir, zip_error_clear, zip_file_error_clear
|
||||
* add basic support for building with CMake (incomplete)
|
||||
|
||||
0.7.1 [2006/05/18]
|
||||
|
||||
* bugfix for zip_close
|
||||
|
||||
0.7 [2006/05/06]
|
||||
|
||||
* struct zip_stat increased for future encryption support
|
||||
* zip_add return value changed (now returns new index of added file)
|
||||
* shared library major bump because of previous two
|
||||
* added functions for reading and writing file and archive comments.
|
||||
New functions: zip_get_archive_comment, zip_get_file_comment,
|
||||
zip_set_archive_comment, zip_set_file_comment, zip_unchange_archive
|
||||
|
||||
0.6.1 [2005/07/14]
|
||||
|
||||
* various bug fixes
|
||||
|
||||
0.6 [2005/06/09]
|
||||
|
||||
* first standalone release
|
||||
* changed license to three-clause BSD
|
||||
* overhauled API
|
||||
* added man pages
|
||||
* install zipcmp and zipmerge
|
||||
@@ -1,27 +0,0 @@
|
||||
This is libzip, a C library for reading, creating, and modifying zip
|
||||
archives. Files can be added from data buffers, files, or compressed
|
||||
data copied directly from other zip archives. Changes made without
|
||||
closing the archive can be reverted. The API is documented by man
|
||||
pages.
|
||||
|
||||
For more information, take a look at the included man pages. You
|
||||
can start with libzip(3), which lists all others. Example source code
|
||||
is in the src/ subdirectory.
|
||||
|
||||
For generic installation instructions, see file `INSTALL'.
|
||||
Additionally, you'll need zlib (at least version 1.1.2). It comes
|
||||
with most operating systems nowadays, or you can get it at
|
||||
http://www.gzip.org/zlib/
|
||||
|
||||
If you make a binary distribution, please include a pointer to the
|
||||
distribution site:
|
||||
http://www.nih.at/libzip/
|
||||
ftp.nih.at /pub/nih/libzip
|
||||
The latest version can always be found there.
|
||||
|
||||
Mail suggestions and bug reports to <libzip@nih.at>.
|
||||
|
||||
There is also a mailing list for developers using libzip. You can
|
||||
subscribe to it by sending a mail with the subject "subscribe libzip-discuss"
|
||||
to minimalist at nih.at. List mail should be sent to libzip-discuss at
|
||||
nih.at.
|
||||
@@ -1,12 +0,0 @@
|
||||
Thanks to Info-ZIP for info on the DOS-time/date conversion code,
|
||||
and some other general information gathered from their sources.
|
||||
|
||||
Thanks to these people for suggestions, testing, and bug reports:
|
||||
|
||||
Alexander Galanin <al@galanin.nnov.ru>
|
||||
Heiko Hund <heiko@ist.eigentlich.net>
|
||||
Joel Ebrahimi <joel.ebrahimi@gmail.com>
|
||||
Pierre Joye <pierre.php@gmail.com>
|
||||
Roberto Tirabassi <rtirabassi@3di.it>
|
||||
Simon Talbot <simont@nse.co.uk>
|
||||
Stephen Bryant <steve@bawue.de>
|
||||
105
dep/libzip/TODO
105
dep/libzip/TODO
@@ -1,105 +0,0 @@
|
||||
+ [portability] no off_t in API
|
||||
+ [portability] use _setmode(_fileno(fp), _O_BINARY); where present
|
||||
+ [bug] _zip_u2d_time: handle localtime(3) failure
|
||||
+ [bug] missing -Wl,-R in pkg-config file
|
||||
+ [bug] check/cleanup flags bit 3 (streaming) support
|
||||
- [feature] zip_fdopen (read zip from file descriptor), ZIP_AFL_RDONLY
|
||||
- [feature] Windows support: (paritally fixed?)
|
||||
. better mkstemp replacement function (no getpid; other problems?)
|
||||
. snprintf replacement
|
||||
. strcasecmp replacement
|
||||
. ssize_t define
|
||||
. mode_t define
|
||||
. dll_export/dll_import support (to clarify)
|
||||
- [cleanup] remove now useless check of fseek
|
||||
- [consistency check] check that local headers come before central dir
|
||||
- [bug] zip_open: consistency check: check data descriptor
|
||||
- [bug] do not compress if storing is smaller
|
||||
- [bug] zip_open: check whether file can be created and fail if not
|
||||
- [bug] check for limits imposed by format (central dir size, file size, ...)
|
||||
- [feature] handle zip_open/zip_close "race" for new files
|
||||
- [feature] support streaming output (creating new archive to e.g. stdout)
|
||||
- [feature] add functions to:
|
||||
. set compression method for new/changed entry
|
||||
. set last modification time for entry
|
||||
. read/set EAs
|
||||
. parse/create some EAs?
|
||||
. read/set ASCII file flag
|
||||
- [test] rename deleted (fails)
|
||||
- [test] rename file to dir/ and vice versa (fails)
|
||||
------------------------------------------------ API ideas
|
||||
struct zip *zip_open_encrypted(const char *path, int flags,
|
||||
const char *password, int *errorp);
|
||||
void zip_set_default_password(struct zip *archive, const char *password);
|
||||
(NULL for unsetting)
|
||||
|
||||
struct zip_file *zip_fopen_encrypted(struct zip *archive,
|
||||
const char *fname, int flags,
|
||||
const char *password);
|
||||
struct zip_file *zip_fopen_index_encrypted(struct zip *archive,
|
||||
int index, int flags,
|
||||
const char *password);
|
||||
|
||||
int zip_set_encryption(struct zip *archive, int idx, int method,
|
||||
const char *password);
|
||||
void zip_set_archive_encryption(struct zip *archive, int encryption_method,
|
||||
const char *password);
|
||||
|
||||
struct zip_source *zip_source_writable(struct zip *archive);
|
||||
zip_source_write(struct zip_source *, const void *data, size_t len);
|
||||
zip_source_printf(struct zip_source *, const char *fmt, ...);
|
||||
/* maybe
|
||||
zip_source_vprintf(struct zip_source *, const char *fmt, va_list ap);
|
||||
*/
|
||||
------------------------------------------------ others
|
||||
* regression tests (duplicate file names, unchange, .{200})
|
||||
* zip_commit
|
||||
* zip_replace_zip: allow rewinding
|
||||
* API for extracting and setting extra fields
|
||||
* zipcmp: add option for file content comparison
|
||||
* support for zip64 (large file)
|
||||
|
||||
* append to files (for self-extracting files)
|
||||
* add custom compression function support
|
||||
* zip_replace_zip: remember compression method, recompress if different speced
|
||||
* close even if error...
|
||||
* support for old compression methods?????
|
||||
------------------------------------------------ regression tests
|
||||
* (add, replace)
|
||||
add to empty zip
|
||||
add to existing zip
|
||||
add w/ existing file name [E]
|
||||
replace ok
|
||||
replace w/ illegal index [E]
|
||||
replace w/ deleted name [E]
|
||||
unchange added/replaced file
|
||||
* (close)
|
||||
copy zip file
|
||||
open copy
|
||||
rename, delete, replace, add w/ new name, add w/ deleted name
|
||||
close
|
||||
zipcmp copy expected
|
||||
remove copy
|
||||
* (delete)
|
||||
* (error_get)
|
||||
* (error_get_sys_type)
|
||||
* (error_to_str)
|
||||
* (file_error_get)
|
||||
* (file_strerror)
|
||||
* (fopen_index)
|
||||
illegal index
|
||||
* (get_name)
|
||||
* (get_num_files)
|
||||
* (rename)
|
||||
* (replace)
|
||||
* (source_buffer)
|
||||
* (source_file)
|
||||
* (source_filep)
|
||||
* (source_free)
|
||||
* (source_function)
|
||||
* (source_zip)
|
||||
* (stat)
|
||||
* (stat_index)
|
||||
* (strerror)
|
||||
* (unchange)
|
||||
* (unchange_all)
|
||||
991
dep/libzip/aclocal.m4
vendored
991
dep/libzip/aclocal.m4
vendored
@@ -1,991 +0,0 @@
|
||||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
|
||||
[m4_warning([this file was generated for autoconf 2.65.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.11'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.11.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
# _AM_AUTOCONF_VERSION(VERSION)
|
||||
# -----------------------------
|
||||
# aclocal traces this macro to find the Autoconf version.
|
||||
# This is a private macro too. Using m4_define simplifies
|
||||
# the logic in aclocal, which can simply ignore this definition.
|
||||
m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.11.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 9
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])dnl
|
||||
AC_SUBST([$1_FALSE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
|
||||
m4_define([_AM_COND_VALUE_$1], [$2])dnl
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 10
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], UPC, [depcc="$UPC" am_compiler_list=],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
am__universal=false
|
||||
m4_case([$1], [CC],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac],
|
||||
[CXX],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac])
|
||||
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this. Also, some Intel
|
||||
# versions had trouble with output in subdirs
|
||||
am__obj=sub/conftest.${OBJEXT-o}
|
||||
am__minus_obj="-o $am__obj"
|
||||
case $depmode in
|
||||
gcc)
|
||||
# This depmode causes a compiler race in universal mode.
|
||||
test "$am__universal" = false || continue
|
||||
;;
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
msvisualcpp | msvcmsys)
|
||||
# This compiler won't grok `-c -o', but also, the minuso test has
|
||||
# not run yet. These depmodes are late enough in the game, and
|
||||
# so weak that their functioning should not be impacted.
|
||||
am__obj=conftest.${OBJEXT-o}
|
||||
am__minus_obj=
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=$am__obj \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 5
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[{
|
||||
# Autoconf 2.62 quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
||||
*) set x $CONFIG_FILES ;;
|
||||
esac
|
||||
shift
|
||||
for mf
|
||||
do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
}
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 16
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.62])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`"; then
|
||||
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
|
||||
# is not polluted with repeated "-I."
|
||||
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
||||
[_AM_DEPENDENCIES(OBJC)],
|
||||
[define([AC_PROG_OBJC],
|
||||
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
|
||||
])
|
||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
|
||||
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
|
||||
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
|
||||
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
])
|
||||
|
||||
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
|
||||
dnl mangled by Autoconf and run in a shell conditional statement.
|
||||
m4_define([_AC_COMPILER_EXEEXT],
|
||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_arg=$1
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$_am_arg | $_am_arg:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
if test x"${install_sh}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
*)
|
||||
install_sh="\${SHELL} $am_aux_dir/install-sh"
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo this is the am__doit target
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# Ignore all kinds of additional output from `make'.
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
;;
|
||||
esac
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_PROG_CC_C_O
|
||||
# --------------
|
||||
# Like AC_PROG_CC_C_O, but changed for automake.
|
||||
AC_DEFUN([AM_PROG_CC_C_O],
|
||||
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
|
||||
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([compile])dnl
|
||||
# FIXME: we rely on the cache variable name because
|
||||
# there is no other way.
|
||||
set dummy $CC
|
||||
am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
|
||||
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
|
||||
if test "$am_t" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
dnl Make sure AC_PROG_CC is never called again, or it will override our
|
||||
dnl setting of CC.
|
||||
m4_define([AC_PROG_CC],
|
||||
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check for `mkdir -p'.
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
|
||||
dnl while keeping a definition of mkdir_p for backward compatibility.
|
||||
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
|
||||
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
|
||||
dnl Makefile.ins that do not define MKDIR_P, so we do our own
|
||||
dnl adjustment using top_builddir (which is defined more often than
|
||||
dnl MKDIR_P).
|
||||
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
|
||||
case $mkdir_p in
|
||||
[[\\/$]]* | ?:[[\\/]]*) ;;
|
||||
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[[\\\"\#\$\&\'\`$am_lf]]*)
|
||||
AC_MSG_ERROR([unsafe absolute working directory name]);;
|
||||
esac
|
||||
case $srcdir in
|
||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
|
||||
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
|
||||
esac
|
||||
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
# This macro is traced by Automake.
|
||||
AC_DEFUN([_AM_SUBST_NOTMAKE])
|
||||
|
||||
# AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Public sister of _AM_SUBST_NOTMAKE.
|
||||
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([m4/libtool.m4])
|
||||
m4_include([m4/ltoptions.m4])
|
||||
m4_include([m4/ltsugar.m4])
|
||||
m4_include([m4/ltversion.m4])
|
||||
m4_include([m4/lt~obsolete.m4])
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef HAD_CONFIG_H
|
||||
#define HAD_CONFIG_H
|
||||
#cmakedefine HAVE_FSEEKO
|
||||
#cmakedefine HAVE_MKSTEMP
|
||||
#cmakedefine HAVE_MOVEFILEEX
|
||||
#cmakedefine HAVE_UNISTD_H
|
||||
#define PACKAGE "@PACKAGE@"
|
||||
#define VERSION "@VERSION@"
|
||||
#endif /* HAD_CONFIG_H */
|
||||
@@ -1,143 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2009-10-06.20; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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 's|^.*[\\/]||; s|^[a-zA-Z]:||; 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
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || 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-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
1561
dep/libzip/config.guess
vendored
1561
dep/libzip/config.guess
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,98 +0,0 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_TZNAME
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `fseeko' function. */
|
||||
#undef HAVE_FSEEKO
|
||||
|
||||
/* Define to 1 if you have the `ftello' function. */
|
||||
#undef HAVE_FTELLO
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mkstemp' function. */
|
||||
#undef HAVE_MKSTEMP
|
||||
|
||||
/* Define to 1 if you have the `MoveFileExA' function. */
|
||||
#undef HAVE_MOVEFILEEXA
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM_TM_ZONE
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
|
||||
`HAVE_STRUCT_TM_TM_ZONE' instead. */
|
||||
#undef HAVE_TM_ZONE
|
||||
|
||||
/* Define to 1 if you don't have `tm_zone' but do have the external array
|
||||
`tzname'. */
|
||||
#undef HAVE_TZNAME
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
1686
dep/libzip/config.sub
vendored
1686
dep/libzip/config.sub
vendored
File diff suppressed because it is too large
Load Diff
13233
dep/libzip/configure
vendored
13233
dep/libzip/configure
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([libzip],[0.9.3],[libzip@nih.at])
|
||||
AC_CONFIG_SRCDIR([lib/zip_add.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
dnl AC_CANONICAL_HOST
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
AC_ARG_WITH(zlib,
|
||||
[ --with-zlib=PREFIX specify prefix for ZLIB library],,
|
||||
with_zlib=yes)
|
||||
|
||||
if test "$with_zlib" != "yes"
|
||||
then
|
||||
if test -f "$with_zlib"/zlib.h
|
||||
then
|
||||
# PREFIX is to uninstalled version in distribution directory
|
||||
CFLAGS="$CFLAGS -I$with_zlib"
|
||||
LDFLAGS="$LDFLAGS -L$with_zlib"
|
||||
else if test -f "$with_zlib"/include/zlib.h
|
||||
then
|
||||
# PREFIX is installation prefix
|
||||
CFLAGS="$CFLAGS -I$with_zlib/include"
|
||||
LDFLAGS="$LDFLAGS -L$with_zlib/lib"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(z, main)
|
||||
AC_CACHE_CHECK(new ZLIB version, id_cv_lib_zlib_ok,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[extern ZEXPORT unzOpen (const char *path);]])],[id_cv_lib_zlib_ok=yes],[id_cv_lib_zlib_ok=no]))
|
||||
if test "$id_cv_lib_zlib_ok" = "no"
|
||||
then
|
||||
AC_MSG_ERROR([ZLIB version too old, please install at least v1.1.2])
|
||||
fi
|
||||
|
||||
AC_EXEEXT
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_FUNCS([fseeko ftello])
|
||||
AC_CHECK_FUNCS([mkstemp], [], [AC_LIBOBJ(mkstemp)])
|
||||
|
||||
AC_MSG_CHECKING([MoveFileExA])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <windows.h>],
|
||||
[MoveFileExA("", "", 0);])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_MOVEFILEEXA], [1],
|
||||
[Define to 1 if you have the `MoveFileExA' function.])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
AC_CHECK_HEADERS([unistd.h])
|
||||
|
||||
AC_STRUCT_TIMEZONE
|
||||
|
||||
case $host_os
|
||||
in
|
||||
*bsd*) MANFMT=mdoc;;
|
||||
*) MANFMT=man;;
|
||||
esac
|
||||
AC_SUBST([MANFMT])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
libzip.pc
|
||||
libzip-uninstalled.pc
|
||||
man/Makefile
|
||||
lib/Makefile
|
||||
regress/Makefile
|
||||
src/Makefile])
|
||||
AC_OUTPUT
|
||||
@@ -1,630 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
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 "X$1" != 'X--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 "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
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.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$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 "X$1" != 'X--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.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# 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
|
||||
;;
|
||||
|
||||
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-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -1,291 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: install-sh.in,v 1.4 2007/07/12 18:32:50 jlam Exp $
|
||||
# This script now also installs multiple files, but might choke on installing
|
||||
# multiple files with spaces in the file names.
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
awkprog="${AWKPROG-awk}"
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
instcmd="$mvprog"
|
||||
pathcompchmodcmd="$chmodprog 755"
|
||||
chmodcmd="$chmodprog 755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
stripflags=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
msrc=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
suffix=""
|
||||
suffixfmt=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-b) suffix=".old"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-B) suffixfmt="$2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-S) stripcmd="$stripprog"
|
||||
stripflags="-S $2 $stripflags"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$msrc" = x ]
|
||||
then
|
||||
msrc="$dst"
|
||||
else
|
||||
msrc="$msrc $dst"
|
||||
fi
|
||||
src="$dst"
|
||||
dst="$1"
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$dir_arg" = x ]
|
||||
then
|
||||
dstisfile=""
|
||||
if [ ! -d "$dst" ]
|
||||
then
|
||||
if [ x"$msrc" = x"$src" ]
|
||||
then
|
||||
dstisfile=true
|
||||
else
|
||||
echo "install: destination is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msrc="$msrc $dst"
|
||||
fi
|
||||
|
||||
if [ x"$msrc" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for srcarg in $msrc; do
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
|
||||
dstarg="$srcarg"
|
||||
else
|
||||
dstarg="$dst"
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$srcarg" ]
|
||||
then
|
||||
doinst="$instcmd"
|
||||
elif [ -d "$srcarg" ]
|
||||
then
|
||||
echo "install: $srcarg: not a regular file"
|
||||
exit 1
|
||||
elif [ "$srcarg" = "/dev/null" ]
|
||||
then
|
||||
doinst="$cpprog"
|
||||
else
|
||||
echo "install: $srcarg does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d "$dstarg" ]
|
||||
then
|
||||
dstarg="$dstarg"/`basename "$srcarg"`
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$doit $mkdirprog "${pathcomp}"
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
|
||||
if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
|
||||
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
if [ -d "$dstarg" ]; then
|
||||
true
|
||||
else
|
||||
$doit $mkdirprog "$dstarg" &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
|
||||
fi
|
||||
else
|
||||
|
||||
if [ x"$dstisfile" = x ]
|
||||
then
|
||||
file=$srcarg
|
||||
else
|
||||
file=$dst
|
||||
fi
|
||||
|
||||
dstfile=`basename "$file"`
|
||||
dstfinal="$dstdir/$dstfile"
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Make a backup file name in the proper directory.
|
||||
case x$suffixfmt in
|
||||
*%*) suffix=`echo x |
|
||||
$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
|
||||
{ cnt = 0;
|
||||
do {
|
||||
sfx = sprintf(fmt, cnt++);
|
||||
name = bname sfx;
|
||||
} while (system("test -f " name) == 0);
|
||||
print sfx; }' -`;;
|
||||
x) ;;
|
||||
*) suffix="$suffixfmt";;
|
||||
esac
|
||||
dstbackup="$dstfinal$suffix"
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $doinst $srcarg "$dsttmp" &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# 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 $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
|
||||
then
|
||||
$doit $mvcmd "$dstfinal" "$dstbackup"
|
||||
else
|
||||
$doit $rmcmd -f "$dstfinal"
|
||||
fi &&
|
||||
$doit $mvcmd "$dsttmp" "$dstfinal"
|
||||
fi
|
||||
|
||||
done &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,129 +0,0 @@
|
||||
# $NiH$
|
||||
|
||||
INCLUDE(CheckFunctionExists)
|
||||
|
||||
INSTALL(FILES zip.h DESTINATION include)
|
||||
|
||||
# from http://www.cmake.org/Wiki/CMakeMacroLibtoolFile
|
||||
MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
|
||||
|
||||
GET_TARGET_PROPERTY (${_variable} ${_target} ${_property})
|
||||
IF (${_variable} STREQUAL NOTFOUND)
|
||||
SET (${_variable} ${_default_value})
|
||||
ENDIF (${_variable} STREQUAL NOTFOUND)
|
||||
|
||||
ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT)
|
||||
|
||||
MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
|
||||
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "")
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "")
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0)
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
|
||||
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
|
||||
GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
|
||||
SET(_laname ${_laname}.la)
|
||||
FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
|
||||
FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
|
||||
FILE(APPEND ${_laname} "dlname='${_soname}'\n")
|
||||
FILE(APPEND ${_laname} "# Names of this library\n")
|
||||
FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n")
|
||||
FILE(APPEND ${_laname} "# The name of the static archive\n")
|
||||
FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n")
|
||||
FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
|
||||
FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n")
|
||||
FILE(APPEND ${_laname} "# Version information.\n")
|
||||
FILE(APPEND ${_laname} "current=${_target_current}\n")
|
||||
FILE(APPEND ${_laname} "age=${_target_age}\n")
|
||||
FILE(APPEND ${_laname} "revision=${_target_revision}\n")
|
||||
FILE(APPEND ${_laname} "# Is this an already installed library?\n")
|
||||
FILE(APPEND ${_laname} "installed=${_target_installed}\n")
|
||||
FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n")
|
||||
FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n")
|
||||
FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n")
|
||||
FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n")
|
||||
FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n")
|
||||
FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
|
||||
FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/${_install_DIR}'\n")
|
||||
INSTALL( FILES ${_laname} ${_soname}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR})
|
||||
ENDMACRO(CREATE_LIBTOOL_FILE)
|
||||
|
||||
SET(LIBZIP_SOURCES
|
||||
zip_add.c
|
||||
zip_add_dir.c
|
||||
zip_close.c
|
||||
zip_delete.c
|
||||
zip_dirent.c
|
||||
zip_entry_free.c
|
||||
zip_entry_new.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zip_err_str.c
|
||||
zip_error.c
|
||||
zip_error_clear.c
|
||||
zip_error_get.c
|
||||
zip_error_get_sys_type.c
|
||||
zip_error_strerror.c
|
||||
zip_error_to_str.c
|
||||
zip_fclose.c
|
||||
zip_file_error_clear.c
|
||||
zip_file_error_get.c
|
||||
zip_file_get_offset.c
|
||||
zip_file_strerror.c
|
||||
zip_fopen.c
|
||||
zip_fopen_index.c
|
||||
zip_fread.c
|
||||
zip_free.c
|
||||
zip_get_archive_comment.c
|
||||
zip_get_file_comment.c
|
||||
zip_get_num_files.c
|
||||
zip_get_name.c
|
||||
zip_memdup.c
|
||||
zip_name_locate.c
|
||||
zip_new.c
|
||||
zip_open.c
|
||||
zip_rename.c
|
||||
zip_replace.c
|
||||
zip_set_archive_comment.c
|
||||
zip_set_file_comment.c
|
||||
zip_source_buffer.c
|
||||
zip_source_file.c
|
||||
zip_source_filep.c
|
||||
zip_source_free.c
|
||||
zip_source_function.c
|
||||
zip_source_zip.c
|
||||
zip_set_name.c
|
||||
zip_stat.c
|
||||
zip_stat_index.c
|
||||
zip_stat_init.c
|
||||
zip_strerror.c
|
||||
zip_unchange.c
|
||||
zip_unchange_all.c
|
||||
zip_unchange_archive.c
|
||||
zip_unchange_data.c
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
||||
# XXX: distribute instead?
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zip_err_str.c
|
||||
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/make_zip_err_str.sh
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zip.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zip_err_str.c
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/zip.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/make_zip_err_str.sh
|
||||
)
|
||||
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
|
||||
IF(NOT HAVE_MKSTEMP)
|
||||
SET(LIBZIP_EXTRA_FILES mkstemp.c)
|
||||
ENDIF(NOT HAVE_MKSTEMP)
|
||||
|
||||
ADD_LIBRARY(zip SHARED ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES})
|
||||
SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 1.0 SOVERSION 1 )
|
||||
TARGET_LINK_LIBRARIES(zip z)
|
||||
#CREATE_LIBTOOL_FILE(zip lib)
|
||||
@@ -1,69 +0,0 @@
|
||||
lib_LTLIBRARIES = libzip.la
|
||||
noinst_HEADERS = zipint.h
|
||||
include_HEADERS = zip.h
|
||||
|
||||
libzip_la_LDFLAGS=-no-undefined -version-info 1:0
|
||||
libzip_la_LIBADD=@LTLIBOBJS@
|
||||
|
||||
libzip_la_SOURCES=\
|
||||
zip_add.c \
|
||||
zip_add_dir.c \
|
||||
zip_close.c \
|
||||
zip_delete.c \
|
||||
zip_dirent.c \
|
||||
zip_entry_free.c \
|
||||
zip_entry_new.c \
|
||||
zip_err_str.c \
|
||||
zip_error.c \
|
||||
zip_error_clear.c \
|
||||
zip_error_get.c \
|
||||
zip_error_get_sys_type.c \
|
||||
zip_error_strerror.c \
|
||||
zip_error_to_str.c \
|
||||
zip_fclose.c \
|
||||
zip_file_error_clear.c \
|
||||
zip_file_error_get.c \
|
||||
zip_file_get_offset.c \
|
||||
zip_file_strerror.c \
|
||||
zip_filerange_crc.c \
|
||||
zip_fopen.c \
|
||||
zip_fopen_index.c \
|
||||
zip_fread.c \
|
||||
zip_free.c \
|
||||
zip_get_archive_comment.c \
|
||||
zip_get_archive_flag.c \
|
||||
zip_get_file_comment.c \
|
||||
zip_get_num_files.c \
|
||||
zip_get_name.c \
|
||||
zip_memdup.c \
|
||||
zip_name_locate.c \
|
||||
zip_new.c \
|
||||
zip_open.c \
|
||||
zip_rename.c \
|
||||
zip_replace.c \
|
||||
zip_set_archive_comment.c \
|
||||
zip_set_archive_flag.c \
|
||||
zip_set_file_comment.c \
|
||||
zip_source_buffer.c \
|
||||
zip_source_file.c \
|
||||
zip_source_filep.c \
|
||||
zip_source_free.c \
|
||||
zip_source_function.c \
|
||||
zip_source_zip.c \
|
||||
zip_set_name.c \
|
||||
zip_stat.c \
|
||||
zip_stat_index.c \
|
||||
zip_stat_init.c \
|
||||
zip_strerror.c \
|
||||
zip_unchange.c \
|
||||
zip_unchange_all.c \
|
||||
zip_unchange_archive.c \
|
||||
zip_unchange_data.c
|
||||
|
||||
BUILT_SOURCES=zip_err_str.c
|
||||
|
||||
EXTRA_DIST= CMakeLists.txt \
|
||||
make_zip_err_str.sh
|
||||
|
||||
zip_err_str.c: zip.h make_zip_err_str.sh
|
||||
sh $(srcdir)/make_zip_err_str.sh $(srcdir)/zip.h zip_err_str.c
|
||||
@@ -1,682 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = lib
|
||||
DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in mkstemp.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libzip_la_DEPENDENCIES = @LTLIBOBJS@
|
||||
am_libzip_la_OBJECTS = zip_add.lo zip_add_dir.lo zip_close.lo \
|
||||
zip_delete.lo zip_dirent.lo zip_entry_free.lo zip_entry_new.lo \
|
||||
zip_err_str.lo zip_error.lo zip_error_clear.lo \
|
||||
zip_error_get.lo zip_error_get_sys_type.lo \
|
||||
zip_error_strerror.lo zip_error_to_str.lo zip_fclose.lo \
|
||||
zip_file_error_clear.lo zip_file_error_get.lo \
|
||||
zip_file_get_offset.lo zip_file_strerror.lo \
|
||||
zip_filerange_crc.lo zip_fopen.lo zip_fopen_index.lo \
|
||||
zip_fread.lo zip_free.lo zip_get_archive_comment.lo \
|
||||
zip_get_archive_flag.lo zip_get_file_comment.lo \
|
||||
zip_get_num_files.lo zip_get_name.lo zip_memdup.lo \
|
||||
zip_name_locate.lo zip_new.lo zip_open.lo zip_rename.lo \
|
||||
zip_replace.lo zip_set_archive_comment.lo \
|
||||
zip_set_archive_flag.lo zip_set_file_comment.lo \
|
||||
zip_source_buffer.lo zip_source_file.lo zip_source_filep.lo \
|
||||
zip_source_free.lo zip_source_function.lo zip_source_zip.lo \
|
||||
zip_set_name.lo zip_stat.lo zip_stat_index.lo zip_stat_init.lo \
|
||||
zip_strerror.lo zip_unchange.lo zip_unchange_all.lo \
|
||||
zip_unchange_archive.lo zip_unchange_data.lo
|
||||
libzip_la_OBJECTS = $(am_libzip_la_OBJECTS)
|
||||
libzip_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libzip_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(libzip_la_SOURCES)
|
||||
DIST_SOURCES = $(libzip_la_SOURCES)
|
||||
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANFMT = @MANFMT@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = libzip.la
|
||||
noinst_HEADERS = zipint.h
|
||||
include_HEADERS = zip.h
|
||||
libzip_la_LDFLAGS = -no-undefined -version-info 1:0
|
||||
libzip_la_LIBADD = @LTLIBOBJS@
|
||||
libzip_la_SOURCES = \
|
||||
zip_add.c \
|
||||
zip_add_dir.c \
|
||||
zip_close.c \
|
||||
zip_delete.c \
|
||||
zip_dirent.c \
|
||||
zip_entry_free.c \
|
||||
zip_entry_new.c \
|
||||
zip_err_str.c \
|
||||
zip_error.c \
|
||||
zip_error_clear.c \
|
||||
zip_error_get.c \
|
||||
zip_error_get_sys_type.c \
|
||||
zip_error_strerror.c \
|
||||
zip_error_to_str.c \
|
||||
zip_fclose.c \
|
||||
zip_file_error_clear.c \
|
||||
zip_file_error_get.c \
|
||||
zip_file_get_offset.c \
|
||||
zip_file_strerror.c \
|
||||
zip_filerange_crc.c \
|
||||
zip_fopen.c \
|
||||
zip_fopen_index.c \
|
||||
zip_fread.c \
|
||||
zip_free.c \
|
||||
zip_get_archive_comment.c \
|
||||
zip_get_archive_flag.c \
|
||||
zip_get_file_comment.c \
|
||||
zip_get_num_files.c \
|
||||
zip_get_name.c \
|
||||
zip_memdup.c \
|
||||
zip_name_locate.c \
|
||||
zip_new.c \
|
||||
zip_open.c \
|
||||
zip_rename.c \
|
||||
zip_replace.c \
|
||||
zip_set_archive_comment.c \
|
||||
zip_set_archive_flag.c \
|
||||
zip_set_file_comment.c \
|
||||
zip_source_buffer.c \
|
||||
zip_source_file.c \
|
||||
zip_source_filep.c \
|
||||
zip_source_free.c \
|
||||
zip_source_function.c \
|
||||
zip_source_zip.c \
|
||||
zip_set_name.c \
|
||||
zip_stat.c \
|
||||
zip_stat_index.c \
|
||||
zip_stat_init.c \
|
||||
zip_strerror.c \
|
||||
zip_unchange.c \
|
||||
zip_unchange_all.c \
|
||||
zip_unchange_archive.c \
|
||||
zip_unchange_data.c
|
||||
|
||||
BUILT_SOURCES = zip_err_str.c
|
||||
EXTRA_DIST = CMakeLists.txt \
|
||||
make_zip_err_str.sh
|
||||
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign lib/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libzip.la: $(libzip_la_OBJECTS) $(libzip_la_DEPENDENCIES)
|
||||
$(libzip_la_LINK) -rpath $(libdir) $(libzip_la_OBJECTS) $(libzip_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/mkstemp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_add.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_add_dir.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_close.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_delete.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_dirent.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_entry_free.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_entry_new.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_err_str.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_error.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_error_clear.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_error_get.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_error_get_sys_type.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_error_strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_error_to_str.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_fclose.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_file_error_clear.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_file_error_get.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_file_get_offset.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_file_strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_filerange_crc.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_fopen.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_fopen_index.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_fread.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_free.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_archive_comment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_archive_flag.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_file_comment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_name.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_num_files.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_memdup.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_name_locate.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_new.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_open.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_rename.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_replace.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_set_archive_comment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_set_archive_flag.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_set_file_comment.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_set_name.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_buffer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_file.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_filep.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_free.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_function.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_zip.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_stat.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_stat_index.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_stat_init.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_unchange.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_unchange_all.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_unchange_archive.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_unchange_data.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(includedir)" && rm -f $$files
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf $(DEPDIR) ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf $(DEPDIR) ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: all check install install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-includeHEADERS install-info \
|
||||
install-info-am install-libLTLIBRARIES install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-includeHEADERS \
|
||||
uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
zip_err_str.c: zip.h make_zip_err_str.sh
|
||||
sh $(srcdir)/make_zip_err_str.sh $(srcdir)/zip.h zip_err_str.c
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,84 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# make_zip_err_str.sh: create zip_err_str.c from zip.h
|
||||
# Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
#
|
||||
# This file is part of libzip, a library to manipulate ZIP archives.
|
||||
# The authors can be contacted at <libzip@nih.at>
|
||||
#
|
||||
# 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. The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
|
||||
|
||||
if [ "$#" -ne 2 ]
|
||||
then
|
||||
echo "Usage: $0 in_file out_file" >&2
|
||||
echo " e.g. $0 zip.h zip_err_str.c" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "$2" ]
|
||||
then
|
||||
echo "$0: error: output file = input file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#rcsid=`echo '$NiH: make_zip_err_str.sh,v 1.7 2004/04/25 16:20:16 dillo Exp $' | tr -d '$'`
|
||||
#inrcsid=`sed -n 's/^ \$\([^$]*[^ ]\) *\$$/\1/p' "$1"`
|
||||
|
||||
cat <<EOF >> "$2.$$" || exit 1
|
||||
/*
|
||||
This file was generated automatically by $0
|
||||
from $1; make changes there.
|
||||
*/
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
const char * const _zip_err_str[] = {
|
||||
EOF
|
||||
|
||||
sed -n '/^#define ZIP_ER_/ s/.*\/\* . \([^*]*\) \*\// "\1",/p' "$1" \
|
||||
>> "$2.$$" || exit 1
|
||||
|
||||
cat <<EOF >> "$2.$$" || exit 1
|
||||
};
|
||||
|
||||
const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]);
|
||||
|
||||
#define N ZIP_ET_NONE
|
||||
#define S ZIP_ET_SYS
|
||||
#define Z ZIP_ET_ZLIB
|
||||
|
||||
const int _zip_err_type[] = {
|
||||
EOF
|
||||
|
||||
sed -n '/^#define ZIP_ER_/ s/.*\/\* \(.\) \([^*]*\) \*\// \1,/p' "$1" \
|
||||
>> "$2.$$" || exit 1
|
||||
|
||||
echo '};' >> "$2.$$" || exit 1
|
||||
|
||||
mv "$2.$$" "$2" || exit 1
|
||||
@@ -1,140 +0,0 @@
|
||||
/* $NiH: mkstemp.c,v 1.3 2006/04/23 14:51:45 wiz Exp $ */
|
||||
|
||||
/* Adapted from NetBSB libc by Dieter Baron */
|
||||
|
||||
/* NetBSD: gettemp.c,v 1.13 2003/12/05 00:57:36 uebayasi Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 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. 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_mkstemp(char *path)
|
||||
{
|
||||
int fd;
|
||||
char *start, *trv;
|
||||
struct stat sbuf;
|
||||
pid_t pid;
|
||||
|
||||
/* To guarantee multiple calls generate unique names even if
|
||||
the file is not created. 676 different possibilities with 7
|
||||
or more X's, 26 with 6 or less. */
|
||||
static char xtra[2] = "aa";
|
||||
int xcnt = 0;
|
||||
|
||||
pid = getpid();
|
||||
|
||||
/* Move to end of path and count trailing X's. */
|
||||
for (trv = path; *trv; ++trv)
|
||||
if (*trv == 'X')
|
||||
xcnt++;
|
||||
else
|
||||
xcnt = 0;
|
||||
|
||||
/* Use at least one from xtra. Use 2 if more than 6 X's. */
|
||||
if (*(trv - 1) == 'X')
|
||||
*--trv = xtra[0];
|
||||
if (xcnt > 6 && *(trv - 1) == 'X')
|
||||
*--trv = xtra[1];
|
||||
|
||||
/* Set remaining X's to pid digits with 0's to the left. */
|
||||
while (*--trv == 'X') {
|
||||
*trv = (pid % 10) + '0';
|
||||
pid /= 10;
|
||||
}
|
||||
|
||||
/* update xtra for next call. */
|
||||
if (xtra[0] != 'z')
|
||||
xtra[0]++;
|
||||
else {
|
||||
xtra[0] = 'a';
|
||||
if (xtra[1] != 'z')
|
||||
xtra[1]++;
|
||||
else
|
||||
xtra[1] = 'a';
|
||||
}
|
||||
|
||||
/*
|
||||
* check the target directory; if you have six X's and it
|
||||
* doesn't exist this runs for a *very* long time.
|
||||
*/
|
||||
for (start = trv + 1;; --trv) {
|
||||
if (trv <= path)
|
||||
break;
|
||||
if (*trv == '/') {
|
||||
*trv = '\0';
|
||||
if (stat(path, &sbuf))
|
||||
return (0);
|
||||
if (!S_ISDIR(sbuf.st_mode)) {
|
||||
errno = ENOTDIR;
|
||||
return (0);
|
||||
}
|
||||
*trv = '/';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if ((fd=open(path, O_CREAT|O_EXCL|O_RDWR|O_BINARY, 0600)) >= 0)
|
||||
return (fd);
|
||||
if (errno != EEXIST)
|
||||
return (0);
|
||||
|
||||
/* tricky little algorithm for backward compatibility */
|
||||
for (trv = start;;) {
|
||||
if (!*trv)
|
||||
return (0);
|
||||
if (*trv == 'z')
|
||||
*trv++ = 'a';
|
||||
else {
|
||||
if (isdigit((unsigned char)*trv))
|
||||
*trv = 'a';
|
||||
else
|
||||
++*trv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
#ifndef _HAD_ZIP_H
|
||||
#define _HAD_ZIP_H
|
||||
|
||||
/*
|
||||
zip.h -- exported declarations.
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef ZIP_EXTERN
|
||||
#ifdef _MSC_VER
|
||||
#define ZIP_EXTERN __declspec(dllexport)
|
||||
#else
|
||||
#define ZIP_EXTERN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
/* flags for zip_open */
|
||||
|
||||
#define ZIP_CREATE 1
|
||||
#define ZIP_EXCL 2
|
||||
#define ZIP_CHECKCONS 4
|
||||
|
||||
|
||||
/* flags for zip_name_locate, zip_fopen, zip_stat, ... */
|
||||
|
||||
#define ZIP_FL_NOCASE 1 /* ignore case on name lookup */
|
||||
#define ZIP_FL_NODIR 2 /* ignore directory component */
|
||||
#define ZIP_FL_COMPRESSED 4 /* read compressed data */
|
||||
#define ZIP_FL_UNCHANGED 8 /* use original data, ignoring changes */
|
||||
#define ZIP_FL_RECOMPRESS 16 /* force recompression of data */
|
||||
|
||||
/* archive global flags flags */
|
||||
|
||||
#define ZIP_AFL_TORRENT 1 /* torrent zipped */
|
||||
|
||||
/* libzip error codes */
|
||||
|
||||
#define ZIP_ER_OK 0 /* N No error */
|
||||
#define ZIP_ER_MULTIDISK 1 /* N Multi-disk zip archives not supported */
|
||||
#define ZIP_ER_RENAME 2 /* S Renaming temporary file failed */
|
||||
#define ZIP_ER_CLOSE 3 /* S Closing zip archive failed */
|
||||
#define ZIP_ER_SEEK 4 /* S Seek error */
|
||||
#define ZIP_ER_READ 5 /* S Read error */
|
||||
#define ZIP_ER_WRITE 6 /* S Write error */
|
||||
#define ZIP_ER_CRC 7 /* N CRC error */
|
||||
#define ZIP_ER_ZIPCLOSED 8 /* N Containing zip archive was closed */
|
||||
#define ZIP_ER_NOENT 9 /* N No such file */
|
||||
#define ZIP_ER_EXISTS 10 /* N File already exists */
|
||||
#define ZIP_ER_OPEN 11 /* S Can't open file */
|
||||
#define ZIP_ER_TMPOPEN 12 /* S Failure to create temporary file */
|
||||
#define ZIP_ER_ZLIB 13 /* Z Zlib error */
|
||||
#define ZIP_ER_MEMORY 14 /* N Malloc failure */
|
||||
#define ZIP_ER_CHANGED 15 /* N Entry has been changed */
|
||||
#define ZIP_ER_COMPNOTSUPP 16 /* N Compression method not supported */
|
||||
#define ZIP_ER_EOF 17 /* N Premature EOF */
|
||||
#define ZIP_ER_INVAL 18 /* N Invalid argument */
|
||||
#define ZIP_ER_NOZIP 19 /* N Not a zip archive */
|
||||
#define ZIP_ER_INTERNAL 20 /* N Internal error */
|
||||
#define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */
|
||||
#define ZIP_ER_REMOVE 22 /* S Can't remove file */
|
||||
#define ZIP_ER_DELETED 23 /* N Entry has been deleted */
|
||||
|
||||
|
||||
/* type of system error value */
|
||||
|
||||
#define ZIP_ET_NONE 0 /* sys_err unused */
|
||||
#define ZIP_ET_SYS 1 /* sys_err is errno */
|
||||
#define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */
|
||||
|
||||
/* compression methods */
|
||||
|
||||
#define ZIP_CM_DEFAULT -1 /* better of deflate or store */
|
||||
#define ZIP_CM_STORE 0 /* stored (uncompressed) */
|
||||
#define ZIP_CM_SHRINK 1 /* shrunk */
|
||||
#define ZIP_CM_REDUCE_1 2 /* reduced with factor 1 */
|
||||
#define ZIP_CM_REDUCE_2 3 /* reduced with factor 2 */
|
||||
#define ZIP_CM_REDUCE_3 4 /* reduced with factor 3 */
|
||||
#define ZIP_CM_REDUCE_4 5 /* reduced with factor 4 */
|
||||
#define ZIP_CM_IMPLODE 6 /* imploded */
|
||||
/* 7 - Reserved for Tokenizing compression algorithm */
|
||||
#define ZIP_CM_DEFLATE 8 /* deflated */
|
||||
#define ZIP_CM_DEFLATE64 9 /* deflate64 */
|
||||
#define ZIP_CM_PKWARE_IMPLODE 10 /* PKWARE imploding */
|
||||
/* 11 - Reserved by PKWARE */
|
||||
#define ZIP_CM_BZIP2 12 /* compressed using BZIP2 algorithm */
|
||||
/* 13 - Reserved by PKWARE */
|
||||
#define ZIP_CM_LZMA 14 /* LZMA (EFS) */
|
||||
/* 15-17 - Reserved by PKWARE */
|
||||
#define ZIP_CM_TERSE 18 /* compressed using IBM TERSE (new) */
|
||||
#define ZIP_CM_LZ77 19 /* IBM LZ77 z Architecture (PFS) */
|
||||
#define ZIP_CM_WAVPACK 97 /* WavPack compressed data */
|
||||
#define ZIP_CM_PPMD 98 /* PPMd version I, Rev 1 */
|
||||
|
||||
/* encryption methods */
|
||||
|
||||
#define ZIP_EM_NONE 0 /* not encrypted */
|
||||
#define ZIP_EM_TRAD_PKWARE 1 /* traditional PKWARE encryption */
|
||||
#if 0 /* Strong Encryption Header not parsed yet */
|
||||
#define ZIP_EM_DES 0x6601 /* strong encryption: DES */
|
||||
#define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */
|
||||
#define ZIP_EM_3DES_168 0x6603
|
||||
#define ZIP_EM_3DES_112 0x6609
|
||||
#define ZIP_EM_AES_128 0x660e
|
||||
#define ZIP_EM_AES_192 0x660f
|
||||
#define ZIP_EM_AES_256 0x6610
|
||||
#define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */
|
||||
#define ZIP_EM_RC4 0x6801
|
||||
#endif
|
||||
#define ZIP_EM_UNKNOWN 0xffff /* unknown algorithm */
|
||||
|
||||
|
||||
|
||||
enum zip_source_cmd {
|
||||
ZIP_SOURCE_OPEN, /* prepare for reading */
|
||||
ZIP_SOURCE_READ, /* read data */
|
||||
ZIP_SOURCE_CLOSE, /* reading is done */
|
||||
ZIP_SOURCE_STAT, /* get meta information */
|
||||
ZIP_SOURCE_ERROR, /* get error information */
|
||||
ZIP_SOURCE_FREE /* cleanup and free resources */
|
||||
};
|
||||
|
||||
typedef ssize_t (*zip_source_callback)(void *state, void *data,
|
||||
size_t len, enum zip_source_cmd cmd);
|
||||
|
||||
struct zip_stat {
|
||||
const char *name; /* name of the file */
|
||||
int index; /* index within archive */
|
||||
unsigned int crc; /* crc of file data */
|
||||
time_t mtime; /* modification time */
|
||||
off_t size; /* size of file (uncompressed) */
|
||||
off_t comp_size; /* size of file (compressed) */
|
||||
unsigned short comp_method; /* compression method used */
|
||||
unsigned short encryption_method; /* encryption method used */
|
||||
};
|
||||
|
||||
struct zip;
|
||||
struct zip_file;
|
||||
struct zip_source;
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int zip_add(struct zip *, const char *, struct zip_source *);
|
||||
ZIP_EXTERN int zip_add_dir(struct zip *, const char *);
|
||||
ZIP_EXTERN int zip_close(struct zip *);
|
||||
ZIP_EXTERN int zip_delete(struct zip *, int);
|
||||
ZIP_EXTERN void zip_error_clear(struct zip *);
|
||||
ZIP_EXTERN void zip_error_get(struct zip *, int *, int *);
|
||||
ZIP_EXTERN int zip_error_get_sys_type(int);
|
||||
ZIP_EXTERN int zip_error_to_str(char *, size_t, int, int);
|
||||
ZIP_EXTERN int zip_fclose(struct zip_file *);
|
||||
ZIP_EXTERN void zip_file_error_clear(struct zip_file *);
|
||||
ZIP_EXTERN void zip_file_error_get(struct zip_file *, int *, int *);
|
||||
ZIP_EXTERN const char *zip_file_strerror(struct zip_file *);
|
||||
ZIP_EXTERN struct zip_file *zip_fopen(struct zip *, const char *, int);
|
||||
ZIP_EXTERN struct zip_file *zip_fopen_index(struct zip *, int, int);
|
||||
ZIP_EXTERN ssize_t zip_fread(struct zip_file *, void *, size_t);
|
||||
ZIP_EXTERN const char *zip_get_archive_comment(struct zip *, int *, int);
|
||||
ZIP_EXTERN int zip_get_archive_flag(struct zip *, int, int);
|
||||
ZIP_EXTERN const char *zip_get_file_comment(struct zip *, int, int *, int);
|
||||
ZIP_EXTERN const char *zip_get_name(struct zip *, int, int);
|
||||
ZIP_EXTERN int zip_get_num_files(struct zip *);
|
||||
ZIP_EXTERN int zip_name_locate(struct zip *, const char *, int);
|
||||
ZIP_EXTERN struct zip *zip_open(const char *, int, int *);
|
||||
ZIP_EXTERN int zip_rename(struct zip *, int, const char *);
|
||||
ZIP_EXTERN int zip_replace(struct zip *, int, struct zip_source *);
|
||||
ZIP_EXTERN int zip_set_archive_comment(struct zip *, const char *, int);
|
||||
ZIP_EXTERN int zip_set_archive_flag(struct zip *, int, int);
|
||||
ZIP_EXTERN int zip_set_file_comment(struct zip *, int, const char *, int);
|
||||
ZIP_EXTERN struct zip_source *zip_source_buffer(struct zip *, const void *,
|
||||
off_t, int);
|
||||
ZIP_EXTERN struct zip_source *zip_source_file(struct zip *, const char *,
|
||||
off_t, off_t);
|
||||
ZIP_EXTERN struct zip_source *zip_source_filep(struct zip *, FILE *,
|
||||
off_t, off_t);
|
||||
ZIP_EXTERN void zip_source_free(struct zip_source *);
|
||||
ZIP_EXTERN struct zip_source *zip_source_function(struct zip *,
|
||||
zip_source_callback, void *);
|
||||
ZIP_EXTERN struct zip_source *zip_source_zip(struct zip *, struct zip *,
|
||||
int, int, off_t, off_t);
|
||||
ZIP_EXTERN int zip_stat(struct zip *, const char *, int, struct zip_stat *);
|
||||
ZIP_EXTERN int zip_stat_index(struct zip *, int, int, struct zip_stat *);
|
||||
ZIP_EXTERN void zip_stat_init(struct zip_stat *);
|
||||
ZIP_EXTERN const char *zip_strerror(struct zip *);
|
||||
ZIP_EXTERN int zip_unchange(struct zip *, int);
|
||||
ZIP_EXTERN int zip_unchange_all(struct zip *);
|
||||
ZIP_EXTERN int zip_unchange_archive(struct zip *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _HAD_ZIP_H */
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
zip_add.c -- add file via callback function
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_add(struct zip *za, const char *name, struct zip_source *source)
|
||||
{
|
||||
if (name == NULL || source == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _zip_replace(za, -1, name, source);
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
zip_add_dir.c -- add directory
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_add_dir(struct zip *za, const char *name)
|
||||
{
|
||||
int len, ret;
|
||||
char *s;
|
||||
struct zip_source *source;
|
||||
|
||||
if (name == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = NULL;
|
||||
len = strlen(name);
|
||||
|
||||
if (name[len-1] != '/') {
|
||||
if ((s=(char *)malloc(len+2)) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return -1;
|
||||
}
|
||||
strcpy(s, name);
|
||||
s[len] = '/';
|
||||
s[len+1] = '\0';
|
||||
}
|
||||
|
||||
if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) {
|
||||
free(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = _zip_replace(za, -1, s ? s : name, source);
|
||||
|
||||
free(s);
|
||||
if (ret < 0)
|
||||
zip_source_free(source);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,679 +0,0 @@
|
||||
/*
|
||||
zip_close.c -- close zip archive and update changes
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
static int add_data(struct zip *, struct zip_source *, struct zip_dirent *,
|
||||
FILE *);
|
||||
static int add_data_comp(zip_source_callback, void *, struct zip_stat *,
|
||||
FILE *, struct zip_error *);
|
||||
static int add_data_uncomp(struct zip *, zip_source_callback, void *,
|
||||
struct zip_stat *, FILE *);
|
||||
static void ch_set_error(struct zip_error *, zip_source_callback, void *);
|
||||
static int copy_data(FILE *, off_t, FILE *, struct zip_error *);
|
||||
static int write_cdir(struct zip *, struct zip_cdir *, FILE *);
|
||||
static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *);
|
||||
static int _zip_changed(struct zip *, int *);
|
||||
static char *_zip_create_temp_output(struct zip *, FILE **);
|
||||
static int _zip_torrentzip_cmp(const void *, const void *);
|
||||
|
||||
|
||||
|
||||
struct filelist {
|
||||
int idx;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_close(struct zip *za)
|
||||
{
|
||||
int survivors;
|
||||
int i, j, error;
|
||||
char *temp;
|
||||
FILE *out;
|
||||
mode_t mask;
|
||||
struct zip_cdir *cd;
|
||||
struct zip_dirent de;
|
||||
struct filelist *filelist;
|
||||
int reopen_on_error;
|
||||
int new_torrentzip;
|
||||
|
||||
reopen_on_error = 0;
|
||||
|
||||
if (za == NULL)
|
||||
return -1;
|
||||
|
||||
if (!_zip_changed(za, &survivors)) {
|
||||
_zip_free(za);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* don't create zip files with no entries */
|
||||
if (survivors == 0) {
|
||||
if (za->zn && za->zp) {
|
||||
if (remove(za->zn) != 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_REMOVE, errno);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
_zip_free(za);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((filelist=(struct filelist *)malloc(sizeof(filelist[0])*survivors))
|
||||
== NULL)
|
||||
return -1;
|
||||
|
||||
if ((cd=_zip_cdir_new(survivors, &za->error)) == NULL) {
|
||||
free(filelist);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i<survivors; i++)
|
||||
_zip_dirent_init(&cd->entry[i]);
|
||||
|
||||
/* archive comment is special for torrentzip */
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) {
|
||||
cd->comment = _zip_memdup(TORRENT_SIG "XXXXXXXX",
|
||||
TORRENT_SIG_LEN + TORRENT_CRC_LEN,
|
||||
&za->error);
|
||||
if (cd->comment == NULL) {
|
||||
_zip_cdir_free(cd);
|
||||
free(filelist);
|
||||
return -1;
|
||||
}
|
||||
cd->comment_len = TORRENT_SIG_LEN + TORRENT_CRC_LEN;
|
||||
}
|
||||
else if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, ZIP_FL_UNCHANGED) == 0) {
|
||||
if (_zip_cdir_set_comment(cd, za) == -1) {
|
||||
_zip_cdir_free(cd);
|
||||
free(filelist);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((temp=_zip_create_temp_output(za, &out)) == NULL) {
|
||||
_zip_cdir_free(cd);
|
||||
free(filelist);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* create list of files with index into original archive */
|
||||
for (i=j=0; i<za->nentry; i++) {
|
||||
if (za->entry[i].state == ZIP_ST_DELETED)
|
||||
continue;
|
||||
|
||||
filelist[j].idx = i;
|
||||
filelist[j].name = zip_get_name(za, i, 0);
|
||||
j++;
|
||||
}
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0))
|
||||
qsort(filelist, survivors, sizeof(filelist[0]),
|
||||
_zip_torrentzip_cmp);
|
||||
|
||||
new_torrentzip = (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 1
|
||||
&& zip_get_archive_flag(za, ZIP_AFL_TORRENT,
|
||||
ZIP_FL_UNCHANGED) == 0);
|
||||
error = 0;
|
||||
for (j=0; j<survivors; j++) {
|
||||
i = filelist[j].idx;
|
||||
|
||||
/* create new local directory entry */
|
||||
if (ZIP_ENTRY_DATA_CHANGED(za->entry+i) || new_torrentzip) {
|
||||
_zip_dirent_init(&de);
|
||||
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0))
|
||||
_zip_dirent_torrent_normalize(&de);
|
||||
|
||||
/* use it as central directory entry */
|
||||
memcpy(cd->entry+j, &de, sizeof(cd->entry[j]));
|
||||
|
||||
/* set/update file name */
|
||||
if (za->entry[i].ch_filename == NULL) {
|
||||
if (za->entry[i].state == ZIP_ST_ADDED) {
|
||||
de.filename = strdup("-");
|
||||
de.filename_len = 1;
|
||||
cd->entry[j].filename = "-";
|
||||
cd->entry[j].filename_len = 1;
|
||||
}
|
||||
else {
|
||||
de.filename = strdup(za->cdir->entry[i].filename);
|
||||
de.filename_len = strlen(de.filename);
|
||||
cd->entry[j].filename = za->cdir->entry[i].filename;
|
||||
cd->entry[j].filename_len = de.filename_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* copy existing directory entries */
|
||||
if (fseeko(za->zp, za->cdir->entry[i].offset, SEEK_SET) != 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1,
|
||||
&za->error) != 0) {
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
memcpy(cd->entry+j, za->cdir->entry+i, sizeof(cd->entry[j]));
|
||||
if (de.bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
|
||||
de.crc = za->cdir->entry[i].crc;
|
||||
de.comp_size = za->cdir->entry[i].comp_size;
|
||||
de.uncomp_size = za->cdir->entry[i].uncomp_size;
|
||||
de.bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR;
|
||||
cd->entry[j].bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (za->entry[i].ch_filename) {
|
||||
free(de.filename);
|
||||
if ((de.filename=strdup(za->entry[i].ch_filename)) == NULL) {
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
de.filename_len = strlen(de.filename);
|
||||
cd->entry[j].filename = za->entry[i].ch_filename;
|
||||
cd->entry[j].filename_len = de.filename_len;
|
||||
}
|
||||
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0
|
||||
&& za->entry[i].ch_comment_len != -1) {
|
||||
/* as the rest of cd entries, its malloc/free is done by za */
|
||||
cd->entry[j].comment = za->entry[i].ch_comment;
|
||||
cd->entry[j].comment_len = za->entry[i].ch_comment_len;
|
||||
}
|
||||
|
||||
cd->entry[j].offset = ftello(out);
|
||||
|
||||
if (ZIP_ENTRY_DATA_CHANGED(za->entry+i) || new_torrentzip) {
|
||||
struct zip_source *zs;
|
||||
|
||||
zs = NULL;
|
||||
if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) {
|
||||
if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1))
|
||||
== NULL) {
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) {
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
cd->entry[j].last_mod = de.last_mod;
|
||||
cd->entry[j].comp_method = de.comp_method;
|
||||
cd->entry[j].comp_size = de.comp_size;
|
||||
cd->entry[j].uncomp_size = de.uncomp_size;
|
||||
cd->entry[j].crc = de.crc;
|
||||
}
|
||||
else {
|
||||
if (_zip_dirent_write(&de, out, 1, &za->error) < 0) {
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
/* we just read the local dirent, file is at correct position */
|
||||
if (copy_data(za->zp, cd->entry[j].comp_size, out,
|
||||
&za->error) < 0) {
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_zip_dirent_finalize(&de);
|
||||
}
|
||||
|
||||
free(filelist);
|
||||
|
||||
if (!error) {
|
||||
if (write_cdir(za, cd, out) < 0)
|
||||
error = 1;
|
||||
}
|
||||
|
||||
/* pointers in cd entries are owned by za */
|
||||
cd->nentry = 0;
|
||||
_zip_cdir_free(cd);
|
||||
|
||||
if (error) {
|
||||
_zip_dirent_finalize(&de);
|
||||
fclose(out);
|
||||
remove(temp);
|
||||
free(temp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fclose(out) != 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_CLOSE, errno);
|
||||
remove(temp);
|
||||
free(temp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (za->zp) {
|
||||
fclose(za->zp);
|
||||
za->zp = NULL;
|
||||
reopen_on_error = 1;
|
||||
}
|
||||
if (_zip_rename(temp, za->zn) != 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_RENAME, errno);
|
||||
remove(temp);
|
||||
free(temp);
|
||||
if (reopen_on_error) {
|
||||
/* ignore errors, since we're already in an error case */
|
||||
za->zp = fopen(za->zn, "rb");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
mask = umask(0);
|
||||
umask(mask);
|
||||
chmod(za->zn, 0666&~mask);
|
||||
|
||||
_zip_free(za);
|
||||
free(temp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft)
|
||||
{
|
||||
off_t offstart, offend;
|
||||
zip_source_callback cb;
|
||||
void *ud;
|
||||
struct zip_stat st;
|
||||
|
||||
cb = zs->f;
|
||||
ud = zs->ud;
|
||||
|
||||
if (cb(ud, &st, sizeof(st), ZIP_SOURCE_STAT) < (ssize_t)sizeof(st)) {
|
||||
ch_set_error(&za->error, cb, ud);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cb(ud, NULL, 0, ZIP_SOURCE_OPEN) < 0) {
|
||||
ch_set_error(&za->error, cb, ud);
|
||||
return -1;
|
||||
}
|
||||
|
||||
offstart = ftello(ft);
|
||||
|
||||
if (_zip_dirent_write(de, ft, 1, &za->error) < 0)
|
||||
return -1;
|
||||
|
||||
if (st.comp_method != ZIP_CM_STORE) {
|
||||
if (add_data_comp(cb, ud, &st, ft, &za->error) < 0)
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
if (add_data_uncomp(za, cb, ud, &st, ft) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cb(ud, NULL, 0, ZIP_SOURCE_CLOSE) < 0) {
|
||||
ch_set_error(&za->error, cb, ud);
|
||||
return -1;
|
||||
}
|
||||
|
||||
offend = ftello(ft);
|
||||
|
||||
if (fseeko(ft, offstart, SEEK_SET) < 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
de->last_mod = st.mtime;
|
||||
de->comp_method = st.comp_method;
|
||||
de->crc = st.crc;
|
||||
de->uncomp_size = st.size;
|
||||
de->comp_size = st.comp_size;
|
||||
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0))
|
||||
_zip_dirent_torrent_normalize(de);
|
||||
|
||||
if (_zip_dirent_write(de, ft, 1, &za->error) < 0)
|
||||
return -1;
|
||||
|
||||
if (fseeko(ft, offend, SEEK_SET) < 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
add_data_comp(zip_source_callback cb, void *ud, struct zip_stat *st,FILE *ft,
|
||||
struct zip_error *error)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
ssize_t n;
|
||||
|
||||
st->comp_size = 0;
|
||||
while ((n=cb(ud, buf, sizeof(buf), ZIP_SOURCE_READ)) > 0) {
|
||||
if (fwrite(buf, 1, n, ft) != (size_t)n) {
|
||||
_zip_error_set(error, ZIP_ER_WRITE, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
st->comp_size += n;
|
||||
}
|
||||
if (n < 0) {
|
||||
ch_set_error(error, cb, ud);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
add_data_uncomp(struct zip *za, zip_source_callback cb, void *ud,
|
||||
struct zip_stat *st, FILE *ft)
|
||||
{
|
||||
char b1[BUFSIZE], b2[BUFSIZE];
|
||||
int end, flush, ret;
|
||||
ssize_t n;
|
||||
size_t n2;
|
||||
z_stream zstr;
|
||||
int mem_level;
|
||||
|
||||
st->comp_method = ZIP_CM_DEFLATE;
|
||||
st->comp_size = st->size = 0;
|
||||
st->crc = crc32(0, NULL, 0);
|
||||
|
||||
zstr.zalloc = Z_NULL;
|
||||
zstr.zfree = Z_NULL;
|
||||
zstr.opaque = NULL;
|
||||
zstr.avail_in = 0;
|
||||
zstr.avail_out = 0;
|
||||
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0))
|
||||
mem_level = TORRENT_MEM_LEVEL;
|
||||
else
|
||||
mem_level = MAX_MEM_LEVEL;
|
||||
|
||||
/* -MAX_WBITS: undocumented feature of zlib to _not_ write a zlib header */
|
||||
deflateInit2(&zstr, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, mem_level,
|
||||
Z_DEFAULT_STRATEGY);
|
||||
|
||||
zstr.next_out = (Bytef *)b2;
|
||||
zstr.avail_out = sizeof(b2);
|
||||
zstr.next_in = NULL;
|
||||
zstr.avail_in = 0;
|
||||
|
||||
flush = 0;
|
||||
end = 0;
|
||||
while (!end) {
|
||||
if (zstr.avail_in == 0 && !flush) {
|
||||
if ((n=cb(ud, b1, sizeof(b1), ZIP_SOURCE_READ)) < 0) {
|
||||
ch_set_error(&za->error, cb, ud);
|
||||
deflateEnd(&zstr);
|
||||
return -1;
|
||||
}
|
||||
if (n > 0) {
|
||||
zstr.avail_in = n;
|
||||
zstr.next_in = (Bytef *)b1;
|
||||
st->size += n;
|
||||
st->crc = crc32(st->crc, (Bytef *)b1, n);
|
||||
}
|
||||
else
|
||||
flush = Z_FINISH;
|
||||
}
|
||||
|
||||
ret = deflate(&zstr, flush);
|
||||
if (ret != Z_OK && ret != Z_STREAM_END) {
|
||||
_zip_error_set(&za->error, ZIP_ER_ZLIB, ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (zstr.avail_out != sizeof(b2)) {
|
||||
n2 = sizeof(b2) - zstr.avail_out;
|
||||
|
||||
if (fwrite(b2, 1, n2, ft) != n2) {
|
||||
_zip_error_set(&za->error, ZIP_ER_WRITE, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
zstr.next_out = (Bytef *)b2;
|
||||
zstr.avail_out = sizeof(b2);
|
||||
st->comp_size += n2;
|
||||
}
|
||||
|
||||
if (ret == Z_STREAM_END) {
|
||||
deflateEnd(&zstr);
|
||||
end = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ch_set_error(struct zip_error *error, zip_source_callback cb, void *ud)
|
||||
{
|
||||
int e[2];
|
||||
|
||||
if ((cb(ud, e, sizeof(e), ZIP_SOURCE_ERROR)) < (ssize_t)sizeof(e)) {
|
||||
error->zip_err = ZIP_ER_INTERNAL;
|
||||
error->sys_err = 0;
|
||||
}
|
||||
else {
|
||||
error->zip_err = e[0];
|
||||
error->sys_err = e[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
int n, nn;
|
||||
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
while (len > 0) {
|
||||
nn = len > sizeof(buf) ? sizeof(buf) : len;
|
||||
if ((n=fread(buf, 1, nn, fs)) < 0) {
|
||||
_zip_error_set(error, ZIP_ER_READ, errno);
|
||||
return -1;
|
||||
}
|
||||
else if (n == 0) {
|
||||
_zip_error_set(error, ZIP_ER_EOF, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fwrite(buf, 1, n, ft) != (size_t)n) {
|
||||
_zip_error_set(error, ZIP_ER_WRITE, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
len -= n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
write_cdir(struct zip *za, struct zip_cdir *cd, FILE *out)
|
||||
{
|
||||
off_t offset;
|
||||
uLong crc;
|
||||
char buf[TORRENT_CRC_LEN+1];
|
||||
|
||||
if (_zip_cdir_write(cd, out, &za->error) < 0)
|
||||
return -1;
|
||||
|
||||
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
/* fix up torrentzip comment */
|
||||
|
||||
offset = ftello(out);
|
||||
|
||||
if (_zip_filerange_crc(out, cd->offset, cd->size, &crc, &za->error) < 0)
|
||||
return -1;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%08lX", (long)crc);
|
||||
|
||||
if (fseeko(out, offset-TORRENT_CRC_LEN, SEEK_SET) < 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fwrite(buf, TORRENT_CRC_LEN, 1, out) != 1) {
|
||||
_zip_error_set(&za->error, ZIP_ER_WRITE, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
_zip_cdir_set_comment(struct zip_cdir *dest, struct zip *src)
|
||||
{
|
||||
if (src->ch_comment_len != -1) {
|
||||
dest->comment = _zip_memdup(src->ch_comment,
|
||||
src->ch_comment_len, &src->error);
|
||||
if (dest->comment == NULL)
|
||||
return -1;
|
||||
dest->comment_len = src->ch_comment_len;
|
||||
} else {
|
||||
if (src->cdir && src->cdir->comment) {
|
||||
dest->comment = _zip_memdup(src->cdir->comment,
|
||||
src->cdir->comment_len, &src->error);
|
||||
if (dest->comment == NULL)
|
||||
return -1;
|
||||
dest->comment_len = src->cdir->comment_len;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
_zip_changed(struct zip *za, int *survivorsp)
|
||||
{
|
||||
int changed, i, survivors;
|
||||
|
||||
changed = survivors = 0;
|
||||
|
||||
if (za->ch_comment_len != -1
|
||||
|| za->ch_flags != za->flags)
|
||||
changed = 1;
|
||||
|
||||
for (i=0; i<za->nentry; i++) {
|
||||
if ((za->entry[i].state != ZIP_ST_UNCHANGED)
|
||||
|| (za->entry[i].ch_comment_len != -1))
|
||||
changed = 1;
|
||||
if (za->entry[i].state != ZIP_ST_DELETED)
|
||||
survivors++;
|
||||
}
|
||||
|
||||
*survivorsp = survivors;
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char *
|
||||
_zip_create_temp_output(struct zip *za, FILE **outp)
|
||||
{
|
||||
char *temp;
|
||||
int tfd;
|
||||
FILE *tfp;
|
||||
|
||||
if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sprintf(temp, "%s.XXXXXX", za->zn);
|
||||
|
||||
if ((tfd=mkstemp(temp)) == -1) {
|
||||
_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
|
||||
free(temp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((tfp=fdopen(tfd, "r+b")) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
|
||||
close(tfd);
|
||||
remove(temp);
|
||||
free(temp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*outp = tfp;
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
_zip_torrentzip_cmp(const void *a, const void *b)
|
||||
{
|
||||
return strcasecmp(((const struct filelist *)a)->name,
|
||||
((const struct filelist *)b)->name);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
zip_delete.c -- delete file from zip archive
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_delete(struct zip *za, int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= za->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* allow duplicate file names, because the file will
|
||||
* be removed directly afterwards */
|
||||
if (_zip_unchange(za, idx, 1) != 0)
|
||||
return -1;
|
||||
|
||||
za->entry[idx].state = ZIP_ST_DELETED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,615 +0,0 @@
|
||||
/*
|
||||
zip_dirent.c -- read directory entry (local or central), clean dirent
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
static time_t _zip_d2u_time(int, int);
|
||||
static char *_zip_readfpstr(FILE *, unsigned int, int, struct zip_error *);
|
||||
static char *_zip_readstr(unsigned char **, int, int, struct zip_error *);
|
||||
static void _zip_u2d_time(time_t, unsigned short *, unsigned short *);
|
||||
static void _zip_write2(unsigned short, FILE *);
|
||||
static void _zip_write4(unsigned int, FILE *);
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_cdir_free(struct zip_cdir *cd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!cd)
|
||||
return;
|
||||
|
||||
for (i=0; i<cd->nentry; i++)
|
||||
_zip_dirent_finalize(cd->entry+i);
|
||||
free(cd->comment);
|
||||
free(cd->entry);
|
||||
free(cd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_cdir_grow(struct zip_cdir *cd, int nentry, struct zip_error *error)
|
||||
{
|
||||
struct zip_dirent *entry;
|
||||
|
||||
if (nentry < cd->nentry) {
|
||||
_zip_error_set(error, ZIP_ER_INTERNAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((entry=((struct zip_dirent *)
|
||||
realloc(cd->entry, sizeof(*(cd->entry))*nentry))) == NULL) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
cd->nentry = nentry;
|
||||
cd->entry = entry;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct zip_cdir *
|
||||
_zip_cdir_new(int nentry, struct zip_error *error)
|
||||
{
|
||||
struct zip_cdir *cd;
|
||||
|
||||
if ((cd=(struct zip_cdir *)malloc(sizeof(*cd))) == NULL) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((cd->entry=(struct zip_dirent *)malloc(sizeof(*(cd->entry))*nentry))
|
||||
== NULL) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
free(cd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* entries must be initialized by caller */
|
||||
|
||||
cd->nentry = nentry;
|
||||
cd->size = cd->offset = 0;
|
||||
cd->comment = NULL;
|
||||
cd->comment_len = 0;
|
||||
|
||||
return cd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error)
|
||||
{
|
||||
int i;
|
||||
|
||||
cd->offset = ftello(fp);
|
||||
|
||||
for (i=0; i<cd->nentry; i++) {
|
||||
if (_zip_dirent_write(cd->entry+i, fp, 0, error) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
cd->size = ftello(fp) - cd->offset;
|
||||
|
||||
/* clearerr(fp); */
|
||||
fwrite(EOCD_MAGIC, 1, 4, fp);
|
||||
_zip_write4(0, fp);
|
||||
_zip_write2((unsigned short)cd->nentry, fp);
|
||||
_zip_write2((unsigned short)cd->nentry, fp);
|
||||
_zip_write4(cd->size, fp);
|
||||
_zip_write4(cd->offset, fp);
|
||||
_zip_write2(cd->comment_len, fp);
|
||||
fwrite(cd->comment, 1, cd->comment_len, fp);
|
||||
|
||||
if (ferror(fp)) {
|
||||
_zip_error_set(error, ZIP_ER_WRITE, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_dirent_finalize(struct zip_dirent *zde)
|
||||
{
|
||||
free(zde->filename);
|
||||
zde->filename = NULL;
|
||||
free(zde->extrafield);
|
||||
zde->extrafield = NULL;
|
||||
free(zde->comment);
|
||||
zde->comment = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_dirent_init(struct zip_dirent *de)
|
||||
{
|
||||
de->version_madeby = 0;
|
||||
de->version_needed = 20; /* 2.0 */
|
||||
de->bitflags = 0;
|
||||
de->comp_method = 0;
|
||||
de->last_mod = 0;
|
||||
de->crc = 0;
|
||||
de->comp_size = 0;
|
||||
de->uncomp_size = 0;
|
||||
de->filename = NULL;
|
||||
de->filename_len = 0;
|
||||
de->extrafield = NULL;
|
||||
de->extrafield_len = 0;
|
||||
de->comment = NULL;
|
||||
de->comment_len = 0;
|
||||
de->disk_number = 0;
|
||||
de->int_attrib = 0;
|
||||
de->ext_attrib = 0;
|
||||
de->offset = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* _zip_dirent_read(zde, fp, bufp, left, localp, error):
|
||||
Fills the zip directory entry zde.
|
||||
|
||||
If bufp is non-NULL, data is taken from there and bufp is advanced
|
||||
by the amount of data used; otherwise data is read from fp as needed.
|
||||
|
||||
if leftp is non-NULL, no more bytes than specified by it are used,
|
||||
and *leftp is reduced by the number of bytes used.
|
||||
|
||||
If local != 0, it reads a local header instead of a central
|
||||
directory entry.
|
||||
|
||||
Returns 0 if successful. On error, error is filled in and -1 is
|
||||
returned.
|
||||
|
||||
XXX: leftp and file position undefined on error.
|
||||
*/
|
||||
|
||||
int
|
||||
_zip_dirent_read(struct zip_dirent *zde, FILE *fp,
|
||||
unsigned char **bufp, unsigned int *leftp, int local,
|
||||
struct zip_error *error)
|
||||
{
|
||||
unsigned char buf[CDENTRYSIZE];
|
||||
unsigned char *cur;
|
||||
unsigned short dostime, dosdate;
|
||||
unsigned int size;
|
||||
|
||||
if (local)
|
||||
size = LENTRYSIZE;
|
||||
else
|
||||
size = CDENTRYSIZE;
|
||||
|
||||
if (leftp && (*leftp < size)) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bufp) {
|
||||
/* use data from buffer */
|
||||
cur = *bufp;
|
||||
}
|
||||
else {
|
||||
/* read entry from disk */
|
||||
if ((fread(buf, 1, size, fp)<size)) {
|
||||
_zip_error_set(error, ZIP_ER_READ, errno);
|
||||
return -1;
|
||||
}
|
||||
cur = buf;
|
||||
}
|
||||
|
||||
if (memcmp(cur, (local ? LOCAL_MAGIC : CENTRAL_MAGIC), 4) != 0) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return -1;
|
||||
}
|
||||
cur += 4;
|
||||
|
||||
|
||||
/* convert buffercontents to zip_dirent */
|
||||
|
||||
if (!local)
|
||||
zde->version_madeby = _zip_read2(&cur);
|
||||
else
|
||||
zde->version_madeby = 0;
|
||||
zde->version_needed = _zip_read2(&cur);
|
||||
zde->bitflags = _zip_read2(&cur);
|
||||
zde->comp_method = _zip_read2(&cur);
|
||||
|
||||
/* convert to time_t */
|
||||
dostime = _zip_read2(&cur);
|
||||
dosdate = _zip_read2(&cur);
|
||||
zde->last_mod = _zip_d2u_time(dostime, dosdate);
|
||||
|
||||
zde->crc = _zip_read4(&cur);
|
||||
zde->comp_size = _zip_read4(&cur);
|
||||
zde->uncomp_size = _zip_read4(&cur);
|
||||
|
||||
zde->filename_len = _zip_read2(&cur);
|
||||
zde->extrafield_len = _zip_read2(&cur);
|
||||
|
||||
if (local) {
|
||||
zde->comment_len = 0;
|
||||
zde->disk_number = 0;
|
||||
zde->int_attrib = 0;
|
||||
zde->ext_attrib = 0;
|
||||
zde->offset = 0;
|
||||
} else {
|
||||
zde->comment_len = _zip_read2(&cur);
|
||||
zde->disk_number = _zip_read2(&cur);
|
||||
zde->int_attrib = _zip_read2(&cur);
|
||||
zde->ext_attrib = _zip_read4(&cur);
|
||||
zde->offset = _zip_read4(&cur);
|
||||
}
|
||||
|
||||
zde->filename = NULL;
|
||||
zde->extrafield = NULL;
|
||||
zde->comment = NULL;
|
||||
|
||||
size += zde->filename_len+zde->extrafield_len+zde->comment_len;
|
||||
|
||||
if (leftp && (*leftp < size)) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bufp) {
|
||||
if (zde->filename_len) {
|
||||
zde->filename = _zip_readstr(&cur, zde->filename_len, 1, error);
|
||||
if (!zde->filename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (zde->extrafield_len) {
|
||||
zde->extrafield = _zip_readstr(&cur, zde->extrafield_len, 0,
|
||||
error);
|
||||
if (!zde->extrafield)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (zde->comment_len) {
|
||||
zde->comment = _zip_readstr(&cur, zde->comment_len, 0, error);
|
||||
if (!zde->comment)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (zde->filename_len) {
|
||||
zde->filename = _zip_readfpstr(fp, zde->filename_len, 1, error);
|
||||
if (!zde->filename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (zde->extrafield_len) {
|
||||
zde->extrafield = _zip_readfpstr(fp, zde->extrafield_len, 0,
|
||||
error);
|
||||
if (!zde->extrafield)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (zde->comment_len) {
|
||||
zde->comment = _zip_readfpstr(fp, zde->comment_len, 0, error);
|
||||
if (!zde->comment)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (bufp)
|
||||
*bufp = cur;
|
||||
if (leftp)
|
||||
*leftp -= size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* _zip_dirent_torrent_normalize(de);
|
||||
Set values suitable for torrentzip.
|
||||
*/
|
||||
|
||||
void
|
||||
_zip_dirent_torrent_normalize(struct zip_dirent *de)
|
||||
{
|
||||
static struct tm torrenttime;
|
||||
static time_t last_mod = 0;
|
||||
|
||||
if (last_mod == 0) {
|
||||
#ifdef HAVE_STRUCT_TM_TM_ZONE
|
||||
time_t now;
|
||||
struct tm *l;
|
||||
#endif
|
||||
|
||||
torrenttime.tm_sec = 0;
|
||||
torrenttime.tm_min = 32;
|
||||
torrenttime.tm_hour = 23;
|
||||
torrenttime.tm_mday = 24;
|
||||
torrenttime.tm_mon = 11;
|
||||
torrenttime.tm_year = 96;
|
||||
torrenttime.tm_wday = 0;
|
||||
torrenttime.tm_yday = 0;
|
||||
torrenttime.tm_isdst = 0;
|
||||
|
||||
#ifdef HAVE_STRUCT_TM_TM_ZONE
|
||||
time(&now);
|
||||
l = localtime(&now);
|
||||
torrenttime.tm_gmtoff = l->tm_gmtoff;
|
||||
torrenttime.tm_zone = l->tm_zone;
|
||||
#endif
|
||||
|
||||
last_mod = mktime(&torrenttime);
|
||||
}
|
||||
|
||||
de->version_madeby = 0;
|
||||
de->version_needed = 20; /* 2.0 */
|
||||
de->bitflags = 2; /* maximum compression */
|
||||
de->comp_method = ZIP_CM_DEFLATE;
|
||||
de->last_mod = last_mod;
|
||||
|
||||
de->disk_number = 0;
|
||||
de->int_attrib = 0;
|
||||
de->ext_attrib = 0;
|
||||
de->offset = 0;
|
||||
|
||||
free(de->extrafield);
|
||||
de->extrafield = NULL;
|
||||
de->extrafield_len = 0;
|
||||
free(de->comment);
|
||||
de->comment = NULL;
|
||||
de->comment_len = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* _zip_dirent_write(zde, fp, localp, error):
|
||||
Writes zip directory entry zde to file fp.
|
||||
|
||||
If localp != 0, it writes a local header instead of a central
|
||||
directory entry.
|
||||
|
||||
Returns 0 if successful. On error, error is filled in and -1 is
|
||||
returned.
|
||||
*/
|
||||
|
||||
int
|
||||
_zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp,
|
||||
struct zip_error *error)
|
||||
{
|
||||
unsigned short dostime, dosdate;
|
||||
|
||||
fwrite(localp ? LOCAL_MAGIC : CENTRAL_MAGIC, 1, 4, fp);
|
||||
|
||||
if (!localp)
|
||||
_zip_write2(zde->version_madeby, fp);
|
||||
_zip_write2(zde->version_needed, fp);
|
||||
_zip_write2(zde->bitflags, fp);
|
||||
_zip_write2(zde->comp_method, fp);
|
||||
|
||||
_zip_u2d_time(zde->last_mod, &dostime, &dosdate);
|
||||
_zip_write2(dostime, fp);
|
||||
_zip_write2(dosdate, fp);
|
||||
|
||||
_zip_write4(zde->crc, fp);
|
||||
_zip_write4(zde->comp_size, fp);
|
||||
_zip_write4(zde->uncomp_size, fp);
|
||||
|
||||
_zip_write2(zde->filename_len, fp);
|
||||
_zip_write2(zde->extrafield_len, fp);
|
||||
|
||||
if (!localp) {
|
||||
_zip_write2(zde->comment_len, fp);
|
||||
_zip_write2(zde->disk_number, fp);
|
||||
_zip_write2(zde->int_attrib, fp);
|
||||
_zip_write4(zde->ext_attrib, fp);
|
||||
_zip_write4(zde->offset, fp);
|
||||
}
|
||||
|
||||
if (zde->filename_len)
|
||||
fwrite(zde->filename, 1, zde->filename_len, fp);
|
||||
|
||||
if (zde->extrafield_len)
|
||||
fwrite(zde->extrafield, 1, zde->extrafield_len, fp);
|
||||
|
||||
if (!localp) {
|
||||
if (zde->comment_len)
|
||||
fwrite(zde->comment, 1, zde->comment_len, fp);
|
||||
}
|
||||
|
||||
if (ferror(fp)) {
|
||||
_zip_error_set(error, ZIP_ER_WRITE, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static time_t
|
||||
_zip_d2u_time(int dtime, int ddate)
|
||||
{
|
||||
struct tm tm;
|
||||
|
||||
memset(&tm, sizeof(tm), 0);
|
||||
|
||||
/* let mktime decide if DST is in effect */
|
||||
tm.tm_isdst = -1;
|
||||
|
||||
tm.tm_year = ((ddate>>9)&127) + 1980 - 1900;
|
||||
tm.tm_mon = ((ddate>>5)&15) - 1;
|
||||
tm.tm_mday = ddate&31;
|
||||
|
||||
tm.tm_hour = (dtime>>11)&31;
|
||||
tm.tm_min = (dtime>>5)&63;
|
||||
tm.tm_sec = (dtime<<1)&62;
|
||||
|
||||
return mktime(&tm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned short
|
||||
_zip_read2(unsigned char **a)
|
||||
{
|
||||
unsigned short ret;
|
||||
|
||||
ret = (*a)[0]+((*a)[1]<<8);
|
||||
*a += 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int
|
||||
_zip_read4(unsigned char **a)
|
||||
{
|
||||
unsigned int ret;
|
||||
|
||||
ret = ((((((*a)[3]<<8)+(*a)[2])<<8)+(*a)[1])<<8)+(*a)[0];
|
||||
*a += 4;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char *
|
||||
_zip_readfpstr(FILE *fp, unsigned int len, int nulp, struct zip_error *error)
|
||||
{
|
||||
char *r, *o;
|
||||
|
||||
r = (char *)malloc(nulp ? len+1 : len);
|
||||
if (!r) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fread(r, 1, len, fp)<len) {
|
||||
free(r);
|
||||
_zip_error_set(error, ZIP_ER_READ, errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (nulp) {
|
||||
/* replace any in-string NUL characters with spaces */
|
||||
r[len] = 0;
|
||||
for (o=r; o<r+len; o++)
|
||||
if (*o == '\0')
|
||||
*o = ' ';
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char *
|
||||
_zip_readstr(unsigned char **buf, int len, int nulp, struct zip_error *error)
|
||||
{
|
||||
char *r, *o;
|
||||
|
||||
r = (char *)malloc(nulp ? len+1 : len);
|
||||
if (!r) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(r, *buf, len);
|
||||
*buf += len;
|
||||
|
||||
if (nulp) {
|
||||
/* replace any in-string NUL characters with spaces */
|
||||
r[len] = 0;
|
||||
for (o=r; o<r+len; o++)
|
||||
if (*o == '\0')
|
||||
*o = ' ';
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_zip_write2(unsigned short i, FILE *fp)
|
||||
{
|
||||
putc(i&0xff, fp);
|
||||
putc((i>>8)&0xff, fp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_zip_write4(unsigned int i, FILE *fp)
|
||||
{
|
||||
putc(i&0xff, fp);
|
||||
putc((i>>8)&0xff, fp);
|
||||
putc((i>>16)&0xff, fp);
|
||||
putc((i>>24)&0xff, fp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate)
|
||||
{
|
||||
struct tm *tm;
|
||||
|
||||
tm = localtime(&time);
|
||||
*ddate = ((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5)
|
||||
+ tm->tm_mday;
|
||||
*dtime = ((tm->tm_hour)<<11) + ((tm->tm_min)<<5)
|
||||
+ ((tm->tm_sec)>>1);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
zip_entry_free.c -- free struct zip_entry
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_entry_free(struct zip_entry *ze)
|
||||
{
|
||||
free(ze->ch_filename);
|
||||
ze->ch_filename = NULL;
|
||||
free(ze->ch_comment);
|
||||
ze->ch_comment = NULL;
|
||||
ze->ch_comment_len = -1;
|
||||
|
||||
_zip_unchange_data(ze);
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
zip_entry_new.c -- create and init struct zip_entry
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
struct zip_entry *
|
||||
_zip_entry_new(struct zip *za)
|
||||
{
|
||||
struct zip_entry *ze;
|
||||
if (!za) {
|
||||
ze = (struct zip_entry *)malloc(sizeof(struct zip_entry));
|
||||
if (!ze) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (za->nentry >= za->nentry_alloc-1) {
|
||||
za->nentry_alloc += 16;
|
||||
za->entry = (struct zip_entry *)realloc(za->entry,
|
||||
sizeof(struct zip_entry)
|
||||
* za->nentry_alloc);
|
||||
if (!za->entry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
ze = za->entry+za->nentry;
|
||||
}
|
||||
|
||||
ze->state = ZIP_ST_UNCHANGED;
|
||||
|
||||
ze->ch_filename = NULL;
|
||||
ze->ch_comment = NULL;
|
||||
ze->ch_comment_len = -1;
|
||||
ze->source = NULL;
|
||||
|
||||
if (za)
|
||||
za->nentry++;
|
||||
|
||||
return ze;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
This file was generated automatically by ./make_zip_err_str.sh
|
||||
from ./zip.h; make changes there.
|
||||
*/
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
const char * const _zip_err_str[] = {
|
||||
"No error",
|
||||
"Multi-disk zip archives not supported",
|
||||
"Renaming temporary file failed",
|
||||
"Closing zip archive failed",
|
||||
"Seek error",
|
||||
"Read error",
|
||||
"Write error",
|
||||
"CRC error",
|
||||
"Containing zip archive was closed",
|
||||
"No such file",
|
||||
"File already exists",
|
||||
"Can't open file",
|
||||
"Failure to create temporary file",
|
||||
"Zlib error",
|
||||
"Malloc failure",
|
||||
"Entry has been changed",
|
||||
"Compression method not supported",
|
||||
"Premature EOF",
|
||||
"Invalid argument",
|
||||
"Not a zip archive",
|
||||
"Internal error",
|
||||
"Zip archive inconsistent",
|
||||
"Can't remove file",
|
||||
"Entry has been deleted",
|
||||
};
|
||||
|
||||
const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]);
|
||||
|
||||
#define N ZIP_ET_NONE
|
||||
#define S ZIP_ET_SYS
|
||||
#define Z ZIP_ET_ZLIB
|
||||
|
||||
const int _zip_err_type[] = {
|
||||
N,
|
||||
N,
|
||||
S,
|
||||
S,
|
||||
S,
|
||||
S,
|
||||
S,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
S,
|
||||
S,
|
||||
Z,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
N,
|
||||
S,
|
||||
N,
|
||||
};
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
zip_error.c -- struct zip_error helper functions
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_error_clear(struct zip_error *err)
|
||||
{
|
||||
err->zip_err = ZIP_ER_OK;
|
||||
err->sys_err = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_error_copy(struct zip_error *dst, struct zip_error *src)
|
||||
{
|
||||
dst->zip_err = src->zip_err;
|
||||
dst->sys_err = src->sys_err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_error_fini(struct zip_error *err)
|
||||
{
|
||||
free(err->str);
|
||||
err->str = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_error_get(struct zip_error *err, int *zep, int *sep)
|
||||
{
|
||||
if (zep)
|
||||
*zep = err->zip_err;
|
||||
if (sep) {
|
||||
if (zip_error_get_sys_type(err->zip_err) != ZIP_ET_NONE)
|
||||
*sep = err->sys_err;
|
||||
else
|
||||
*sep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_error_init(struct zip_error *err)
|
||||
{
|
||||
err->zip_err = ZIP_ER_OK;
|
||||
err->sys_err = 0;
|
||||
err->str = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_zip_error_set(struct zip_error *err, int ze, int se)
|
||||
{
|
||||
if (err) {
|
||||
err->zip_err = ze;
|
||||
err->sys_err = se;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
zip_error_clear.c -- clear zip error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN void
|
||||
zip_error_clear(struct zip *za)
|
||||
{
|
||||
_zip_error_clear(&za->error);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
zip_error_get.c -- get zip error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN void
|
||||
zip_error_get(struct zip *za, int *zep, int *sep)
|
||||
{
|
||||
_zip_error_get(&za->error, zep, sep);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
zip_error_get_sys_type.c -- return type of system error code
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_error_get_sys_type(int ze)
|
||||
{
|
||||
if (ze < 0 || ze >= _zip_nerr_str)
|
||||
return 0;
|
||||
|
||||
return _zip_err_type[ze];
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
zip_error_sterror.c -- get string representation of struct zip_error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
const char *
|
||||
_zip_error_strerror(struct zip_error *err)
|
||||
{
|
||||
const char *zs, *ss;
|
||||
char buf[128], *s;
|
||||
|
||||
_zip_error_fini(err);
|
||||
|
||||
if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) {
|
||||
sprintf(buf, "Unknown error %d", err->zip_err);
|
||||
zs = NULL;
|
||||
ss = buf;
|
||||
}
|
||||
else {
|
||||
zs = _zip_err_str[err->zip_err];
|
||||
|
||||
switch (_zip_err_type[err->zip_err]) {
|
||||
case ZIP_ET_SYS:
|
||||
ss = strerror(err->sys_err);
|
||||
break;
|
||||
|
||||
case ZIP_ET_ZLIB:
|
||||
ss = zError(err->sys_err);
|
||||
break;
|
||||
|
||||
default:
|
||||
ss = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ss == NULL)
|
||||
return zs;
|
||||
else {
|
||||
if ((s=(char *)malloc(strlen(ss)
|
||||
+ (zs ? strlen(zs)+2 : 0) + 1)) == NULL)
|
||||
return _zip_err_str[ZIP_ER_MEMORY];
|
||||
|
||||
sprintf(s, "%s%s%s",
|
||||
(zs ? zs : ""),
|
||||
(zs ? ": " : ""),
|
||||
ss);
|
||||
err->str = s;
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
zip_error_to_str.c -- get string representation of zip error code
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_error_to_str(char *buf, size_t len, int ze, int se)
|
||||
{
|
||||
const char *zs, *ss;
|
||||
|
||||
if (ze < 0 || ze >= _zip_nerr_str)
|
||||
return snprintf(buf, len, "Unknown error %d", ze);
|
||||
|
||||
zs = _zip_err_str[ze];
|
||||
|
||||
switch (_zip_err_type[ze]) {
|
||||
case ZIP_ET_SYS:
|
||||
ss = strerror(se);
|
||||
break;
|
||||
|
||||
case ZIP_ET_ZLIB:
|
||||
ss = zError(se);
|
||||
break;
|
||||
|
||||
default:
|
||||
ss = NULL;
|
||||
}
|
||||
|
||||
return snprintf(buf, len, "%s%s%s",
|
||||
zs, (ss ? ": " : ""), (ss ? ss : ""));
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
zip_fclose.c -- close file in zip archive
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_fclose(struct zip_file *zf)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
if (zf->zstr)
|
||||
inflateEnd(zf->zstr);
|
||||
free(zf->buffer);
|
||||
free(zf->zstr);
|
||||
|
||||
for (i=0; i<zf->za->nfile; i++) {
|
||||
if (zf->za->file[i] == zf) {
|
||||
zf->za->file[i] = zf->za->file[zf->za->nfile-1];
|
||||
zf->za->nfile--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
if (zf->error.zip_err)
|
||||
ret = zf->error.zip_err;
|
||||
else if ((zf->flags & ZIP_ZF_CRC) && (zf->flags & ZIP_ZF_EOF)) {
|
||||
/* if EOF, compare CRC */
|
||||
if (zf->crc_orig != zf->crc)
|
||||
ret = ZIP_ER_CRC;
|
||||
}
|
||||
|
||||
free(zf);
|
||||
return ret;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
zip_file_error_clear.c -- clear zip file error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN void
|
||||
zip_file_error_clear(struct zip_file *zf)
|
||||
{
|
||||
_zip_error_clear(&zf->error);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
zip_file_error_get.c -- get zip file error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN void
|
||||
zip_file_error_get(struct zip_file *zf, int *zep, int *sep)
|
||||
{
|
||||
_zip_error_get(&zf->error, zep, sep);
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
zip_file_get_offset.c -- get offset of file data in archive.
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
/* _zip_file_get_offset(za, ze):
|
||||
Returns the offset of the file data for entry ze.
|
||||
|
||||
On error, fills in za->error and returns 0.
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
_zip_file_get_offset(struct zip *za, int idx)
|
||||
{
|
||||
struct zip_dirent de;
|
||||
unsigned int offset;
|
||||
|
||||
offset = za->cdir->entry[idx].offset;
|
||||
|
||||
if (fseeko(za->zp, offset, SEEK_SET) != 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, &za->error) != 0)
|
||||
return 0;
|
||||
|
||||
offset += LENTRYSIZE + de.filename_len + de.extrafield_len;
|
||||
|
||||
_zip_dirent_finalize(&de);
|
||||
|
||||
return offset;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
zip_file_sterror.c -- get string representation of zip file error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN const char *
|
||||
zip_file_strerror(struct zip_file *zf)
|
||||
{
|
||||
return _zip_error_strerror(&zf->error);
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
zip_filerange_crc.c -- compute CRC32 for a range of a file
|
||||
Copyright (C) 2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_filerange_crc(FILE *fp, off_t start, off_t len, uLong *crcp,
|
||||
struct zip_error *errp)
|
||||
{
|
||||
Bytef buf[BUFSIZE];
|
||||
size_t n;
|
||||
|
||||
*crcp = crc32(0L, Z_NULL, 0);
|
||||
|
||||
if (fseeko(fp, start, SEEK_SET) != 0) {
|
||||
_zip_error_set(errp, ZIP_ER_SEEK, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (len > 0) {
|
||||
n = len > BUFSIZE ? BUFSIZE : len;
|
||||
if ((n=fread(buf, 1, n, fp)) <= 0) {
|
||||
_zip_error_set(errp, ZIP_ER_READ, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*crcp = crc32(*crcp, buf, n);
|
||||
|
||||
len-= n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
zip_fopen.c -- open file in zip archive for reading
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_file *
|
||||
zip_fopen(struct zip *za, const char *fname, int flags)
|
||||
{
|
||||
int idx;
|
||||
|
||||
if ((idx=zip_name_locate(za, fname, flags)) < 0)
|
||||
return NULL;
|
||||
|
||||
return zip_fopen_index(za, idx, flags);
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
zip_fopen_index.c -- open file in zip archive for reading by index
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
static struct zip_file *_zip_file_new(struct zip *za);
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_file *
|
||||
zip_fopen_index(struct zip *za, int fileno, int flags)
|
||||
{
|
||||
int len, ret;
|
||||
int zfflags;
|
||||
struct zip_file *zf;
|
||||
|
||||
if ((fileno < 0) || (fileno >= za->nentry)) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((flags & ZIP_FL_UNCHANGED) == 0
|
||||
&& ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) {
|
||||
_zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fileno >= za->cdir->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zfflags = 0;
|
||||
switch (za->cdir->entry[fileno].comp_method) {
|
||||
case ZIP_CM_STORE:
|
||||
zfflags |= ZIP_ZF_CRC;
|
||||
break;
|
||||
|
||||
case ZIP_CM_DEFLATE:
|
||||
if ((flags & ZIP_FL_COMPRESSED) == 0)
|
||||
zfflags |= ZIP_ZF_CRC | ZIP_ZF_DECOMP;
|
||||
break;
|
||||
default:
|
||||
if ((flags & ZIP_FL_COMPRESSED) == 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
zf = _zip_file_new(za);
|
||||
|
||||
zf->flags = zfflags;
|
||||
/* zf->name = za->cdir->entry[fileno].filename; */
|
||||
zf->method = za->cdir->entry[fileno].comp_method;
|
||||
zf->bytes_left = za->cdir->entry[fileno].uncomp_size;
|
||||
zf->cbytes_left = za->cdir->entry[fileno].comp_size;
|
||||
zf->crc_orig = za->cdir->entry[fileno].crc;
|
||||
|
||||
if ((zf->fpos=_zip_file_get_offset(za, fileno)) == 0) {
|
||||
zip_fclose(zf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((zf->flags & ZIP_ZF_DECOMP) == 0)
|
||||
zf->bytes_left = zf->cbytes_left;
|
||||
else {
|
||||
if ((zf->buffer=(char *)malloc(BUFSIZE)) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
zip_fclose(zf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf);
|
||||
if (len <= 0) {
|
||||
_zip_error_copy(&za->error, &zf->error);
|
||||
zip_fclose(zf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((zf->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
zip_fclose(zf);
|
||||
return NULL;
|
||||
}
|
||||
zf->zstr->zalloc = Z_NULL;
|
||||
zf->zstr->zfree = Z_NULL;
|
||||
zf->zstr->opaque = NULL;
|
||||
zf->zstr->next_in = (Bytef *)zf->buffer;
|
||||
zf->zstr->avail_in = len;
|
||||
|
||||
/* negative value to tell zlib that there is no header */
|
||||
if ((ret=inflateInit2(zf->zstr, -MAX_WBITS)) != Z_OK) {
|
||||
_zip_error_set(&za->error, ZIP_ER_ZLIB, ret);
|
||||
zip_fclose(zf);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return zf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (zf->error.zip_err != ZIP_ER_OK)
|
||||
return -1;
|
||||
|
||||
if ((zf->flags & ZIP_ZF_EOF) || zf->cbytes_left <= 0 || buflen <= 0)
|
||||
return 0;
|
||||
|
||||
if (fseeko(zf->za->zp, zf->fpos, SEEK_SET) < 0) {
|
||||
_zip_error_set(&zf->error, ZIP_ER_SEEK, errno);
|
||||
return -1;
|
||||
}
|
||||
if (buflen < zf->cbytes_left)
|
||||
i = buflen;
|
||||
else
|
||||
i = zf->cbytes_left;
|
||||
|
||||
j = fread(buf, 1, i, zf->za->zp);
|
||||
if (j == 0) {
|
||||
_zip_error_set(&zf->error, ZIP_ER_EOF, 0);
|
||||
j = -1;
|
||||
}
|
||||
else if (j < 0)
|
||||
_zip_error_set(&zf->error, ZIP_ER_READ, errno);
|
||||
else {
|
||||
zf->fpos += j;
|
||||
zf->cbytes_left -= j;
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct zip_file *
|
||||
_zip_file_new(struct zip *za)
|
||||
{
|
||||
struct zip_file *zf, **file;
|
||||
int n;
|
||||
|
||||
if ((zf=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (za->nfile >= za->nfile_alloc-1) {
|
||||
n = za->nfile_alloc + 10;
|
||||
file = (struct zip_file **)realloc(za->file,
|
||||
n*sizeof(struct zip_file *));
|
||||
if (file == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
free(zf);
|
||||
return NULL;
|
||||
}
|
||||
za->nfile_alloc = n;
|
||||
za->file = file;
|
||||
}
|
||||
|
||||
za->file[za->nfile++] = zf;
|
||||
|
||||
zf->za = za;
|
||||
_zip_error_init(&zf->error);
|
||||
zf->flags = 0;
|
||||
zf->crc = crc32(0L, Z_NULL, 0);
|
||||
zf->crc_orig = 0;
|
||||
zf->method = -1;
|
||||
zf->bytes_left = zf->cbytes_left = 0;
|
||||
zf->fpos = 0;
|
||||
zf->buffer = NULL;
|
||||
zf->zstr = NULL;
|
||||
|
||||
return zf;
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
zip_fread.c -- read from file
|
||||
Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN ssize_t
|
||||
zip_fread(struct zip_file *zf, void *outbuf, size_t toread)
|
||||
{
|
||||
int ret;
|
||||
size_t out_before, len;
|
||||
int i;
|
||||
|
||||
if (!zf)
|
||||
return -1;
|
||||
|
||||
if (zf->error.zip_err != 0)
|
||||
return -1;
|
||||
|
||||
if ((zf->flags & ZIP_ZF_EOF) || (toread == 0))
|
||||
return 0;
|
||||
|
||||
if (zf->bytes_left == 0) {
|
||||
zf->flags |= ZIP_ZF_EOF;
|
||||
if (zf->flags & ZIP_ZF_CRC) {
|
||||
if (zf->crc != zf->crc_orig) {
|
||||
_zip_error_set(&zf->error, ZIP_ER_CRC, 0);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((zf->flags & ZIP_ZF_DECOMP) == 0) {
|
||||
ret = _zip_file_fillbuf(outbuf, toread, zf);
|
||||
if (ret > 0) {
|
||||
if (zf->flags & ZIP_ZF_CRC)
|
||||
zf->crc = crc32(zf->crc, (Bytef *)outbuf, ret);
|
||||
zf->bytes_left -= ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
zf->zstr->next_out = (Bytef *)outbuf;
|
||||
zf->zstr->avail_out = toread;
|
||||
out_before = zf->zstr->total_out;
|
||||
|
||||
/* endless loop until something has been accomplished */
|
||||
for (;;) {
|
||||
ret = inflate(zf->zstr, Z_SYNC_FLUSH);
|
||||
|
||||
switch (ret) {
|
||||
case Z_STREAM_END:
|
||||
if (zf->zstr->total_out == out_before) {
|
||||
if (zf->crc != zf->crc_orig) {
|
||||
_zip_error_set(&zf->error, ZIP_ER_CRC, 0);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* fallthrough */
|
||||
|
||||
case Z_OK:
|
||||
len = zf->zstr->total_out - out_before;
|
||||
if (len >= zf->bytes_left || len >= toread) {
|
||||
if (zf->flags & ZIP_ZF_CRC)
|
||||
zf->crc = crc32(zf->crc, (Bytef *)outbuf, len);
|
||||
zf->bytes_left -= len;
|
||||
return len;
|
||||
}
|
||||
break;
|
||||
|
||||
case Z_BUF_ERROR:
|
||||
if (zf->zstr->avail_in == 0) {
|
||||
i = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf);
|
||||
if (i == 0) {
|
||||
_zip_error_set(&zf->error, ZIP_ER_INCONS, 0);
|
||||
return -1;
|
||||
}
|
||||
else if (i < 0)
|
||||
return -1;
|
||||
zf->zstr->next_in = (Bytef *)zf->buffer;
|
||||
zf->zstr->avail_in = i;
|
||||
continue;
|
||||
}
|
||||
/* fallthrough */
|
||||
case Z_NEED_DICT:
|
||||
case Z_DATA_ERROR:
|
||||
case Z_STREAM_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
_zip_error_set(&zf->error, ZIP_ER_ZLIB, ret);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
zip_free.c -- free struct zip
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
/* _zip_free:
|
||||
frees the space allocated to a zipfile struct, and closes the
|
||||
corresponding file. */
|
||||
|
||||
void
|
||||
_zip_free(struct zip *za)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (za == NULL)
|
||||
return;
|
||||
|
||||
if (za->zn)
|
||||
free(za->zn);
|
||||
|
||||
if (za->zp)
|
||||
fclose(za->zp);
|
||||
|
||||
_zip_cdir_free(za->cdir);
|
||||
|
||||
if (za->entry) {
|
||||
for (i=0; i<za->nentry; i++) {
|
||||
_zip_entry_free(za->entry+i);
|
||||
}
|
||||
free(za->entry);
|
||||
}
|
||||
|
||||
for (i=0; i<za->nfile; i++) {
|
||||
if (za->file[i]->error.zip_err == ZIP_ER_OK) {
|
||||
_zip_error_set(&za->file[i]->error, ZIP_ER_ZIPCLOSED, 0);
|
||||
za->file[i]->za = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free(za->file);
|
||||
|
||||
free(za);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
zip_get_archive_comment.c -- get archive comment
|
||||
Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN const char *
|
||||
zip_get_archive_comment(struct zip *za, int *lenp, int flags)
|
||||
{
|
||||
if ((flags & ZIP_FL_UNCHANGED)
|
||||
|| (za->ch_comment_len == -1)) {
|
||||
if (za->cdir) {
|
||||
if (lenp != NULL)
|
||||
*lenp = za->cdir->comment_len;
|
||||
return za->cdir->comment;
|
||||
}
|
||||
else {
|
||||
if (lenp != NULL)
|
||||
*lenp = -1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (lenp != NULL)
|
||||
*lenp = za->ch_comment_len;
|
||||
return za->ch_comment;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
zip_get_archive_flag.c -- get archive global flag
|
||||
Copyright (C) 2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_get_archive_flag(struct zip *za, int flag, int flags)
|
||||
{
|
||||
int fl;
|
||||
|
||||
fl = (flags & ZIP_FL_UNCHANGED) ? za->flags : za->ch_flags;
|
||||
|
||||
return (fl & flag) ? 1 : 0;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
zip_get_file_comment.c -- get file comment
|
||||
Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN const char *
|
||||
zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags)
|
||||
{
|
||||
if (idx < 0 || idx >= za->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((flags & ZIP_FL_UNCHANGED)
|
||||
|| (za->entry[idx].ch_comment_len == -1)) {
|
||||
if (lenp != NULL)
|
||||
*lenp = za->cdir->entry[idx].comment_len;
|
||||
return za->cdir->entry[idx].comment;
|
||||
}
|
||||
|
||||
if (lenp != NULL)
|
||||
*lenp = za->entry[idx].ch_comment_len;
|
||||
return za->entry[idx].ch_comment;
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
zip_get_name.c -- get filename for a file in zip file
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN const char *
|
||||
zip_get_name(struct zip *za, int idx, int flags)
|
||||
{
|
||||
return _zip_get_name(za, idx, flags, &za->error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *
|
||||
_zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error)
|
||||
{
|
||||
if (idx < 0 || idx >= za->nentry) {
|
||||
_zip_error_set(error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((flags & ZIP_FL_UNCHANGED) == 0) {
|
||||
if (za->entry[idx].state == ZIP_ST_DELETED) {
|
||||
_zip_error_set(error, ZIP_ER_DELETED, 0);
|
||||
return NULL;
|
||||
}
|
||||
if (za->entry[idx].ch_filename)
|
||||
return za->entry[idx].ch_filename;
|
||||
}
|
||||
|
||||
if (za->cdir == NULL || idx >= za->cdir->nentry) {
|
||||
_zip_error_set(error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return za->cdir->entry[idx].filename;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
zip_get_num_files.c -- get number of files in archive
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_get_num_files(struct zip *za)
|
||||
{
|
||||
if (za == NULL)
|
||||
return -1;
|
||||
|
||||
return za->nentry;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
zip_memdup.c -- internal zip function, "strdup" with len
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
void *
|
||||
_zip_memdup(const void *mem, size_t len, struct zip_error *error)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = malloc(len);
|
||||
if (!ret) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(ret, mem, len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
zip_name_locate.c -- get index by name
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_name_locate(struct zip *za, const char *fname, int flags)
|
||||
{
|
||||
return _zip_name_locate(za, fname, flags, &za->error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_name_locate(struct zip *za, const char *fname, int flags,
|
||||
struct zip_error *error)
|
||||
{
|
||||
int (*cmp)(const char *, const char *);
|
||||
const char *fn, *p;
|
||||
int i, n;
|
||||
|
||||
if (fname == NULL) {
|
||||
_zip_error_set(error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
|
||||
|
||||
n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry;
|
||||
for (i=0; i<n; i++) {
|
||||
if (flags & ZIP_FL_UNCHANGED)
|
||||
fn = za->cdir->entry[i].filename;
|
||||
else
|
||||
fn = _zip_get_name(za, i, flags, error);
|
||||
|
||||
/* newly added (partially filled) entry */
|
||||
if (fn == NULL)
|
||||
continue;
|
||||
|
||||
if (flags & ZIP_FL_NODIR) {
|
||||
p = strrchr(fn, '/');
|
||||
if (p)
|
||||
fn = p+1;
|
||||
}
|
||||
|
||||
if (cmp(fname, fn) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
_zip_error_set(error, ZIP_ER_NOENT, 0);
|
||||
return -1;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
zip_new.c -- create and init struct zip
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
/* _zip_new:
|
||||
creates a new zipfile struct, and sets the contents to zero; returns
|
||||
the new struct. */
|
||||
|
||||
struct zip *
|
||||
_zip_new(struct zip_error *error)
|
||||
{
|
||||
struct zip *za;
|
||||
|
||||
za = (struct zip *)malloc(sizeof(struct zip));
|
||||
if (!za) {
|
||||
_zip_error_set(error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
za->zn = NULL;
|
||||
za->zp = NULL;
|
||||
_zip_error_init(&za->error);
|
||||
za->cdir = NULL;
|
||||
za->ch_comment = NULL;
|
||||
za->ch_comment_len = -1;
|
||||
za->nentry = za->nentry_alloc = 0;
|
||||
za->entry = NULL;
|
||||
za->nfile = za->nfile_alloc = 0;
|
||||
za->file = NULL;
|
||||
za->flags = za->ch_flags = 0;
|
||||
|
||||
return za;
|
||||
}
|
||||
@@ -1,567 +0,0 @@
|
||||
/*
|
||||
zip_open.c -- open zip archive
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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/stat.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
static void set_error(int *, struct zip_error *, int);
|
||||
static struct zip *_zip_allocate_new(const char *, int *);
|
||||
static int _zip_checkcons(FILE *, struct zip_cdir *, struct zip_error *);
|
||||
static void _zip_check_torrentzip(struct zip *);
|
||||
static struct zip_cdir *_zip_find_central_dir(FILE *, int, int *, off_t);
|
||||
static int _zip_file_exists(const char *, int, int *);
|
||||
static int _zip_headercomp(struct zip_dirent *, int,
|
||||
struct zip_dirent *, int);
|
||||
static unsigned char *_zip_memmem(const unsigned char *, int,
|
||||
const unsigned char *, int);
|
||||
static struct zip_cdir *_zip_readcdir(FILE *, unsigned char *, unsigned char *,
|
||||
int, int, struct zip_error *);
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip *
|
||||
zip_open(const char *fn, int flags, int *zep)
|
||||
{
|
||||
FILE *fp;
|
||||
struct zip *za;
|
||||
struct zip_cdir *cdir;
|
||||
int i;
|
||||
off_t len;
|
||||
|
||||
switch (_zip_file_exists(fn, flags, zep)) {
|
||||
case -1:
|
||||
return NULL;
|
||||
case 0:
|
||||
return _zip_allocate_new(fn, zep);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((fp=fopen(fn, "rb")) == NULL) {
|
||||
set_error(zep, NULL, ZIP_ER_OPEN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fseeko(fp, 0, SEEK_END);
|
||||
len = ftello(fp);
|
||||
|
||||
/* treat empty files as empty archives */
|
||||
if (len == 0) {
|
||||
if ((za=_zip_allocate_new(fn, zep)) == NULL)
|
||||
fclose(fp);
|
||||
else
|
||||
za->zp = fp;
|
||||
return za;
|
||||
}
|
||||
|
||||
cdir = _zip_find_central_dir(fp, flags, zep, len);
|
||||
if (cdir == NULL) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((za=_zip_allocate_new(fn, zep)) == NULL) {
|
||||
_zip_cdir_free(cdir);
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
za->cdir = cdir;
|
||||
za->zp = fp;
|
||||
|
||||
if ((za->entry=(struct zip_entry *)malloc(sizeof(*(za->entry))
|
||||
* cdir->nentry)) == NULL) {
|
||||
set_error(zep, NULL, ZIP_ER_MEMORY);
|
||||
_zip_free(za);
|
||||
return NULL;
|
||||
}
|
||||
for (i=0; i<cdir->nentry; i++)
|
||||
_zip_entry_new(za);
|
||||
|
||||
_zip_check_torrentzip(za);
|
||||
za->ch_flags = za->flags;
|
||||
|
||||
return za;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_error(int *zep, struct zip_error *err, int ze)
|
||||
{
|
||||
int se;
|
||||
|
||||
if (err) {
|
||||
_zip_error_get(err, &ze, &se);
|
||||
if (zip_error_get_sys_type(ze) == ZIP_ET_SYS)
|
||||
errno = se;
|
||||
}
|
||||
|
||||
if (zep)
|
||||
*zep = ze;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* _zip_readcdir:
|
||||
tries to find a valid end-of-central-directory at the beginning of
|
||||
buf, and then the corresponding central directory entries.
|
||||
Returns a struct zip_cdir which contains the central directory
|
||||
entries, or NULL if unsuccessful. */
|
||||
|
||||
static struct zip_cdir *
|
||||
_zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen,
|
||||
int flags, struct zip_error *error)
|
||||
{
|
||||
struct zip_cdir *cd;
|
||||
unsigned char *cdp, **bufp;
|
||||
int i, comlen, nentry;
|
||||
unsigned int left;
|
||||
|
||||
comlen = buf + buflen - eocd - EOCDLEN;
|
||||
if (comlen < 0) {
|
||||
/* not enough bytes left for comment */
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check for end-of-central-dir magic */
|
||||
if (memcmp(eocd, EOCD_MAGIC, 4) != 0) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (memcmp(eocd+4, "\0\0\0\0", 4) != 0) {
|
||||
_zip_error_set(error, ZIP_ER_MULTIDISK, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cdp = eocd + 8;
|
||||
/* number of cdir-entries on this disk */
|
||||
i = _zip_read2(&cdp);
|
||||
/* number of cdir-entries */
|
||||
nentry = _zip_read2(&cdp);
|
||||
|
||||
if ((cd=_zip_cdir_new(nentry, error)) == NULL)
|
||||
return NULL;
|
||||
|
||||
cd->size = _zip_read4(&cdp);
|
||||
cd->offset = _zip_read4(&cdp);
|
||||
cd->comment = NULL;
|
||||
cd->comment_len = _zip_read2(&cdp);
|
||||
|
||||
if ((comlen < cd->comment_len) || (cd->nentry != i)) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
free(cd);
|
||||
return NULL;
|
||||
}
|
||||
if ((flags & ZIP_CHECKCONS) && comlen != cd->comment_len) {
|
||||
_zip_error_set(error, ZIP_ER_INCONS, 0);
|
||||
free(cd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cd->comment_len) {
|
||||
if ((cd->comment=(char *)_zip_memdup(eocd+EOCDLEN,
|
||||
cd->comment_len, error))
|
||||
== NULL) {
|
||||
free(cd);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (cd->size < (unsigned int)(eocd-buf)) {
|
||||
/* if buffer already read in, use it */
|
||||
cdp = eocd - cd->size;
|
||||
bufp = &cdp;
|
||||
}
|
||||
else {
|
||||
/* go to start of cdir and read it entry by entry */
|
||||
bufp = NULL;
|
||||
clearerr(fp);
|
||||
fseeko(fp, cd->offset, SEEK_SET);
|
||||
/* possible consistency check: cd->offset =
|
||||
len-(cd->size+cd->comment_len+EOCDLEN) ? */
|
||||
if (ferror(fp) || ((unsigned long)ftello(fp) != cd->offset)) {
|
||||
/* seek error or offset of cdir wrong */
|
||||
if (ferror(fp))
|
||||
_zip_error_set(error, ZIP_ER_SEEK, errno);
|
||||
else
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
free(cd);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
left = cd->size;
|
||||
i=0;
|
||||
do {
|
||||
if (i == cd->nentry && left > 0) {
|
||||
/* Infozip extension for more than 64k entries:
|
||||
nentries wraps around, size indicates correct EOCD */
|
||||
_zip_cdir_grow(cd, cd->nentry+0x10000, error);
|
||||
}
|
||||
|
||||
if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) {
|
||||
cd->nentry = i;
|
||||
_zip_cdir_free(cd);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
|
||||
} while (i<cd->nentry);
|
||||
|
||||
return cd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* _zip_checkcons:
|
||||
Checks the consistency of the central directory by comparing central
|
||||
directory entries with local headers and checking for plausible
|
||||
file and header offsets. Returns -1 if not plausible, else the
|
||||
difference between the lowest and the highest fileposition reached */
|
||||
|
||||
static int
|
||||
_zip_checkcons(FILE *fp, struct zip_cdir *cd, struct zip_error *error)
|
||||
{
|
||||
int i;
|
||||
unsigned int min, max, j;
|
||||
struct zip_dirent temp;
|
||||
|
||||
if (cd->nentry) {
|
||||
max = cd->entry[0].offset;
|
||||
min = cd->entry[0].offset;
|
||||
}
|
||||
else
|
||||
min = max = 0;
|
||||
|
||||
for (i=0; i<cd->nentry; i++) {
|
||||
if (cd->entry[i].offset < min)
|
||||
min = cd->entry[i].offset;
|
||||
if (min > cd->offset) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
j = cd->entry[i].offset + cd->entry[i].comp_size
|
||||
+ cd->entry[i].filename_len + LENTRYSIZE;
|
||||
if (j > max)
|
||||
max = j;
|
||||
if (max > cd->offset) {
|
||||
_zip_error_set(error, ZIP_ER_NOZIP, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fseeko(fp, cd->entry[i].offset, SEEK_SET) != 0) {
|
||||
_zip_error_set(error, ZIP_ER_SEEK, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_zip_dirent_read(&temp, fp, NULL, NULL, 1, error) == -1)
|
||||
return -1;
|
||||
|
||||
if (_zip_headercomp(cd->entry+i, 0, &temp, 1) != 0) {
|
||||
_zip_error_set(error, ZIP_ER_INCONS, 0);
|
||||
_zip_dirent_finalize(&temp);
|
||||
return -1;
|
||||
}
|
||||
_zip_dirent_finalize(&temp);
|
||||
}
|
||||
|
||||
return max - min;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* _zip_check_torrentzip:
|
||||
check wether ZA has a valid TORRENTZIP comment, i.e. is torrentzipped */
|
||||
|
||||
static void
|
||||
_zip_check_torrentzip(struct zip *za)
|
||||
{
|
||||
uLong crc_got, crc_should;
|
||||
char buf[8+1];
|
||||
char *end;
|
||||
|
||||
if (za->zp == NULL || za->cdir == NULL)
|
||||
return;
|
||||
|
||||
if (za->cdir->comment_len != TORRENT_SIG_LEN+8
|
||||
|| strncmp(za->cdir->comment, TORRENT_SIG, TORRENT_SIG_LEN) != 0)
|
||||
return;
|
||||
|
||||
memcpy(buf, za->cdir->comment+TORRENT_SIG_LEN, 8);
|
||||
buf[8] = '\0';
|
||||
errno = 0;
|
||||
crc_should = strtoul(buf, &end, 16);
|
||||
if ((crc_should == UINT_MAX && errno != 0) || (end && *end))
|
||||
return;
|
||||
|
||||
if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size,
|
||||
&crc_got, NULL) < 0)
|
||||
return;
|
||||
|
||||
if (crc_got == crc_should)
|
||||
za->flags |= ZIP_AFL_TORRENT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* _zip_headercomp:
|
||||
compares two headers h1 and h2; if they are local headers, set
|
||||
local1p or local2p respectively to 1, else 0. Return 0 if they
|
||||
are identical, -1 if not. */
|
||||
|
||||
static int
|
||||
_zip_headercomp(struct zip_dirent *h1, int local1p, struct zip_dirent *h2,
|
||||
int local2p)
|
||||
{
|
||||
if ((h1->version_needed != h2->version_needed)
|
||||
#if 0
|
||||
/* some zip-files have different values in local
|
||||
and global headers for the bitflags */
|
||||
|| (h1->bitflags != h2->bitflags)
|
||||
#endif
|
||||
|| (h1->comp_method != h2->comp_method)
|
||||
|| (h1->last_mod != h2->last_mod)
|
||||
|| (h1->filename_len != h2->filename_len)
|
||||
|| !h1->filename || !h2->filename
|
||||
|| strcmp(h1->filename, h2->filename))
|
||||
return -1;
|
||||
|
||||
/* check that CRC and sizes are zero if data descriptor is used */
|
||||
if ((h1->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) && local1p
|
||||
&& (h1->crc != 0
|
||||
|| h1->comp_size != 0
|
||||
|| h1->uncomp_size != 0))
|
||||
return -1;
|
||||
if ((h2->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) && local2p
|
||||
&& (h2->crc != 0
|
||||
|| h2->comp_size != 0
|
||||
|| h2->uncomp_size != 0))
|
||||
return -1;
|
||||
|
||||
/* check that CRC and sizes are equal if no data descriptor is used */
|
||||
if (((h1->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local1p == 0)
|
||||
&& ((h2->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local2p == 0)) {
|
||||
if ((h1->crc != h2->crc)
|
||||
|| (h1->comp_size != h2->comp_size)
|
||||
|| (h1->uncomp_size != h2->uncomp_size))
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((local1p == local2p)
|
||||
&& ((h1->extrafield_len != h2->extrafield_len)
|
||||
|| (h1->extrafield_len && h2->extrafield
|
||||
&& memcmp(h1->extrafield, h2->extrafield,
|
||||
h1->extrafield_len))))
|
||||
return -1;
|
||||
|
||||
/* if either is local, nothing more to check */
|
||||
if (local1p || local2p)
|
||||
return 0;
|
||||
|
||||
if ((h1->version_madeby != h2->version_madeby)
|
||||
|| (h1->disk_number != h2->disk_number)
|
||||
|| (h1->int_attrib != h2->int_attrib)
|
||||
|| (h1->ext_attrib != h2->ext_attrib)
|
||||
|| (h1->offset != h2->offset)
|
||||
|| (h1->comment_len != h2->comment_len)
|
||||
|| (h1->comment_len && h2->comment
|
||||
&& memcmp(h1->comment, h2->comment, h1->comment_len)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct zip *
|
||||
_zip_allocate_new(const char *fn, int *zep)
|
||||
{
|
||||
struct zip *za;
|
||||
struct zip_error error;
|
||||
|
||||
if ((za=_zip_new(&error)) == NULL) {
|
||||
set_error(zep, &error, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
za->zn = strdup(fn);
|
||||
if (!za->zn) {
|
||||
_zip_free(za);
|
||||
set_error(zep, NULL, ZIP_ER_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
return za;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
_zip_file_exists(const char *fn, int flags, int *zep)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (fn == NULL) {
|
||||
set_error(zep, NULL, ZIP_ER_INVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stat(fn, &st) != 0) {
|
||||
if (flags & ZIP_CREATE)
|
||||
return 0;
|
||||
else {
|
||||
set_error(zep, NULL, ZIP_ER_OPEN);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if ((flags & ZIP_EXCL)) {
|
||||
set_error(zep, NULL, ZIP_ER_EXISTS);
|
||||
return -1;
|
||||
}
|
||||
/* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL,
|
||||
just like open() */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct zip_cdir *
|
||||
_zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len)
|
||||
{
|
||||
struct zip_cdir *cdir, *cdirnew;
|
||||
unsigned char *buf, *match;
|
||||
int a, best, buflen, i;
|
||||
struct zip_error zerr;
|
||||
|
||||
i = fseeko(fp, -(len < CDBUFSIZE ? len : CDBUFSIZE), SEEK_END);
|
||||
if (i == -1 && errno != EFBIG) {
|
||||
/* seek before start of file on my machine */
|
||||
set_error(zep, NULL, ZIP_ER_SEEK);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 64k is too much for stack */
|
||||
if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) {
|
||||
set_error(zep, NULL, ZIP_ER_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
clearerr(fp);
|
||||
buflen = fread(buf, 1, CDBUFSIZE, fp);
|
||||
|
||||
if (ferror(fp)) {
|
||||
set_error(zep, NULL, ZIP_ER_READ);
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
best = -1;
|
||||
cdir = NULL;
|
||||
match = buf;
|
||||
_zip_error_set(&zerr, ZIP_ER_NOZIP, 0);
|
||||
|
||||
while ((match=_zip_memmem(match, buflen-(match-buf)-18,
|
||||
(const unsigned char *)EOCD_MAGIC, 4))!=NULL) {
|
||||
/* found match -- check, if good */
|
||||
/* to avoid finding the same match all over again */
|
||||
match++;
|
||||
if ((cdirnew=_zip_readcdir(fp, buf, match-1, buflen, flags,
|
||||
&zerr)) == NULL)
|
||||
continue;
|
||||
|
||||
if (cdir) {
|
||||
if (best <= 0)
|
||||
best = _zip_checkcons(fp, cdir, &zerr);
|
||||
a = _zip_checkcons(fp, cdirnew, &zerr);
|
||||
if (best < a) {
|
||||
_zip_cdir_free(cdir);
|
||||
cdir = cdirnew;
|
||||
best = a;
|
||||
}
|
||||
else
|
||||
_zip_cdir_free(cdirnew);
|
||||
}
|
||||
else {
|
||||
cdir = cdirnew;
|
||||
if (flags & ZIP_CHECKCONS)
|
||||
best = _zip_checkcons(fp, cdir, &zerr);
|
||||
else
|
||||
best = 0;
|
||||
}
|
||||
cdirnew = NULL;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
if (best < 0) {
|
||||
set_error(zep, &zerr, 0);
|
||||
_zip_cdir_free(cdir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cdir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned char *
|
||||
_zip_memmem(const unsigned char *big, int biglen, const unsigned char *little,
|
||||
int littlelen)
|
||||
{
|
||||
const unsigned char *p;
|
||||
|
||||
if ((biglen < littlelen) || (littlelen == 0))
|
||||
return NULL;
|
||||
p = big-1;
|
||||
while ((p=(const unsigned char *)
|
||||
memchr(p+1, little[0], (size_t)(big-(p+1)+biglen-littlelen+1)))
|
||||
!= NULL) {
|
||||
if (memcmp(p+1, little+1, littlelen-1)==0)
|
||||
return (unsigned char *)p;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
zip_rename.c -- rename file in zip archive
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_rename(struct zip *za, int idx, const char *name)
|
||||
{
|
||||
const char *old_name;
|
||||
int old_is_dir, new_is_dir;
|
||||
|
||||
if (idx >= za->nentry || idx < 0 || name[0] == '\0') {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((old_name=zip_get_name(za, idx, 0)) == NULL)
|
||||
return -1;
|
||||
|
||||
new_is_dir = (name[strlen(name)-1] == '/');
|
||||
old_is_dir = (old_name[strlen(old_name)-1] == '/');
|
||||
|
||||
if (new_is_dir != old_is_dir) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _zip_set_name(za, idx, name);
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
zip_replace.c -- replace file via callback function
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_replace(struct zip *za, int idx, struct zip_source *source)
|
||||
{
|
||||
if (idx < 0 || idx >= za->nentry || source == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_zip_replace(za, idx, NULL, source) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_replace(struct zip *za, int idx, const char *name,
|
||||
struct zip_source *source)
|
||||
{
|
||||
if (idx == -1) {
|
||||
if (_zip_entry_new(za) == NULL)
|
||||
return -1;
|
||||
|
||||
idx = za->nentry - 1;
|
||||
}
|
||||
|
||||
_zip_unchange_data(za->entry+idx);
|
||||
|
||||
if (name && _zip_set_name(za, idx, name) != 0)
|
||||
return -1;
|
||||
|
||||
za->entry[idx].state = ((za->cdir == NULL || idx >= za->cdir->nentry)
|
||||
? ZIP_ST_ADDED : ZIP_ST_REPLACED);
|
||||
za->entry[idx].source = source;
|
||||
|
||||
return idx;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
zip_set_archive_comment.c -- set archive comment
|
||||
Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_set_archive_comment(struct zip *za, const char *comment, int len)
|
||||
{
|
||||
char *tmpcom;
|
||||
|
||||
if (len < 0 || len > MAXCOMLEN
|
||||
|| (len > 0 && comment == NULL)) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
tmpcom = NULL;
|
||||
|
||||
free(za->ch_comment);
|
||||
za->ch_comment = tmpcom;
|
||||
za->ch_comment_len = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
zip_get_archive_flag.c -- set archive global flag
|
||||
Copyright (C) 2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_set_archive_flag(struct zip *za, int flag, int value)
|
||||
{
|
||||
if (value)
|
||||
za->ch_flags |= flag;
|
||||
else
|
||||
za->ch_flags &= ~flag;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
zip_set_file_comment.c -- set comment for file in archive
|
||||
Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_set_file_comment(struct zip *za, int idx, const char *comment, int len)
|
||||
{
|
||||
char *tmpcom;
|
||||
|
||||
if (idx < 0 || idx >= za->nentry
|
||||
|| len < 0 || len > MAXCOMLEN
|
||||
|| (len > 0 && comment == NULL)) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
tmpcom = NULL;
|
||||
|
||||
free(za->entry[idx].ch_comment);
|
||||
za->entry[idx].ch_comment = tmpcom;
|
||||
za->entry[idx].ch_comment_len = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
zip_set_name.c -- rename helper function
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_set_name(struct zip *za, int idx, const char *name)
|
||||
{
|
||||
char *s;
|
||||
int i;
|
||||
|
||||
if (idx < 0 || idx >= za->nentry || name == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((i=_zip_name_locate(za, name, 0, NULL)) != -1 && i != idx) {
|
||||
_zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* no effective name change */
|
||||
if (i == idx)
|
||||
return 0;
|
||||
|
||||
if ((s=strdup(name)) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (za->entry[idx].state == ZIP_ST_UNCHANGED)
|
||||
za->entry[idx].state = ZIP_ST_RENAMED;
|
||||
|
||||
free(za->entry[idx].ch_filename);
|
||||
za->entry[idx].ch_filename = s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
zip_source_buffer.c -- create zip data source from buffer
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
struct read_data {
|
||||
const char *buf, *data, *end;
|
||||
time_t mtime;
|
||||
int freep;
|
||||
};
|
||||
|
||||
static ssize_t read_data(void *state, void *data, size_t len,
|
||||
enum zip_source_cmd cmd);
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_source *
|
||||
zip_source_buffer(struct zip *za, const void *data, off_t len, int freep)
|
||||
{
|
||||
struct read_data *f;
|
||||
struct zip_source *zs;
|
||||
|
||||
if (za == NULL)
|
||||
return NULL;
|
||||
|
||||
if (len < 0 || (data == NULL && len > 0)) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((f=(struct read_data *)malloc(sizeof(*f))) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f->data = (const char *)data;
|
||||
f->end = ((const char *)data)+len;
|
||||
f->freep = freep;
|
||||
f->mtime = time(NULL);
|
||||
|
||||
if ((zs=zip_source_function(za, read_data, f)) == NULL) {
|
||||
free(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return zs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ssize_t
|
||||
read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd)
|
||||
{
|
||||
struct read_data *z;
|
||||
char *buf;
|
||||
size_t n;
|
||||
|
||||
z = (struct read_data *)state;
|
||||
buf = (char *)data;
|
||||
|
||||
switch (cmd) {
|
||||
case ZIP_SOURCE_OPEN:
|
||||
z->buf = z->data;
|
||||
return 0;
|
||||
|
||||
case ZIP_SOURCE_READ:
|
||||
n = z->end - z->buf;
|
||||
if (n > len)
|
||||
n = len;
|
||||
|
||||
if (n) {
|
||||
memcpy(buf, z->buf, n);
|
||||
z->buf += n;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
case ZIP_SOURCE_CLOSE:
|
||||
return 0;
|
||||
|
||||
case ZIP_SOURCE_STAT:
|
||||
{
|
||||
struct zip_stat *st;
|
||||
|
||||
if (len < sizeof(*st))
|
||||
return -1;
|
||||
|
||||
st = (struct zip_stat *)data;
|
||||
|
||||
zip_stat_init(st);
|
||||
st->mtime = z->mtime;
|
||||
st->size = z->end - z->data;
|
||||
|
||||
return sizeof(*st);
|
||||
}
|
||||
|
||||
case ZIP_SOURCE_ERROR:
|
||||
{
|
||||
int *e;
|
||||
|
||||
if (len < sizeof(int)*2)
|
||||
return -1;
|
||||
|
||||
e = (int *)data;
|
||||
e[0] = e[1] = 0;
|
||||
}
|
||||
return sizeof(int)*2;
|
||||
|
||||
case ZIP_SOURCE_FREE:
|
||||
if (z->freep) {
|
||||
free((void *)z->data);
|
||||
z->data = NULL;
|
||||
}
|
||||
free(z);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
zip_source_file.c -- create data source from file
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_source *
|
||||
zip_source_file(struct zip *za, const char *fname, off_t start, off_t len)
|
||||
{
|
||||
if (za == NULL)
|
||||
return NULL;
|
||||
|
||||
if (fname == NULL || start < 0 || len < -1) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _zip_source_file_or_p(za, fname, NULL, start, len);
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
zip_source_filep.c -- create data source from FILE *
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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/stat.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
struct read_file {
|
||||
char *fname; /* name of file to copy from */
|
||||
FILE *f; /* file to copy from */
|
||||
off_t off; /* start offset of */
|
||||
off_t len; /* lengt of data to copy */
|
||||
off_t remain; /* bytes remaining to be copied */
|
||||
int e[2]; /* error codes */
|
||||
};
|
||||
|
||||
static ssize_t read_file(void *state, void *data, size_t len,
|
||||
enum zip_source_cmd cmd);
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_source *
|
||||
zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len)
|
||||
{
|
||||
if (za == NULL)
|
||||
return NULL;
|
||||
|
||||
if (file == NULL || start < 0 || len < -1) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _zip_source_file_or_p(za, NULL, file, start, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct zip_source *
|
||||
_zip_source_file_or_p(struct zip *za, const char *fname, FILE *file,
|
||||
off_t start, off_t len)
|
||||
{
|
||||
struct read_file *f;
|
||||
struct zip_source *zs;
|
||||
|
||||
if (file == NULL && fname == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((f=(struct read_file *)malloc(sizeof(struct read_file))) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f->fname = NULL;
|
||||
if (fname) {
|
||||
if ((f->fname=strdup(fname)) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
free(f);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
f->f = file;
|
||||
f->off = start;
|
||||
f->len = (len ? len : -1);
|
||||
|
||||
if ((zs=zip_source_function(za, read_file, f)) == NULL) {
|
||||
free(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return zs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ssize_t
|
||||
read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd)
|
||||
{
|
||||
struct read_file *z;
|
||||
char *buf;
|
||||
int i, n;
|
||||
|
||||
z = (struct read_file *)state;
|
||||
buf = (char *)data;
|
||||
|
||||
switch (cmd) {
|
||||
case ZIP_SOURCE_OPEN:
|
||||
if (z->fname) {
|
||||
if ((z->f=fopen(z->fname, "rb")) == NULL) {
|
||||
z->e[0] = ZIP_ER_OPEN;
|
||||
z->e[1] = errno;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (fseeko(z->f, z->off, SEEK_SET) < 0) {
|
||||
z->e[0] = ZIP_ER_SEEK;
|
||||
z->e[1] = errno;
|
||||
return -1;
|
||||
}
|
||||
z->remain = z->len;
|
||||
return 0;
|
||||
|
||||
case ZIP_SOURCE_READ:
|
||||
if (z->remain != -1)
|
||||
n = len > z->remain ? z->remain : len;
|
||||
else
|
||||
n = len;
|
||||
|
||||
if ((i=fread(buf, 1, n, z->f)) < 0) {
|
||||
z->e[0] = ZIP_ER_READ;
|
||||
z->e[1] = errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (z->remain != -1)
|
||||
z->remain -= i;
|
||||
|
||||
return i;
|
||||
|
||||
case ZIP_SOURCE_CLOSE:
|
||||
if (z->fname) {
|
||||
fclose(z->f);
|
||||
z->f = NULL;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case ZIP_SOURCE_STAT:
|
||||
{
|
||||
struct zip_stat *st;
|
||||
struct stat fst;
|
||||
int err;
|
||||
|
||||
if (len < sizeof(*st))
|
||||
return -1;
|
||||
|
||||
if (z->f)
|
||||
err = fstat(fileno(z->f), &fst);
|
||||
else
|
||||
err = stat(z->fname, &fst);
|
||||
|
||||
if (err != 0) {
|
||||
z->e[0] = ZIP_ER_READ; /* best match */
|
||||
z->e[1] = errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
st = (struct zip_stat *)data;
|
||||
|
||||
zip_stat_init(st);
|
||||
st->mtime = fst.st_mtime;
|
||||
if (z->len != -1)
|
||||
st->size = z->len;
|
||||
else if ((fst.st_mode&S_IFMT) == S_IFREG)
|
||||
st->size = fst.st_size;
|
||||
|
||||
return sizeof(*st);
|
||||
}
|
||||
|
||||
case ZIP_SOURCE_ERROR:
|
||||
if (len < sizeof(int)*2)
|
||||
return -1;
|
||||
|
||||
memcpy(data, z->e, sizeof(int)*2);
|
||||
return sizeof(int)*2;
|
||||
|
||||
case ZIP_SOURCE_FREE:
|
||||
free(z->fname);
|
||||
if (z->f)
|
||||
fclose(z->f);
|
||||
free(z);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
zip_source_free.c -- free zip data source
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN void
|
||||
zip_source_free(struct zip_source *source)
|
||||
{
|
||||
if (source == NULL)
|
||||
return;
|
||||
|
||||
(void)source->f(source->ud, NULL, 0, ZIP_SOURCE_FREE);
|
||||
|
||||
free(source);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
zip_source_function.c -- create zip data source from callback function
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_source *
|
||||
zip_source_function(struct zip *za, zip_source_callback zcb, void *ud)
|
||||
{
|
||||
struct zip_source *zs;
|
||||
|
||||
if (za == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((zs=(struct zip_source *)malloc(sizeof(*zs))) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zs->f = zcb;
|
||||
zs->ud = ud;
|
||||
|
||||
return zs;
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
zip_source_zip.c -- create data source from zip file
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
struct read_zip {
|
||||
struct zip_file *zf;
|
||||
struct zip_stat st;
|
||||
off_t off, len;
|
||||
};
|
||||
|
||||
static ssize_t read_zip(void *st, void *data, size_t len,
|
||||
enum zip_source_cmd cmd);
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN struct zip_source *
|
||||
zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags,
|
||||
off_t start, off_t len)
|
||||
{
|
||||
struct zip_error error;
|
||||
struct zip_source *zs;
|
||||
struct read_zip *p;
|
||||
|
||||
/* XXX: ZIP_FL_RECOMPRESS */
|
||||
|
||||
if (za == NULL)
|
||||
return NULL;
|
||||
|
||||
if (srcza == NULL || start < 0 || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((flags & ZIP_FL_UNCHANGED) == 0
|
||||
&& ZIP_ENTRY_DATA_CHANGED(srcza->entry+srcidx)) {
|
||||
_zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (len == 0)
|
||||
len = -1;
|
||||
|
||||
if (start == 0 && len == -1 && (flags & ZIP_FL_RECOMPRESS) == 0)
|
||||
flags |= ZIP_FL_COMPRESSED;
|
||||
else
|
||||
flags &= ~ZIP_FL_COMPRESSED;
|
||||
|
||||
if ((p=(struct read_zip *)malloc(sizeof(*p))) == NULL) {
|
||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_zip_error_copy(&error, &srcza->error);
|
||||
|
||||
if (zip_stat_index(srcza, srcidx, flags, &p->st) < 0
|
||||
|| (p->zf=zip_fopen_index(srcza, srcidx, flags)) == NULL) {
|
||||
free(p);
|
||||
_zip_error_copy(&za->error, &srcza->error);
|
||||
_zip_error_copy(&srcza->error, &error);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
p->off = start;
|
||||
p->len = len;
|
||||
|
||||
if ((flags & ZIP_FL_COMPRESSED) == 0) {
|
||||
p->st.size = p->st.comp_size = len;
|
||||
p->st.comp_method = ZIP_CM_STORE;
|
||||
p->st.crc = 0;
|
||||
}
|
||||
|
||||
if ((zs=zip_source_function(za, read_zip, p)) == NULL) {
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return zs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ssize_t
|
||||
read_zip(void *state, void *data, size_t len, enum zip_source_cmd cmd)
|
||||
{
|
||||
struct read_zip *z;
|
||||
char b[8192], *buf;
|
||||
int i, n;
|
||||
|
||||
z = (struct read_zip *)state;
|
||||
buf = (char *)data;
|
||||
|
||||
switch (cmd) {
|
||||
case ZIP_SOURCE_OPEN:
|
||||
for (n=0; n<z->off; n+= i) {
|
||||
i = (z->off-n > sizeof(b) ? sizeof(b) : z->off-n);
|
||||
if ((i=zip_fread(z->zf, b, i)) < 0) {
|
||||
zip_fclose(z->zf);
|
||||
z->zf = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
case ZIP_SOURCE_READ:
|
||||
if (z->len != -1)
|
||||
n = len > z->len ? z->len : len;
|
||||
else
|
||||
n = len;
|
||||
|
||||
|
||||
if ((i=zip_fread(z->zf, buf, n)) < 0)
|
||||
return -1;
|
||||
|
||||
if (z->len != -1)
|
||||
z->len -= i;
|
||||
|
||||
return i;
|
||||
|
||||
case ZIP_SOURCE_CLOSE:
|
||||
return 0;
|
||||
|
||||
case ZIP_SOURCE_STAT:
|
||||
if (len < sizeof(z->st))
|
||||
return -1;
|
||||
len = sizeof(z->st);
|
||||
|
||||
memcpy(data, &z->st, len);
|
||||
return len;
|
||||
|
||||
case ZIP_SOURCE_ERROR:
|
||||
{
|
||||
int *e;
|
||||
|
||||
if (len < sizeof(int)*2)
|
||||
return -1;
|
||||
|
||||
e = (int *)data;
|
||||
zip_file_error_get(z->zf, e, e+1);
|
||||
}
|
||||
return sizeof(int)*2;
|
||||
|
||||
case ZIP_SOURCE_FREE:
|
||||
zip_fclose(z->zf);
|
||||
free(z);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
zip_stat.c -- get information about file by name
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_stat(struct zip *za, const char *fname, int flags, struct zip_stat *st)
|
||||
{
|
||||
int idx;
|
||||
|
||||
if ((idx=zip_name_locate(za, fname, flags)) < 0)
|
||||
return -1;
|
||||
|
||||
return zip_stat_index(za, idx, flags, st);
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
zip_stat_index.c -- get information about file by index
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (index < 0 || index >= za->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((name=zip_get_name(za, index, flags)) == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
if ((flags & ZIP_FL_UNCHANGED) == 0
|
||||
&& ZIP_ENTRY_DATA_CHANGED(za->entry+index)) {
|
||||
if (za->entry[index].source->f(za->entry[index].source->ud,
|
||||
st, sizeof(*st), ZIP_SOURCE_STAT) < 0) {
|
||||
_zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (za->cdir == NULL || index >= za->cdir->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
st->crc = za->cdir->entry[index].crc;
|
||||
st->size = za->cdir->entry[index].uncomp_size;
|
||||
st->mtime = za->cdir->entry[index].last_mod;
|
||||
st->comp_size = za->cdir->entry[index].comp_size;
|
||||
st->comp_method = za->cdir->entry[index].comp_method;
|
||||
if (za->cdir->entry[index].bitflags & ZIP_GPBF_ENCRYPTED) {
|
||||
if (za->cdir->entry[index].bitflags & ZIP_GPBF_STRONG_ENCRYPTION) {
|
||||
/* XXX */
|
||||
st->encryption_method = ZIP_EM_UNKNOWN;
|
||||
}
|
||||
else
|
||||
st->encryption_method = ZIP_EM_TRAD_PKWARE;
|
||||
}
|
||||
else
|
||||
st->encryption_method = ZIP_EM_NONE;
|
||||
/* st->bitflags = za->cdir->entry[index].bitflags; */
|
||||
}
|
||||
|
||||
st->index = index;
|
||||
st->name = name;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
zip_stat_init.c -- initialize struct zip_stat.
|
||||
Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN void
|
||||
zip_stat_init(struct zip_stat *st)
|
||||
{
|
||||
st->name = NULL;
|
||||
st->index = -1;
|
||||
st->crc = 0;
|
||||
st->mtime = (time_t)-1;
|
||||
st->size = -1;
|
||||
st->comp_size = -1;
|
||||
st->comp_method = ZIP_CM_STORE;
|
||||
st->encryption_method = ZIP_EM_NONE;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
zip_sterror.c -- get string representation of zip error
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN const char *
|
||||
zip_strerror(struct zip *za)
|
||||
{
|
||||
return _zip_error_strerror(&za->error);
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
zip_unchange.c -- undo changes to file in zip archive
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_unchange(struct zip *za, int idx)
|
||||
{
|
||||
return _zip_unchange(za, idx, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
_zip_unchange(struct zip *za, int idx, int allow_duplicates)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (idx < 0 || idx >= za->nentry) {
|
||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (za->entry[idx].ch_filename) {
|
||||
if (!allow_duplicates) {
|
||||
i = _zip_name_locate(za,
|
||||
_zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL),
|
||||
0, NULL);
|
||||
if (i != -1 && i != idx) {
|
||||
_zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
free(za->entry[idx].ch_filename);
|
||||
za->entry[idx].ch_filename = NULL;
|
||||
}
|
||||
|
||||
free(za->entry[idx].ch_comment);
|
||||
za->entry[idx].ch_comment = NULL;
|
||||
za->entry[idx].ch_comment_len = -1;
|
||||
|
||||
_zip_unchange_data(za->entry+idx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
zip_unchange.c -- undo changes to all files in zip archive
|
||||
Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_unchange_all(struct zip *za)
|
||||
{
|
||||
int ret, i;
|
||||
|
||||
ret = 0;
|
||||
for (i=0; i<za->nentry; i++)
|
||||
ret |= _zip_unchange(za, i, 1);
|
||||
|
||||
ret |= zip_unchange_archive(za);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
zip_unchange_archive.c -- undo global changes to ZIP archive
|
||||
Copyright (C) 2006-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
|
||||
|
||||
ZIP_EXTERN int
|
||||
zip_unchange_archive(struct zip *za)
|
||||
{
|
||||
free(za->ch_comment);
|
||||
za->ch_comment = NULL;
|
||||
za->ch_comment_len = -1;
|
||||
|
||||
za->ch_flags = za->flags;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
$NiH: zip_unchange_data.c,v 1.14 2004/11/30 23:02:47 wiz Exp $
|
||||
|
||||
zip_unchange_data.c -- undo helper function
|
||||
Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <stdlib.h>
|
||||
|
||||
#include "zipint.h"
|
||||
|
||||
void
|
||||
_zip_unchange_data(struct zip_entry *ze)
|
||||
{
|
||||
if (ze->source) {
|
||||
(void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE);
|
||||
free(ze->source);
|
||||
ze->source = NULL;
|
||||
}
|
||||
|
||||
ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED;
|
||||
}
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
#ifndef _HAD_ZIPINT_H
|
||||
#define _HAD_ZIPINT_H
|
||||
|
||||
/*
|
||||
zipint.h -- internal declarations.
|
||||
Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
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. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 <zlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define ZIP_EXTERN __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#include "zip.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifndef HAVE_MKSTEMP
|
||||
int _zip_mkstemp(char *);
|
||||
#define mkstemp _zip_mkstemp
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MOVEFILEEXA
|
||||
#include <windows.h>
|
||||
#define _zip_rename(s, t) \
|
||||
(!MoveFileExA((s), (t), \
|
||||
MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING))
|
||||
#else
|
||||
#define _zip_rename rename
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FSEEKO
|
||||
#define fseeko(s, o, w) (fseek((s), (long int)(o), (w)))
|
||||
#endif
|
||||
#ifndef HAVE_FTELLO
|
||||
#define ftello(s) ((long)ftell((s)))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define CENTRAL_MAGIC "PK\1\2"
|
||||
#define LOCAL_MAGIC "PK\3\4"
|
||||
#define EOCD_MAGIC "PK\5\6"
|
||||
#define DATADES_MAGIC "PK\7\8"
|
||||
#define TORRENT_SIG "TORRENTZIPPED-"
|
||||
#define TORRENT_SIG_LEN 14
|
||||
#define TORRENT_CRC_LEN 8
|
||||
#define TORRENT_MEM_LEVEL 8
|
||||
#define CDENTRYSIZE 46u
|
||||
#define LENTRYSIZE 30
|
||||
#define MAXCOMLEN 65536
|
||||
#define EOCDLEN 22
|
||||
#define CDBUFSIZE (MAXCOMLEN+EOCDLEN)
|
||||
#define BUFSIZE 8192
|
||||
|
||||
|
||||
|
||||
/* state of change of a file in zip archive */
|
||||
|
||||
enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED,
|
||||
ZIP_ST_ADDED, ZIP_ST_RENAMED };
|
||||
|
||||
/* constants for struct zip_file's member flags */
|
||||
|
||||
#define ZIP_ZF_EOF 1 /* EOF reached */
|
||||
#define ZIP_ZF_DECOMP 2 /* decompress data */
|
||||
#define ZIP_ZF_CRC 4 /* compute and compare CRC */
|
||||
|
||||
/* directory entry: general purpose bit flags */
|
||||
|
||||
#define ZIP_GPBF_ENCRYPTED 0x0001 /* is encrypted */
|
||||
#define ZIP_GPBF_DATA_DESCRIPTOR 0x0008 /* crc/size after file data */
|
||||
#define ZIP_GPBF_STRONG_ENCRYPTION 0x0040 /* uses strong encryption */
|
||||
|
||||
/* error information */
|
||||
|
||||
struct zip_error {
|
||||
int zip_err; /* libzip error code (ZIP_ER_*) */
|
||||
int sys_err; /* copy of errno (E*) or zlib error code */
|
||||
char *str; /* string representation or NULL */
|
||||
};
|
||||
|
||||
/* zip archive, part of API */
|
||||
|
||||
struct zip {
|
||||
char *zn; /* file name */
|
||||
FILE *zp; /* file */
|
||||
struct zip_error error; /* error information */
|
||||
|
||||
unsigned int flags; /* archive global flags */
|
||||
unsigned int ch_flags; /* changed archive global flags */
|
||||
|
||||
struct zip_cdir *cdir; /* central directory */
|
||||
char *ch_comment; /* changed archive comment */
|
||||
int ch_comment_len; /* length of changed zip archive
|
||||
* comment, -1 if unchanged */
|
||||
int nentry; /* number of entries */
|
||||
int nentry_alloc; /* number of entries allocated */
|
||||
struct zip_entry *entry; /* entries */
|
||||
int nfile; /* number of opened files within archive */
|
||||
int nfile_alloc; /* number of files allocated */
|
||||
struct zip_file **file; /* opened files within archive */
|
||||
};
|
||||
|
||||
/* file in zip archive, part of API */
|
||||
|
||||
struct zip_file {
|
||||
struct zip *za; /* zip archive containing this file */
|
||||
struct zip_error error; /* error information */
|
||||
int flags; /* -1: eof, >0: error */
|
||||
|
||||
int method; /* compression method */
|
||||
off_t fpos; /* position within zip file (fread/fwrite) */
|
||||
unsigned long bytes_left; /* number of bytes left to read */
|
||||
unsigned long cbytes_left; /* number of bytes of compressed data left */
|
||||
|
||||
unsigned long crc; /* CRC so far */
|
||||
unsigned long crc_orig; /* CRC recorded in archive */
|
||||
|
||||
char *buffer;
|
||||
z_stream *zstr;
|
||||
};
|
||||
|
||||
/* zip archive directory entry (central or local) */
|
||||
|
||||
struct zip_dirent {
|
||||
unsigned short version_madeby; /* (c) version of creator */
|
||||
unsigned short version_needed; /* (cl) version needed to extract */
|
||||
unsigned short bitflags; /* (cl) general purpose bit flag */
|
||||
unsigned short comp_method; /* (cl) compression method used */
|
||||
time_t last_mod; /* (cl) time of last modification */
|
||||
unsigned int crc; /* (cl) CRC-32 of uncompressed data */
|
||||
unsigned int comp_size; /* (cl) size of commpressed data */
|
||||
unsigned int uncomp_size; /* (cl) size of uncommpressed data */
|
||||
char *filename; /* (cl) file name (NUL-terminated) */
|
||||
unsigned short filename_len; /* (cl) length of filename (w/o NUL) */
|
||||
char *extrafield; /* (cl) extra field */
|
||||
unsigned short extrafield_len; /* (cl) length of extra field */
|
||||
char *comment; /* (c) file comment */
|
||||
unsigned short comment_len; /* (c) length of file comment */
|
||||
unsigned short disk_number; /* (c) disk number start */
|
||||
unsigned short int_attrib; /* (c) internal file attributes */
|
||||
unsigned int ext_attrib; /* (c) external file attributes */
|
||||
unsigned int offset; /* (c) offset of local header */
|
||||
};
|
||||
|
||||
/* zip archive central directory */
|
||||
|
||||
struct zip_cdir {
|
||||
struct zip_dirent *entry; /* directory entries */
|
||||
int nentry; /* number of entries */
|
||||
|
||||
unsigned int size; /* size of central direcotry */
|
||||
unsigned int offset; /* offset of central directory in file */
|
||||
char *comment; /* zip archive comment */
|
||||
unsigned short comment_len; /* length of zip archive comment */
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct zip_source {
|
||||
zip_source_callback f;
|
||||
void *ud;
|
||||
};
|
||||
|
||||
/* entry in zip archive directory */
|
||||
|
||||
struct zip_entry {
|
||||
enum zip_state state;
|
||||
struct zip_source *source;
|
||||
char *ch_filename;
|
||||
char *ch_comment;
|
||||
int ch_comment_len;
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern const char * const _zip_err_str[];
|
||||
extern const int _zip_nerr_str;
|
||||
extern const int _zip_err_type[];
|
||||
|
||||
|
||||
|
||||
#define ZIP_ENTRY_DATA_CHANGED(x) \
|
||||
((x)->state == ZIP_ST_REPLACED \
|
||||
|| (x)->state == ZIP_ST_ADDED)
|
||||
|
||||
|
||||
|
||||
int _zip_cdir_compute_crc(struct zip *, uLong *);
|
||||
void _zip_cdir_free(struct zip_cdir *);
|
||||
int _zip_cdir_grow(struct zip_cdir *, int, struct zip_error *);
|
||||
struct zip_cdir *_zip_cdir_new(int, struct zip_error *);
|
||||
int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *);
|
||||
|
||||
void _zip_dirent_finalize(struct zip_dirent *);
|
||||
void _zip_dirent_init(struct zip_dirent *);
|
||||
int _zip_dirent_read(struct zip_dirent *, FILE *, unsigned char **,
|
||||
unsigned int *, int, struct zip_error *);
|
||||
void _zip_dirent_torrent_normalize(struct zip_dirent *);
|
||||
int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *);
|
||||
|
||||
void _zip_entry_free(struct zip_entry *);
|
||||
void _zip_entry_init(struct zip *, int);
|
||||
struct zip_entry *_zip_entry_new(struct zip *);
|
||||
|
||||
void _zip_error_clear(struct zip_error *);
|
||||
void _zip_error_copy(struct zip_error *, struct zip_error *);
|
||||
void _zip_error_fini(struct zip_error *);
|
||||
void _zip_error_get(struct zip_error *, int *, int *);
|
||||
void _zip_error_init(struct zip_error *);
|
||||
void _zip_error_set(struct zip_error *, int, int);
|
||||
const char *_zip_error_strerror(struct zip_error *);
|
||||
|
||||
int _zip_file_fillbuf(void *, size_t, struct zip_file *);
|
||||
unsigned int _zip_file_get_offset(struct zip *, int);
|
||||
|
||||
int _zip_filerange_crc(FILE *, off_t, off_t, uLong *, struct zip_error *);
|
||||
|
||||
struct zip_source *_zip_source_file_or_p(struct zip *, const char *, FILE *,
|
||||
off_t, off_t);
|
||||
|
||||
void _zip_free(struct zip *);
|
||||
const char *_zip_get_name(struct zip *, int, int, struct zip_error *);
|
||||
int _zip_local_header_read(struct zip *, int);
|
||||
void *_zip_memdup(const void *, size_t, struct zip_error *);
|
||||
int _zip_name_locate(struct zip *, const char *, int, struct zip_error *);
|
||||
struct zip *_zip_new(struct zip_error *);
|
||||
unsigned short _zip_read2(unsigned char **);
|
||||
unsigned int _zip_read4(unsigned char **);
|
||||
int _zip_replace(struct zip *, int, const char *, struct zip_source *);
|
||||
int _zip_set_name(struct zip *, int, const char *);
|
||||
int _zip_unchange(struct zip *, int, int);
|
||||
void _zip_unchange_data(struct zip_entry *);
|
||||
|
||||
#endif /* zipint.h */
|
||||
@@ -1,7 +0,0 @@
|
||||
zipcmp=${pc_top_builddir}/${pcfiledir}/src/zipcmp
|
||||
|
||||
Name: libzip uninstalled
|
||||
Description: library for handling zip archvies, uninstalled
|
||||
Version: @VERSION@
|
||||
Libs: ${pc_top_builddir}/${pcfiledir}/lib/libzip.la @LIBS@
|
||||
Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@/lib
|
||||
@@ -1,13 +0,0 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
zipcmp=@prefix@/bin/zipcmp
|
||||
|
||||
Name: libzip
|
||||
Description: library for handling zip archives
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lzip @LIBS@
|
||||
Cflags: -I${includedir}
|
||||
|
||||
8406
dep/libzip/ltmain.sh
8406
dep/libzip/ltmain.sh
File diff suppressed because it is too large
Load Diff
7357
dep/libzip/m4/libtool.m4
vendored
7357
dep/libzip/m4/libtool.m4
vendored
File diff suppressed because it is too large
Load Diff
368
dep/libzip/m4/ltoptions.m4
vendored
368
dep/libzip/m4/ltoptions.m4
vendored
@@ -1,368 +0,0 @@
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [0], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[pic_mode="$withval"],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
||||
123
dep/libzip/m4/ltsugar.m4
vendored
123
dep/libzip/m4/ltsugar.m4
vendored
@@ -1,123 +0,0 @@
|
||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
||||
23
dep/libzip/m4/ltversion.m4
vendored
23
dep/libzip/m4/ltversion.m4
vendored
@@ -1,23 +0,0 @@
|
||||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 3017 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6b])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3017])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.6b'
|
||||
macro_revision='1.3017'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
92
dep/libzip/m4/lt~obsolete.m4
vendored
92
dep/libzip/m4/lt~obsolete.m4
vendored
@@ -1,92 +0,0 @@
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
@@ -1,97 +0,0 @@
|
||||
SET(MDOC3_PAGES
|
||||
libzip.mdoc
|
||||
zip_add.mdoc
|
||||
zip_add_dir.mdoc
|
||||
zip_close.mdoc
|
||||
zip_delete.mdoc
|
||||
zip_error_clear.mdoc
|
||||
zip_error_get.mdoc
|
||||
zip_error_get_sys_type.mdoc
|
||||
zip_error_to_str.mdoc
|
||||
zip_errors.mdoc
|
||||
zip_fclose.mdoc
|
||||
zip_file_strerror.mdoc
|
||||
zip_fopen.mdoc
|
||||
zip_fread.mdoc
|
||||
zip_get_archive_comment.mdoc
|
||||
zip_get_file_comment.mdoc
|
||||
zip_get_name.mdoc
|
||||
zip_get_num_files.mdoc
|
||||
zip_name_locate.mdoc
|
||||
zip_open.mdoc
|
||||
zip_rename.mdoc
|
||||
zip_set_archive_comment.mdoc
|
||||
zip_set_file_comment.mdoc
|
||||
zip_source_buffer.mdoc
|
||||
zip_source_file.mdoc
|
||||
zip_source_filep.mdoc
|
||||
zip_source_free.mdoc
|
||||
zip_source_function.mdoc
|
||||
zip_source_zip.mdoc
|
||||
zip_stat.mdoc
|
||||
zip_stat_init.mdoc
|
||||
zip_unchange.mdoc
|
||||
zip_unchange_all.mdoc
|
||||
zip_unchange_archive.mdoc
|
||||
)
|
||||
SET(MDOC1_PAGES
|
||||
zipcmp.mdoc
|
||||
zipmerge.mdoc
|
||||
)
|
||||
SET(MDOC_PAGES ${MDOC1_PAGES} ${MDOC3_PAGES})
|
||||
STRING(REGEX REPLACE .mdoc "" MAN1_PAGES "${MDOC1_PAGES}")
|
||||
STRING(REGEX REPLACE .mdoc "" MAN3_PAGES "${MDOC3_PAGES}")
|
||||
SET(MAN_PAGES ${MAN1_PAGES} ${MAN3_PAGES})
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
SET(MANFMT mdoc)
|
||||
ELSE(CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
SET(MANFMT man)
|
||||
ENDif(CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
|
||||
# installation
|
||||
|
||||
SET(MAN_PATH man)
|
||||
|
||||
FOREACH(MAN_PAGE ${MAN1_PAGES})
|
||||
INSTALL(FILES ${MAN_PAGE}.${MANFMT} DESTINATION ${MAN_PATH}/man1
|
||||
RENAME ${MAN_PAGE}.1)
|
||||
ENDFOREACH(MAN_PAGE ${PROGRAMS})
|
||||
FOREACH(MAN_PAGE ${MAN3_PAGES})
|
||||
INSTALL(FILES ${MAN_PAGE}.${MANFMT} DESTINATION ${MAN_PATH}/man3
|
||||
RENAME ${MAN_PAGE}.3)
|
||||
ENDFOREACH(MAN_PAGE ${PROGRAMS})
|
||||
|
||||
# custom targets
|
||||
|
||||
FOREACH(MAN ${MAN_PAGES})
|
||||
ADD_CUSTOM_TARGET(${MAN}.man
|
||||
DEPENDS ${MAN}.mdoc
|
||||
COMMAND mdoc2man ${CMAKE_CURRENT_SOURCE_DIR}/${MAN}.mdoc > ${MAN}.new
|
||||
COMMAND diff -I NiH ${MAN}.new ${CMAKE_CURRENT_SOURCE_DIR}/${MAN}.man || mv ${MAN}.new ${CMAKE_CURRENT_SOURCE_DIR}/${MAN}.man
|
||||
COMMAND rm -f ${MAN}.new
|
||||
COMMENT Updating man page ${MAN}.man
|
||||
)
|
||||
ADD_CUSTOM_TARGET(${MAN}.html
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${MAN}.mdoc
|
||||
COMMAND nroff -mdoc2html ${CMAKE_CURRENT_SOURCE_DIR}/${MAN}.mdoc | sed -e "s,../html[0-9]/,," > ${MAN}.html
|
||||
COMMENT Updating HTML page ${MAN}.html
|
||||
)
|
||||
ENDFOREACH(MAN)
|
||||
|
||||
STRING(REGEX REPLACE .mdoc .man MANDEPEND "${MDOC_PAGES}")
|
||||
ADD_CUSTOM_TARGET(update-man
|
||||
DEPENDS ${MANDEPEND})
|
||||
|
||||
STRING(REGEX REPLACE .mdoc .html HTMLDEPEND "${MDOC_PAGES}")
|
||||
ADD_CUSTOM_TARGET(update-html
|
||||
DEPENDS ${HTMLDEPEND})
|
||||
|
||||
# XXX: strange error:
|
||||
#[ 94%] zipcmp.html
|
||||
#[ 97%] Built target zipcmp.html
|
||||
#[ 97%] zipmerge.html
|
||||
#[100%] Built target zipmerge.html
|
||||
#make: don't know how to make zipcmp.html. Stop
|
||||
|
||||
# XXX: why are all the man pages rebuilt on a second 'make update-html'?
|
||||
@@ -1,101 +0,0 @@
|
||||
MANFMT=@MANFMT@
|
||||
man1_MANS=${MAN1:.mdoc=.${MANFMT}}
|
||||
man3_MANS=${MAN3:.mdoc=.${MANFMT}}
|
||||
|
||||
DISTCLEANFILES=${HTML}
|
||||
EXTRA_DIST=${MANDOC} ${MAN} CMakeLists.txt
|
||||
|
||||
MAN1= zipcmp.mdoc zipmerge.mdoc ziptorrent.mdoc
|
||||
MAN3= libzip.mdoc \
|
||||
zip_add.mdoc \
|
||||
zip_add_dir.mdoc \
|
||||
zip_close.mdoc \
|
||||
zip_delete.mdoc \
|
||||
zip_error_clear.mdoc \
|
||||
zip_error_get.mdoc \
|
||||
zip_error_get_sys_type.mdoc \
|
||||
zip_error_to_str.mdoc \
|
||||
zip_errors.mdoc \
|
||||
zip_fclose.mdoc \
|
||||
zip_file_strerror.mdoc \
|
||||
zip_fopen.mdoc \
|
||||
zip_fread.mdoc \
|
||||
zip_get_archive_comment.mdoc \
|
||||
zip_get_archive_flag.mdoc \
|
||||
zip_get_file_comment.mdoc \
|
||||
zip_get_name.mdoc \
|
||||
zip_get_num_files.mdoc \
|
||||
zip_name_locate.mdoc \
|
||||
zip_open.mdoc \
|
||||
zip_rename.mdoc \
|
||||
zip_set_archive_comment.mdoc \
|
||||
zip_set_archive_flag.mdoc \
|
||||
zip_set_file_comment.mdoc \
|
||||
zip_source_buffer.mdoc \
|
||||
zip_source_file.mdoc \
|
||||
zip_source_filep.mdoc \
|
||||
zip_source_free.mdoc \
|
||||
zip_source_function.mdoc \
|
||||
zip_source_zip.mdoc \
|
||||
zip_stat.mdoc \
|
||||
zip_stat_init.mdoc \
|
||||
zip_unchange.mdoc \
|
||||
zip_unchange_all.mdoc \
|
||||
zip_unchange_archive.mdoc
|
||||
|
||||
install-data-hook: link-man3
|
||||
|
||||
LN=ln
|
||||
|
||||
link-man3: install-man3 uninstall-hook
|
||||
${LN} ${DESTDIR}${man3dir}/zip_error_clear.3 \
|
||||
${DESTDIR}${man3dir}/zip_file_error_clear.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_error_get.3 \
|
||||
${DESTDIR}${man3dir}/zip_file_error_get.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_fopen.3 \
|
||||
${DESTDIR}${man3dir}/zip_fopen_index.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_add.3 \
|
||||
${DESTDIR}${man3dir}/zip_replace.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_stat.3 \
|
||||
${DESTDIR}${man3dir}/zip_stat_index.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_file_strerror.3 \
|
||||
${DESTDIR}${man3dir}/zip_strerror.3
|
||||
|
||||
uninstall-hook:
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_file_error_clear.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_file_error_get.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_fopen_index.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_replace.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_stat_index.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_strerror.3
|
||||
|
||||
link-html: ${HTML}
|
||||
-rm -f zip_file_error_get.html zip_fopen_index.html \
|
||||
zip_replace.html zip_stat_index.html \
|
||||
zip_strerror.html
|
||||
${LN} zip_error_get.html zip_file_error_get.html
|
||||
${LN} zip_fopen.html zip_fopen_index.html
|
||||
${LN} zip_add.html zip_replace.html
|
||||
${LN} zip_stat.html zip_stat_index.html
|
||||
${LN} zip_file_strerror.html zip_strerror.html
|
||||
|
||||
MANDOC=${MAN1} ${MAN3}
|
||||
HTML=${MANDOC:.mdoc=.html}
|
||||
MAN=${MANDOC:.mdoc=.man}
|
||||
|
||||
MDOC2MAN=mdoc2man
|
||||
SUFFIXES=.man .mdoc .html
|
||||
|
||||
.PHONY: mkman update-errors
|
||||
|
||||
mkman: ${MAN}
|
||||
mkhtml: ${HTML} link-html
|
||||
|
||||
update-errors:
|
||||
sh $(srcdir)/make_zip_errors.sh $(srcdir)/../lib/zip.h zip_errors.mdoc
|
||||
|
||||
.mdoc.man:
|
||||
${MDOC2MAN} $< > $@.$$$$ && mv $@.$$$$ $@
|
||||
|
||||
.mdoc.html:
|
||||
nroff -mdoc2html $< | sed -e "s,../html[0-9]/,," > $@.$$$$ && mv $@.$$$$ $@
|
||||
@@ -1,565 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = man
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)"
|
||||
man3dir = $(mandir)/man3
|
||||
NROFF = nroff
|
||||
MANS = $(man1_MANS) $(man3_MANS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANFMT = @MANFMT@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
man1_MANS = ${MAN1:.mdoc=.${MANFMT}}
|
||||
man3_MANS = ${MAN3:.mdoc=.${MANFMT}}
|
||||
DISTCLEANFILES = ${HTML}
|
||||
EXTRA_DIST = ${MANDOC} ${MAN} CMakeLists.txt
|
||||
MAN1 = zipcmp.mdoc zipmerge.mdoc ziptorrent.mdoc
|
||||
MAN3 = libzip.mdoc \
|
||||
zip_add.mdoc \
|
||||
zip_add_dir.mdoc \
|
||||
zip_close.mdoc \
|
||||
zip_delete.mdoc \
|
||||
zip_error_clear.mdoc \
|
||||
zip_error_get.mdoc \
|
||||
zip_error_get_sys_type.mdoc \
|
||||
zip_error_to_str.mdoc \
|
||||
zip_errors.mdoc \
|
||||
zip_fclose.mdoc \
|
||||
zip_file_strerror.mdoc \
|
||||
zip_fopen.mdoc \
|
||||
zip_fread.mdoc \
|
||||
zip_get_archive_comment.mdoc \
|
||||
zip_get_archive_flag.mdoc \
|
||||
zip_get_file_comment.mdoc \
|
||||
zip_get_name.mdoc \
|
||||
zip_get_num_files.mdoc \
|
||||
zip_name_locate.mdoc \
|
||||
zip_open.mdoc \
|
||||
zip_rename.mdoc \
|
||||
zip_set_archive_comment.mdoc \
|
||||
zip_set_archive_flag.mdoc \
|
||||
zip_set_file_comment.mdoc \
|
||||
zip_source_buffer.mdoc \
|
||||
zip_source_file.mdoc \
|
||||
zip_source_filep.mdoc \
|
||||
zip_source_free.mdoc \
|
||||
zip_source_function.mdoc \
|
||||
zip_source_zip.mdoc \
|
||||
zip_stat.mdoc \
|
||||
zip_stat_init.mdoc \
|
||||
zip_unchange.mdoc \
|
||||
zip_unchange_all.mdoc \
|
||||
zip_unchange_archive.mdoc
|
||||
|
||||
LN = ln
|
||||
MANDOC = ${MAN1} ${MAN3}
|
||||
HTML = ${MANDOC:.mdoc=.html}
|
||||
MAN = ${MANDOC:.mdoc=.man}
|
||||
MDOC2MAN = mdoc2man
|
||||
SUFFIXES = .man .mdoc .html
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .man .mdoc .html
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign man/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-man1: $(man1_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
|
||||
@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
|
||||
{ for i in $$list; do echo "$$i"; done; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
test -z "$$files" || { \
|
||||
echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
|
||||
install-man3: $(man3_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
|
||||
@list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \
|
||||
{ for i in $$list; do echo "$$i"; done; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man3:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
test -z "$$files" || { \
|
||||
echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(man3dir)" && rm -f $$files; }
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(MANS)'; if test -n "$$list"; then \
|
||||
list=`for p in $$list; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
|
||||
if test -n "$$list" && \
|
||||
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
|
||||
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
|
||||
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
|
||||
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
|
||||
echo " typically \`make maintainer-clean' will remove them" >&2; \
|
||||
exit 1; \
|
||||
else :; fi; \
|
||||
else :; fi
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man1 install-man3
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-man
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
|
||||
uninstall-man: uninstall-man1 uninstall-man3
|
||||
|
||||
.MAKE: install-am install-data-am install-strip uninstall-am
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-data-hook install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-man1 install-man3 install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
|
||||
uninstall-hook uninstall-man uninstall-man1 uninstall-man3
|
||||
|
||||
|
||||
install-data-hook: link-man3
|
||||
|
||||
link-man3: install-man3 uninstall-hook
|
||||
${LN} ${DESTDIR}${man3dir}/zip_error_clear.3 \
|
||||
${DESTDIR}${man3dir}/zip_file_error_clear.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_error_get.3 \
|
||||
${DESTDIR}${man3dir}/zip_file_error_get.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_fopen.3 \
|
||||
${DESTDIR}${man3dir}/zip_fopen_index.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_add.3 \
|
||||
${DESTDIR}${man3dir}/zip_replace.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_stat.3 \
|
||||
${DESTDIR}${man3dir}/zip_stat_index.3
|
||||
${LN} ${DESTDIR}${man3dir}/zip_file_strerror.3 \
|
||||
${DESTDIR}${man3dir}/zip_strerror.3
|
||||
|
||||
uninstall-hook:
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_file_error_clear.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_file_error_get.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_fopen_index.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_replace.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_stat_index.3
|
||||
-rm -f ${DESTDIR}${man3dir}/zip_strerror.3
|
||||
|
||||
link-html: ${HTML}
|
||||
-rm -f zip_file_error_get.html zip_fopen_index.html \
|
||||
zip_replace.html zip_stat_index.html \
|
||||
zip_strerror.html
|
||||
${LN} zip_error_get.html zip_file_error_get.html
|
||||
${LN} zip_fopen.html zip_fopen_index.html
|
||||
${LN} zip_add.html zip_replace.html
|
||||
${LN} zip_stat.html zip_stat_index.html
|
||||
${LN} zip_file_strerror.html zip_strerror.html
|
||||
|
||||
.PHONY: mkman update-errors
|
||||
|
||||
mkman: ${MAN}
|
||||
mkhtml: ${HTML} link-html
|
||||
|
||||
update-errors:
|
||||
sh $(srcdir)/make_zip_errors.sh $(srcdir)/../lib/zip.h zip_errors.mdoc
|
||||
|
||||
.mdoc.man:
|
||||
${MDOC2MAN} $< > $@.$$$$ && mv $@.$$$$ $@
|
||||
|
||||
.mdoc.html:
|
||||
nroff -mdoc2html $< | sed -e "s,../html[0-9]/,," > $@.$$$$ && mv $@.$$$$ $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,106 +0,0 @@
|
||||
.\" Converted with mdoc2man 0.2
|
||||
.\" from NiH: libzip.mdoc,v 1.7 2006/04/23 12:50:32 wiz Exp
|
||||
.\" $NiH: libzip.mdoc,v 1.7 2006/04/23 12:50:32 wiz Exp $
|
||||
.\"
|
||||
.\" libzip.mdoc \-- general overview of available functions
|
||||
.\" Copyright (C) 2005, 2006 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.TH LIBZIP 3 "June 11, 2008" NiH
|
||||
.SH "NAME"
|
||||
libzip \- library for manipulating zip archives
|
||||
.SH "LIBRARY"
|
||||
libzip (-lzip)
|
||||
.SH "SYNOPSIS"
|
||||
#include <zip.h>
|
||||
.SH "DESCRIPTION"
|
||||
.B libzip
|
||||
is a library for reading, creating, and modifying zip archives.
|
||||
.PP
|
||||
Below there are two sections listing functions: one for how to read
|
||||
from zip archives and one for how to create/modify them.
|
||||
.SH "READING ZIP ARCHIVES"
|
||||
.SS "open archive"
|
||||
zip_open(3)
|
||||
.SS "find files"
|
||||
zip_name_locate(3)
|
||||
.SS "read files"
|
||||
zip_fopen(3)
|
||||
zip_fopen_index(3)
|
||||
zip_fread(3)
|
||||
zip_fclose(3)
|
||||
.SS "close archive"
|
||||
zip_close(3)
|
||||
.SS "miscellaneous"
|
||||
zip_stat(3)
|
||||
zip_get_archive_comment(3)
|
||||
zip_get_archive_flag(3)
|
||||
zip_get_file_comment(3)
|
||||
zip_get_name(3)
|
||||
zip_get_num_files(3)
|
||||
.SH "CREATING/MODIFYING ZIP ARCHIVES"
|
||||
.SS "create/open archive"
|
||||
zip_open(3)
|
||||
.SS "add/change files and directories"
|
||||
zip_add(3)
|
||||
zip_add_dir(3)
|
||||
zip_replace(3)
|
||||
zip_set_file_comment(3)
|
||||
zip_source_buffer(3)
|
||||
zip_source_file(3)
|
||||
zip_source_filep(3)
|
||||
zip_source_function(3)
|
||||
zip_source_zip(3)
|
||||
zip_source_free(3)
|
||||
.SS "rename files"
|
||||
zip_rename(3)
|
||||
.SS "delete files"
|
||||
zip_delete(3)
|
||||
.SS "revert changes"
|
||||
zip_unchange(3)
|
||||
zip_unchange_all(3)
|
||||
zip_unchange_archive(3)
|
||||
.SS "close archive"
|
||||
zip_close(3)
|
||||
.SS "miscellaneous"
|
||||
zip_set_archive_comment(3)
|
||||
zip_set_archive_flag(3)
|
||||
.SH "ERROR HANDLING"
|
||||
zip_error_to_str(3)
|
||||
zip_strerror(3)
|
||||
zip_file_strerror(3)
|
||||
zip_error_get(3)
|
||||
zip_error_get_sys_type(3)
|
||||
zip_errors(3)
|
||||
.SH "AUTHORS"
|
||||
|
||||
Dieter Baron <dillo@giga.or.at>
|
||||
and
|
||||
Thomas Klausner <tk@giga.or.at>
|
||||
@@ -1,107 +0,0 @@
|
||||
.\" $NiH: libzip.mdoc,v 1.7 2006/04/23 12:50:32 wiz Exp $
|
||||
.\"
|
||||
.\" libzip.mdoc -- general overview of available functions
|
||||
.\" Copyright (C) 2005, 2006 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.Dd June 11, 2008
|
||||
.Dt LIBZIP 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm libzip
|
||||
.Nd library for manipulating zip archives
|
||||
.Sh LIBRARY
|
||||
libzip (-lzip)
|
||||
.Sh SYNOPSIS
|
||||
.In zip.h
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a library for reading, creating, and modifying zip archives.
|
||||
.Pp
|
||||
Below there are two sections listing functions: one for how to read
|
||||
from zip archives and one for how to create/modify them.
|
||||
.Sh READING ZIP ARCHIVES
|
||||
.Ss open archive
|
||||
.Xr zip_open 3
|
||||
.Ss find files
|
||||
.Xr zip_name_locate 3
|
||||
.Ss read files
|
||||
.Xr zip_fopen 3
|
||||
.Xr zip_fopen_index 3
|
||||
.Xr zip_fread 3
|
||||
.Xr zip_fclose 3
|
||||
.Ss close archive
|
||||
.Xr zip_close 3
|
||||
.Ss miscellaneous
|
||||
.Xr zip_stat 3
|
||||
.Xr zip_get_archive_comment 3
|
||||
.Xr zip_get_archive_flag 3
|
||||
.Xr zip_get_file_comment 3
|
||||
.Xr zip_get_name 3
|
||||
.Xr zip_get_num_files 3
|
||||
.Sh CREATING/MODIFYING ZIP ARCHIVES
|
||||
.Ss create/open archive
|
||||
.Xr zip_open 3
|
||||
.Ss add/change files and directories
|
||||
.Xr zip_add 3
|
||||
.Xr zip_add_dir 3
|
||||
.Xr zip_replace 3
|
||||
.Xr zip_set_file_comment 3
|
||||
.Xr zip_source_buffer 3
|
||||
.Xr zip_source_file 3
|
||||
.Xr zip_source_filep 3
|
||||
.Xr zip_source_function 3
|
||||
.Xr zip_source_zip 3
|
||||
.Xr zip_source_free 3
|
||||
.Ss rename files
|
||||
.Xr zip_rename 3
|
||||
.Ss delete files
|
||||
.Xr zip_delete 3
|
||||
.Ss revert changes
|
||||
.Xr zip_unchange 3
|
||||
.Xr zip_unchange_all 3
|
||||
.Xr zip_unchange_archive 3
|
||||
.Ss close archive
|
||||
.Xr zip_close 3
|
||||
.Ss miscellaneous
|
||||
.Xr zip_set_archive_comment 3
|
||||
.Xr zip_set_archive_flag 3
|
||||
.Sh ERROR HANDLING
|
||||
.Xr zip_error_to_str 3
|
||||
.Xr zip_strerror 3
|
||||
.Xr zip_file_strerror 3
|
||||
.Xr zip_error_get 3
|
||||
.Xr zip_error_get_sys_type 3
|
||||
.Xr zip_errors 3
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
.An Dieter Baron Aq dillo@giga.or.at
|
||||
and
|
||||
.An Thomas Klausner Aq tk@giga.or.at
|
||||
@@ -1,128 +0,0 @@
|
||||
.\" Converted with mdoc2man 0.2
|
||||
.\" from NiH: zip_add.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp
|
||||
.\" $NiH: zip_add.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp $
|
||||
.\"
|
||||
.\" zip_add.mdoc \-- add files to zip archive
|
||||
.\" Copyright (C) 2004, 2005, 2006 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.TH ZIP_ADD 3 "April 9, 2006" NiH
|
||||
.SH "NAME"
|
||||
zip_add , \- .Nm zip_replace
|
||||
add file to zip archive or replace file in zip archive
|
||||
.SH "LIBRARY"
|
||||
libzip (-lzip)
|
||||
.SH "SYNOPSIS"
|
||||
#include <zip.h>
|
||||
.PP
|
||||
int
|
||||
zip_add(struct zip *archive, const char *name); \
|
||||
"struct zip_source *source"
|
||||
.PP
|
||||
int
|
||||
zip_replace(struct zip *archive, int index); \
|
||||
"struct zip_source *source"
|
||||
.SH "DESCRIPTION"
|
||||
The function
|
||||
zip_add
|
||||
adds a file to a zip archive, while
|
||||
zip_replace
|
||||
replaces an existing file in a zip archive.
|
||||
The argument
|
||||
\fBarchive\fR
|
||||
specifies the zip archive to which the file should be added.
|
||||
\fBname\fR
|
||||
is the file's name in the zip archive (for
|
||||
zip_add ),
|
||||
while
|
||||
\fBindex\fR
|
||||
specifies which file should be replaced (for
|
||||
zip_replace ).
|
||||
The data is obtained from the
|
||||
\fBsource\fR
|
||||
argument.
|
||||
See the
|
||||
zip_source_*
|
||||
functions cited in
|
||||
SEE ALSO.
|
||||
.SH "RETURN VALUES"
|
||||
Upon successful completion, the index of the new file in the archive
|
||||
is returned.
|
||||
Otherwise, \-1 is returned and the error code in
|
||||
\fBarchive\fR
|
||||
is set to indicate the error.
|
||||
.SH "EXAMPLES"
|
||||
.Bd \-literal \-offset indent
|
||||
struct zip_source *s;
|
||||
|
||||
if ((s=zip_source_buffer(archive, buffer, len)) == NULL ||
|
||||
zip_add(archive, name, s) \*[Lt] 0) {
|
||||
zip_source_free(s);
|
||||
printf("error adding file: %s\n", zip_strerror(archive));
|
||||
}
|
||||
.Ed
|
||||
.SH "ERRORS"
|
||||
zip_add
|
||||
and
|
||||
zip_replace
|
||||
fail if:
|
||||
.RS
|
||||
.TP 4
|
||||
[ZIP_ER_EXISTS]
|
||||
There is already a file called
|
||||
\fBname\fR
|
||||
in the archive.
|
||||
(Only applies to
|
||||
zip_add ).
|
||||
.TP 4
|
||||
[ZIP_ER_INVAL]
|
||||
\fBsource\fR
|
||||
or
|
||||
\fBname\fR
|
||||
are
|
||||
\fBNULL,\fR
|
||||
or
|
||||
\fBindex\fR
|
||||
is invalid.
|
||||
.TP 4
|
||||
[ZIP_ER_MEMORY]
|
||||
Required memory could not be allocated.
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
libzip(3),
|
||||
zip_source_file(3),
|
||||
zip_source_filep(3),
|
||||
zip_source_function(3),
|
||||
zip_source_zip(3)
|
||||
.SH "AUTHORS"
|
||||
|
||||
Dieter Baron <dillo@giga.or.at>
|
||||
and
|
||||
Thomas Klausner <tk@giga.or.at>
|
||||
@@ -1,124 +0,0 @@
|
||||
.\" $NiH: zip_add.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp $
|
||||
.\"
|
||||
.\" zip_add.mdoc -- add files to zip archive
|
||||
.\" Copyright (C) 2004, 2005, 2006 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.Dd April 9, 2006
|
||||
.Dt ZIP_ADD 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm zip_add ,
|
||||
.Nm zip_replace
|
||||
.Nd add file to zip archive or replace file in zip archive
|
||||
.Sh LIBRARY
|
||||
libzip (-lzip)
|
||||
.Sh SYNOPSIS
|
||||
.In zip.h
|
||||
.Ft int
|
||||
.Fn zip_add "struct zip *archive" "const char *name" \
|
||||
"struct zip_source *source"
|
||||
.Ft int
|
||||
.Fn zip_replace "struct zip *archive" "int index" \
|
||||
"struct zip_source *source"
|
||||
.Sh DESCRIPTION
|
||||
The function
|
||||
.Fn zip_add
|
||||
adds a file to a zip archive, while
|
||||
.Fn zip_replace
|
||||
replaces an existing file in a zip archive.
|
||||
The argument
|
||||
.Ar archive
|
||||
specifies the zip archive to which the file should be added.
|
||||
.Ar name
|
||||
is the file's name in the zip archive (for
|
||||
.Fn zip_add ) ,
|
||||
while
|
||||
.Ar index
|
||||
specifies which file should be replaced (for
|
||||
.Fn zip_replace ) .
|
||||
The data is obtained from the
|
||||
.Ar source
|
||||
argument.
|
||||
See the
|
||||
.Fn zip_source_*
|
||||
functions cited in
|
||||
.Sx SEE ALSO .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the index of the new file in the archive
|
||||
is returned.
|
||||
Otherwise, \-1 is returned and the error code in
|
||||
.Ar archive
|
||||
is set to indicate the error.
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal -offset indent
|
||||
struct zip_source *s;
|
||||
|
||||
if ((s=zip_source_buffer(archive, buffer, len)) == NULL ||
|
||||
zip_add(archive, name, s) \*[Lt] 0) {
|
||||
zip_source_free(s);
|
||||
printf("error adding file: %s\n", zip_strerror(archive));
|
||||
}
|
||||
.Ed
|
||||
.Sh ERRORS
|
||||
.Fn zip_add
|
||||
and
|
||||
.Fn zip_replace
|
||||
fail if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er ZIP_ER_EXISTS
|
||||
There is already a file called
|
||||
.Ar name
|
||||
in the archive.
|
||||
(Only applies to
|
||||
.Fn zip_add ) .
|
||||
.It Bq Er ZIP_ER_INVAL
|
||||
.Ar source
|
||||
or
|
||||
.Ar name
|
||||
are
|
||||
.Dv NULL ,
|
||||
or
|
||||
.Ar index
|
||||
is invalid.
|
||||
.It Bq Er ZIP_ER_MEMORY
|
||||
Required memory could not be allocated.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr libzip 3 ,
|
||||
.Xr zip_source_file 3 ,
|
||||
.Xr zip_source_filep 3 ,
|
||||
.Xr zip_source_function 3 ,
|
||||
.Xr zip_source_zip 3
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
.An Dieter Baron Aq dillo@giga.or.at
|
||||
and
|
||||
.An Thomas Klausner Aq tk@giga.or.at
|
||||
@@ -1,88 +0,0 @@
|
||||
.\" Converted with mdoc2man 0.2
|
||||
.\" from NiH: zip_add_dir.mdoc,v 1.1 2006/10/03 18:55:51 wiz Exp
|
||||
.\" $NiH: zip_add_dir.mdoc,v 1.1 2006/10/03 18:55:51 wiz Exp $
|
||||
.\"
|
||||
.\" zip_add_dir.mdoc \-- add directory to zip archive
|
||||
.\" Copyright (C) 2006 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.TH ZIP_ADD_DIR 3 "October 3, 2006" NiH
|
||||
.SH "NAME"
|
||||
zip_add_dir \- add directory to zip archive
|
||||
.SH "LIBRARY"
|
||||
libzip (-lzip)
|
||||
.SH "SYNOPSIS"
|
||||
#include <zip.h>
|
||||
.PP
|
||||
int
|
||||
zip_add_dir(struct zip *archive, const char *name);
|
||||
.SH "DESCRIPTION"
|
||||
The function
|
||||
zip_add_dir
|
||||
adds a directory to a zip archive.
|
||||
The argument
|
||||
\fBarchive\fR
|
||||
specifies the zip archive to which the directory should be added.
|
||||
\fBname\fR
|
||||
is the directory's name in the zip archive.
|
||||
.SH "RETURN VALUES"
|
||||
Upon successful completion, the index of the new entry in the archive
|
||||
is returned.
|
||||
Otherwise, \-1 is returned and the error code in
|
||||
\fBarchive\fR
|
||||
is set to indicate the error.
|
||||
.SH "ERRORS"
|
||||
zip_add_dir
|
||||
fails if:
|
||||
.RS
|
||||
.TP 4
|
||||
[ZIP_ER_EXISTS]
|
||||
There is already an entry called
|
||||
\fBname\fR
|
||||
in the archive.
|
||||
.TP 4
|
||||
[ZIP_ER_INVAL]
|
||||
\fBarchive\fR
|
||||
or
|
||||
\fBname\fR
|
||||
are
|
||||
\fBNULL.\fR
|
||||
.TP 4
|
||||
[ZIP_ER_MEMORY]
|
||||
Required memory could not be allocated.
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
libzip(3),
|
||||
zip_add(3)
|
||||
.SH "AUTHORS"
|
||||
|
||||
Dieter Baron <dillo@giga.or.at>
|
||||
and
|
||||
Thomas Klausner <tk@giga.or.at>
|
||||
@@ -1,85 +0,0 @@
|
||||
.\" $NiH: zip_add_dir.mdoc,v 1.1 2006/10/03 18:55:51 wiz Exp $
|
||||
.\"
|
||||
.\" zip_add_dir.mdoc -- add directory to zip archive
|
||||
.\" Copyright (C) 2006 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.Dd October 3, 2006
|
||||
.Dt ZIP_ADD_DIR 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm zip_add_dir
|
||||
.Nd add directory to zip archive
|
||||
.Sh LIBRARY
|
||||
libzip (-lzip)
|
||||
.Sh SYNOPSIS
|
||||
.In zip.h
|
||||
.Ft int
|
||||
.Fn zip_add_dir "struct zip *archive" "const char *name"
|
||||
.Sh DESCRIPTION
|
||||
The function
|
||||
.Fn zip_add_dir
|
||||
adds a directory to a zip archive.
|
||||
The argument
|
||||
.Ar archive
|
||||
specifies the zip archive to which the directory should be added.
|
||||
.Ar name
|
||||
is the directory's name in the zip archive.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the index of the new entry in the archive
|
||||
is returned.
|
||||
Otherwise, \-1 is returned and the error code in
|
||||
.Ar archive
|
||||
is set to indicate the error.
|
||||
.Sh ERRORS
|
||||
.Fn zip_add_dir
|
||||
fails if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er ZIP_ER_EXISTS
|
||||
There is already an entry called
|
||||
.Ar name
|
||||
in the archive.
|
||||
.It Bq Er ZIP_ER_INVAL
|
||||
.Ar archive
|
||||
or
|
||||
.Ar name
|
||||
are
|
||||
.Dv NULL .
|
||||
.It Bq Er ZIP_ER_MEMORY
|
||||
Required memory could not be allocated.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr libzip 3 ,
|
||||
.Xr zip_add 3
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
.An Dieter Baron Aq dillo@giga.or.at
|
||||
and
|
||||
.An Thomas Klausner Aq tk@giga.or.at
|
||||
@@ -1,122 +0,0 @@
|
||||
.\" Converted with mdoc2man 0.2
|
||||
.\" from NiH: zip_close.mdoc,v 1.13 2005/06/09 21:13:12 wiz Exp
|
||||
.\" $NiH: zip_close.mdoc,v 1.13 2005/06/09 21:13:12 wiz Exp $
|
||||
.\"
|
||||
.\" zip_close.mdoc \-- close zip archive
|
||||
.\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.TH ZIP_CLOSE 3 "July 24, 2008" NiH
|
||||
.SH "NAME"
|
||||
zip_close \- close zip archive
|
||||
.SH "LIBRARY"
|
||||
libzip (-lzip)
|
||||
.SH "SYNOPSIS"
|
||||
#include <zip.h>
|
||||
.PP
|
||||
int
|
||||
zip_close(struct zip *archive);
|
||||
.SH "DESCRIPTION"
|
||||
The
|
||||
zip_close
|
||||
function closes
|
||||
\fBarchive\fR
|
||||
and frees the memory allocated for it.
|
||||
If any files within were changed, those changes are written to disk
|
||||
first.
|
||||
If writing changes fails,
|
||||
zip_close
|
||||
fails and
|
||||
\fBarchive\fR
|
||||
is left unchanged.
|
||||
If
|
||||
\fBarchive\fR
|
||||
contains no files, the file is completely removed (no empty archive is
|
||||
written).
|
||||
.SH "RETURN VALUES"
|
||||
Upon successful completion 0 is returned.
|
||||
Otherwise, \-1 is returned and the error code in
|
||||
\fBarchive\fR
|
||||
is set to indicate the error.
|
||||
.SH "ERRORS"
|
||||
zip_close
|
||||
will fail if:
|
||||
.RS
|
||||
.TP 4
|
||||
[ZIP_ER_EOF]
|
||||
Unexpected end-of-file found while reading from a file.
|
||||
.TP 4
|
||||
[ZIP_ER_INTERNAL]
|
||||
The callback function of an added or replaced file returned an
|
||||
error but failed to report which.
|
||||
.TP 4
|
||||
[ZIP_ER_INVAL]
|
||||
The
|
||||
\fBpath\fR
|
||||
argument is
|
||||
\fBNULL.\fR
|
||||
.TP 4
|
||||
[ZIP_ER_MEMORY]
|
||||
Required memory could not be allocated.
|
||||
.TP 4
|
||||
[ZIP_ER_NOZIP]
|
||||
File is not a zip archive.
|
||||
.TP 4
|
||||
[ZIP_ER_READ]
|
||||
A file read failed.
|
||||
.TP 4
|
||||
[ZIP_ER_RENAME]
|
||||
A temporary file could not be renamed to its final name.
|
||||
.TP 4
|
||||
[ZIP_ER_SEEK]
|
||||
A file seek failed.
|
||||
.TP 4
|
||||
[ZIP_ER_TMPOPEN]
|
||||
A temporary file could not be created.
|
||||
.TP 4
|
||||
[ZIP_ER_WRITE]
|
||||
A file write failed.
|
||||
.TP 4
|
||||
[ZIP_ER_ZLIB]
|
||||
An error occurred while (de)compressing a stream with
|
||||
zlib(3).
|
||||
.RE
|
||||
Additionally, any errors returned by the callback function
|
||||
for added or replaced files will be passed back.
|
||||
.SH "SEE ALSO"
|
||||
libzip(3),
|
||||
zip_error_get(3),
|
||||
zip_open(3),
|
||||
zip_strerror(3)
|
||||
.SH "AUTHORS"
|
||||
|
||||
Dieter Baron <dillo@giga.or.at>
|
||||
and
|
||||
Thomas Klausner <tk@giga.or.at>
|
||||
@@ -1,111 +0,0 @@
|
||||
.\" $NiH: zip_close.mdoc,v 1.13 2005/06/09 21:13:12 wiz Exp $
|
||||
.\"
|
||||
.\" zip_close.mdoc -- close zip archive
|
||||
.\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner
|
||||
.\"
|
||||
.\" This file is part of libzip, a library to manipulate ZIP archives.
|
||||
.\" The authors can be contacted at <libzip@nih.at>
|
||||
.\"
|
||||
.\" 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. The names of the authors may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior
|
||||
.\" written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||
.\"
|
||||
.Dd July 24, 2008
|
||||
.Dt ZIP_CLOSE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm zip_close
|
||||
.Nd close zip archive
|
||||
.Sh LIBRARY
|
||||
libzip (-lzip)
|
||||
.Sh SYNOPSIS
|
||||
.In zip.h
|
||||
.Ft int
|
||||
.Fn zip_close "struct zip *archive"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn zip_close
|
||||
function closes
|
||||
.Ar archive
|
||||
and frees the memory allocated for it.
|
||||
If any files within were changed, those changes are written to disk
|
||||
first.
|
||||
If writing changes fails,
|
||||
.Fn zip_close
|
||||
fails and
|
||||
.Ar archive
|
||||
is left unchanged.
|
||||
If
|
||||
.Ar archive
|
||||
contains no files, the file is completely removed (no empty archive is
|
||||
written).
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion 0 is returned.
|
||||
Otherwise, \-1 is returned and the error code in
|
||||
.Ar archive
|
||||
is set to indicate the error.
|
||||
.Sh ERRORS
|
||||
.Fn zip_close
|
||||
will fail if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er ZIP_ER_EOF
|
||||
Unexpected end-of-file found while reading from a file.
|
||||
.It Bq Er ZIP_ER_INTERNAL
|
||||
The callback function of an added or replaced file returned an
|
||||
error but failed to report which.
|
||||
.It Bq Er ZIP_ER_INVAL
|
||||
The
|
||||
.Ar path
|
||||
argument is
|
||||
.Dv NULL .
|
||||
.It Bq Er ZIP_ER_MEMORY
|
||||
Required memory could not be allocated.
|
||||
.It Bq Er ZIP_ER_NOZIP
|
||||
File is not a zip archive.
|
||||
.It Bq Er ZIP_ER_READ
|
||||
A file read failed.
|
||||
.It Bq Er ZIP_ER_RENAME
|
||||
A temporary file could not be renamed to its final name.
|
||||
.It Bq Er ZIP_ER_SEEK
|
||||
A file seek failed.
|
||||
.It Bq Er ZIP_ER_TMPOPEN
|
||||
A temporary file could not be created.
|
||||
.It Bq Er ZIP_ER_WRITE
|
||||
A file write failed.
|
||||
.It Bq Er ZIP_ER_ZLIB
|
||||
An error occurred while (de)compressing a stream with
|
||||
.Xr zlib 3 .
|
||||
.El
|
||||
Additionally, any errors returned by the callback function
|
||||
for added or replaced files will be passed back.
|
||||
.Sh SEE ALSO
|
||||
.Xr libzip 3 ,
|
||||
.Xr zip_error_get 3 ,
|
||||
.Xr zip_open 3 ,
|
||||
.Xr zip_strerror 3
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
.An Dieter Baron Aq dillo@giga.or.at
|
||||
and
|
||||
.An Thomas Klausner Aq tk@giga.or.at
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user