SET(PACKAGE "libzip")
SET(PACKAGE_NAME ${PACKAGE})
SET(PACKAGE_VERSION_MAJOR "1")
-SET(PACKAGE_VERSION_MINOR "0")
+SET(PACKAGE_VERSION_MINOR "1")
SET(PACKAGE_VERSION_PATCH "1")
-#SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
-SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
+SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
+#SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
SET(PACKAGE_VERSION ${VERSION})
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
CHECK_FUNCTION_EXISTS(_fdopen HAVE__FDOPEN)
CHECK_FUNCTION_EXISTS(_fileno HAVE__FILENO)
CHECK_FUNCTION_EXISTS(_open HAVE__OPEN)
+CHECK_FUNCTION_EXISTS(_setmode HAVE__SETMODE)
CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
CHECK_FUNCTION_EXISTS(_strdup HAVE__STRDUP)
CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
+CHECK_FUNCTION_EXISTS(fileno HAVE_FILENO)
CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
CHECK_FUNCTION_EXISTS(ftello HAVE_FTELLO)
+CHECK_FUNCTION_EXISTS(getprogname HAVE_GETPROGNAME)
CHECK_FUNCTION_EXISTS(open HAVE_OPEN)
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
+CHECK_FUNCTION_EXISTS(setmode HAVE_SETMODE)
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
-
-CHECK_SYMBOL_EXISTS(MoveFileExA windows.h HAVE_MOVEFILEEXA)
+CHECK_FUNCTION_EXISTS(stricmp HAVE_STRICMP)
CHECK_INCLUDE_FILES(fts.h HAVE_FTS_H)
CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H_LIBZIP)
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H_LIBZIP)
+# TODO: fix test
+# this test does not find __progname even when it exists
+#CHECK_SYMBOL_EXISTS(__progname stdlib.h HAVE___PROGNAME)
+
CHECK_TYPE_SIZE(__int8 __INT8_LIBZIP)
CHECK_TYPE_SIZE(int8_t INT8_T_LIBZIP)
CHECK_TYPE_SIZE(uint8_t UINT8_T_LIBZIP)
-Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+Copyright (C) 1999-2016 Dieter Baron and Thomas Klausner
The authors can be contacted at <libzip@nih.at>
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@SET_MAKE@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
build_triplet = @build@
host_triplet = @host@
subdir = .
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/configure $(am__configure_deps) \
- $(srcdir)/config.h.in $(srcdir)/libzip.pc.in \
- $(srcdir)/libzip-uninstalled.pc.in AUTHORS INSTALL NEWS README \
- THANKS TODO compile config.guess config.sub depcomp install-sh \
- missing ltmain.sh
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/visibility.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+ $(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(srcdir)/libzip-uninstalled.pc.in $(srcdir)/libzip.pc.in \
+ AUTHORS INSTALL NEWS README THANKS TODO compile config.guess \
+ config.sub depcomp install-sh ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
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*) \
$(am__post_remove_distdir)
dist-tarZ: distdir
- @echo WARNING: "Support for shar distribution archives is" \
- "deprecated." >&2
+ @echo WARNING: "Support for distribution archives compressed with" \
+ "legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
- @echo WARNING: "Support for distribution archives compressed with" \
- "legacy program 'compress' is deprecated." >&2
+ @echo WARNING: "Support for shar distribution archives is" \
+ "deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
- mkdir $(distdir)/_build $(distdir)/_inst
+ mkdir $(distdir)/_build $(distdir)/_build/sub $(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 \
+ && $(am__cd) $(distdir)/_build/sub \
+ && ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
- --srcdir=.. --prefix="$$dc_install_base" \
+ --srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgconfigDATA
+.PRECIOUS: Makefile
+
dist-hook:
mkdir $(distdir)/xcode
+1.1.1 [2016/02/07]
+
+* Build fixes for Linux
+* Fix some warnings reported by PVS-Studio
+
+1.1 [2016/01/26]
+
+* ziptool(1): command line tool to modify zip archives
+* Speedups for archives with many entries
+* Coverity fixes
+* Better APK support
+* Support for running tests on Windows
+* More build fixes for Windows
+* Portability fixes
+* Documentation improvements
+
1.0.1 [2015/05/04]
* Build fixes for Windows.
about API changes and how to adapt your code for them in the included
file API-CHANGES.
- For generic installation instructions, see file `INSTALL'.
-Additionally, you'll need zlib (at least version 1.1.2). It comes
+ For generic installation instructions, see file 'INSTALL', which
+describes the approach using autoconf; alternatively, you can
+use cmake to build.
+
+ 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.zlib.net/
Andrew Molyneux <andrew@molyneuxfamily.co.uk>
Ankur Kothari <ankz.kothari@gmail.com>
BALATON Zoltan <balaton@eik.bme.hu>
+Boaz Stolk <bstolk@aweta.nl>
Bogdan <bogiebog@gmail.com>
Chris Nehren <cnehren+libzip@pobox.com>
Coverity <info@coverity.com>
Del Merritt <del@alum.mit.edu>
Dmytro Rybachenko <atmoliton@gmail.com>
François Simon <AT.GFI.Francois.SIMON@sesam-vitale.fr>
+Frederik Ramm <frederik@remote.org>
Heiko Hund <heiko@ist.eigentlich.net>
Jan Weiß <jan@geheimwerk.de>
Joel Ebrahimi <joel.ebrahimi@gmail.com>
Jono Spiro <jono.spiro@gmail.com>
+Keith Jones <keith@keithjjones.com>
Kohei Yoshida <kohei.yoshida@gmail.com>
+Leith Bade <leith@mapbox.com>
Lubomir I. Ivanov <neolit123@gmail.com>
Martin Buchholz <martinrb@google.com>
Martin Szulecki <m.szulecki@libimobiledevice.org>
Pierre-Louis Cabelguen <plcabelguen@googlemail.com>
Remi Collet <remi@fedoraproject.org>
Rick Carback <carback1@umbc.edu>
+Robert Norris <rw_norris@hotmail.com>
Roberto Tirabassi <rtirabassi@3di.it>
Roland Ortloff <Ortloff.R@gmx.de>
Simon Talbot <simont@nse.co.uk>
* delete all extra fields during zip_replace()
* function to copy file from one archive to another
* set O_CLOEXEC flag after fopen and mkstemp
+* configure: use windows backends on windows
+* add append-only mode writing file to disk incrementally to keep memory usage low
+* zip_file_set_mtime: support InfoZIP time stamps
* support streaming output (creating new archive to e.g. stdout)
* add functions to:
====
* support InfoZIP encryption header extension (copy data descriptor for encrypted files)
! ensure that nentries is small enough not to cause overflow (size_t for entry, uint64 for CD on disk)
-* Xcode 32bit build uses 64bit config.h
* fix OpenSUSE i686 regression failures
* fix open_filename_duplicate_consistency.test to fail
* check for limits imposed by format (central dir size, file size, extra fields, ...)
Test Case Issues
================
+* unchange on added file
+* test seek in zip_source_crc
* test cases for set_extra*, delete_extra*, *extra_field*
* test cases for in memory archives
add
-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
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-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# 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.14'
+[am__api_version='1.15'
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.14.1], [],
+m4_if([$1], [1.15], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# 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.14.1])dnl
+[AM_AUTOMAKE_VERSION([1.15])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-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# 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`
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver). 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
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
-fi])
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+])
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
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
fi
AC_SUBST([install_sh])])
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
rm -f conftest.file
])
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+# Copyright (C) 2004-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
#include "zipconf.h"
#endif
/* BEGIN DEFINES */
+#cmakedefine HAVE___PROGNAME
#cmakedefine HAVE__CLOSE
#cmakedefine HAVE__DUP
#cmakedefine HAVE__FDOPEN
#cmakedefine HAVE__FILENO
#cmakedefine HAVE__OPEN
+#cmakedefine HAVE__SETMODE
#cmakedefine HAVE__SNPRINTF
#cmakedefine HAVE__STRDUP
#cmakedefine HAVE__STRICMP
+#cmakedefine HAVE_FILENO
#cmakedefine HAVE_FSEEKO
#cmakedefine HAVE_FTELLO
+#cmakedefine HAVE_GETPROGNAME
#cmakedefine HAVE_OPEN
#cmakedefine HAVE_MKSTEMP
+#cmakedefine HAVE_SETMODE
#cmakedefine HAVE_SNPRINTF
#cmakedefine HAVE_SSIZE_T_LIBZIP
#cmakedefine HAVE_STRCASECMP
#cmakedefine HAVE_STRDUP
+#cmakedefine HAVE_STRICMP
#cmakedefine HAVE_STRUCT_TM_TM_ZONE
-#cmakedefine HAVE_MOVEFILEEXA
#cmakedefine HAVE_STDBOOL_H
#cmakedefine HAVE_STRINGS_H
#cmakedefine HAVE_UNISTD_H
#define ZIP_INT32_MAX 0x7fffffffL
#define ZIP_UINT32_MAX 0xffffffffLU
-#define ZIP_INT64_MIN -0x8000000000000000LL
+#define ZIP_INT64_MIN (-ZIP_INT64_MAX-1LL)
#define ZIP_INT64_MAX 0x7fffffffffffffffLL
#define ZIP_UINT64_MAX 0xffffffffffffffffULL
scriptversion=2012-10-14.11; # UTC
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2015 Free Software Foundation, Inc.
-timestamp='2012-02-10'
+timestamp='2015-03-04'
# This file 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 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# 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 Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches to <config-patches@gnu.org>.
+
me=`echo "$0" | sed -e 's,.*/,,'`
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ ;;
+esac
+
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+ /sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || \
+ echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
+ earmv*)
+ arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+ endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+ machine=${arch}${endian}-unknown
+ ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
os=netbsd
;;
esac
+ # Determine ABI tags.
+ case "${UNAME_MACHINE_ARCH}" in
+ earm*)
+ expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+ abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+ ;;
+ esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
+ echo "${machine}-${os}${release}${abi}"
+ exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
+ if [ -x /usr/bin/lslpp ] ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
- i*:MSYS*:*)
+ *:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ exit ;;
+ e2k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
- or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ openrisc*:Linux:*:*)
+ echo or1k-unknown-linux-${LIBC}
+ exit ;;
+ or32:Linux:*:* | or1k*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-${LIBC}
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- UNAME_PROCESSOR="x86_64"
- fi
- fi ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
cat >&2 <<EOF
$0: unable to guess system type
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if you have the `fileno' function. */
+#undef HAVE_FILENO
+
/* Define to 1 if you have the `fseeko' function. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
+/* Define to 1 if you have the `getprogname' function. */
+#undef HAVE_GETPROGNAME
+
/* Define to 1 if the system has the type `int16_t'. */
#undef HAVE_INT16_T
/* 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 `open' function. */
#undef HAVE_OPEN
+/* Define to 1 if you have the `setmode' function. */
+#undef HAVE_SETMODE
+
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
+/* Define to 1 if you have the `stricmp' function. */
+#undef HAVE_STRICMP
+
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the `_open' function. */
#undef HAVE__OPEN
+/* Define to 1 if you have the `_setmode' function. */
+#undef HAVE__SETMODE
+
/* Define to 1 if you have the `_snprintf' function. */
#undef HAVE__SNPRINTF
/* Define to 1 if you have the `_stricmp' function. */
#undef HAVE__STRICMP
+/* Define if libc defines __progname */
+#undef HAVE___PROGNAME
+
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2015 Free Software Foundation, Inc.
-timestamp='2012-04-18'
+timestamp='2015-03-08'
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file 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 of the License, or
+# This file 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 3 of the License, 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.
+# 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.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | be32 | be64 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv \
+ | e2k | epiphany \
+ | fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
- | open8 \
- | or32 \
+ | open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
+ | riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ leon|leon[3-9])
+ basic_machine=sparc-$basic_machine
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
- | elxsi-* \
+ | e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
+ | or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
+ | visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
basic_machine=i386-pc
os=-aros
;;
+ asmjs)
+ basic_machine=asmjs-unknown
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
basic_machine=m68k-isi
os=-sysv
;;
+ leon-*|leon[3-9]-*)
+ basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+ ;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
basic_machine=powerpc-unknown
os=-morphos
;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
msdos)
basic_machine=i386-pc
os=-msdos
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-msys
;;
mvs)
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
+ | -aos* | -aros* | -cloudabi* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
c4x-* | tic4x-*)
os=-coff
;;
+ c8051-*)
+ os=-elf
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
tic54x-*)
os=-coff
;;
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libzip 1.0.1.
+# Generated by GNU Autoconf 2.69 for libzip 1.1.1.
#
# Report bugs to <libzip@nih.at>.
#
# Identity of this package.
PACKAGE_NAME='libzip'
PACKAGE_TARNAME='libzip'
-PACKAGE_VERSION='1.0.1'
-PACKAGE_STRING='libzip 1.0.1'
+PACKAGE_VERSION='1.1.1'
+PACKAGE_STRING='libzip 1.1.1'
PACKAGE_BUGREPORT='libzip@nih.at'
PACKAGE_URL=''
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libzip 1.0.1 to adapt to many kinds of systems.
+\`configure' configures libzip 1.1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libzip 1.0.1:";;
+ short | recursive ) echo "Configuration of libzip 1.1.1:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libzip configure 1.0.1
+libzip configure 1.1.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libzip $as_me 1.0.1, which was
+It was created by libzip $as_me 1.1.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
ac_config_headers="$ac_config_headers config.h"
-am__api_version='1.14'
+am__api_version='1.15'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
# Define the identity of the package.
PACKAGE='libzip'
- VERSION='1.0.1'
+ VERSION='1.1.1'
cat >>confdefs.h <<_ACEOF
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
fi
fi
+
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-for ac_func in _close _dup _fdopen _fileno _open _snprintf _strdup _stricmp fseeko ftello getopt open snprintf strcasecmp strdup
+for ac_func in _close _dup _fdopen _fileno _open _setmode _snprintf _strdup _stricmp fileno fseeko ftello getopt getprogname open setmode snprintf strcasecmp strdup stricmp
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
done
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking MoveFileExA" >&5
-$as_echo_n "checking MoveFileExA... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libc defines __progname" >&5
+$as_echo_n "checking if libc defines __progname... " >&6; }
+if ${ac_cv_libc_defines___progname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <windows.h>
+
int
main ()
{
-MoveFileExA("", "", 0);
+ extern char *__progname; printf("%s", __progname);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define HAVE_MOVEFILEEXA 1" >>confdefs.h
-
+ ac_cv_libc_defines___progname="yes"
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ ac_cv_libc_defines___progname="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libc_defines___progname" >&5
+$as_echo "$ac_cv_libc_defines___progname" >&6; }
+if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
+
+$as_echo "#define HAVE___PROGNAME 1" >>confdefs.h
+
+fi
+
+
for ac_header in fts.h stdbool.h strings.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libzip $as_me 1.0.1, which was
+This file was extended by libzip $as_me 1.1.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libzip config.status 1.0.1
+libzip config.status 1.1.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
AC_PREREQ([2.60])
-AC_INIT([libzip],[1.0.1],[libzip@nih.at])
+AC_INIT([libzip],[1.1.1],[libzip@nih.at])
AC_CONFIG_SRCDIR([lib/zip_add.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
-AC_CHECK_FUNCS([_close _dup _fdopen _fileno _open _snprintf _strdup _stricmp fseeko ftello getopt open snprintf strcasecmp strdup])
+AC_CHECK_FUNCS([_close _dup _fdopen _fileno _open _setmode _snprintf _strdup _stricmp fileno fseeko ftello getopt getprogname open setmode snprintf strcasecmp strdup stricmp])
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_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname,
+ [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
+ [[ extern char *__progname; printf("%s", __progname); ]])],
+ [ ac_cv_libc_defines___progname="yes" ],
+ [ ac_cv_libc_defines___progname="no" ])
+ ])
+if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
+ AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
+fi
+
AC_CHECK_HEADERS([fts.h stdbool.h strings.h unistd.h])
scriptversion=2013-05-30.07; # UTC
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 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
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@SET_MAKE@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
host_triplet = @host@
noinst_PROGRAMS = in-memory$(EXEEXT)
subdir = examples
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/depcomp
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/visibility.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign examples/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
+.PRECIOUS: Makefile
+
# 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.
zip_get_name.c
zip_get_num_entries.c
zip_get_num_files.c
+ zip_hash.c
zip_io_util.c
zip_memdup.c
zip_name_locate.c
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
#CREATE_LIBTOOL_FILE(zip lib)
+
+#ADD_LIBRARY(zipstatic STATIC ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPSYS_FILES})
+#SET_TARGET_PROPERTIES(zipstatic PROPERTIES VERSION 3.0 SOVERSION 3 )
+#TARGET_LINK_LIBRARIES(zipstatic ${ZLIB_LIBRARY})
+#INSTALL(TARGETS zipstatic
+# RUNTIME DESTINATION bin
+# ARCHIVE DESTINATION lib
+# LIBRARY DESTINATION lib)
zip_get_num_entries.c \
zip_get_num_files.c \
zip_get_name.c \
+ zip_hash.c \
zip_io_util.c \
zip_memdup.c \
zip_name_locate.c \
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
build_triplet = @build@
host_triplet = @host@
subdir = lib
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am mkstemp.c \
- $(top_srcdir)/depcomp $(include_HEADERS) $(noinst_HEADERS)
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/visibility.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \
+ $(noinst_HEADERS) $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
zip_get_compression_implementation.lo \
zip_get_encryption_implementation.lo zip_get_file_comment.lo \
zip_get_num_entries.lo zip_get_num_files.lo zip_get_name.lo \
- zip_io_util.lo zip_memdup.lo zip_name_locate.lo zip_new.lo \
- zip_open.lo zip_rename.lo zip_replace.lo \
+ zip_hash.lo zip_io_util.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_default_password.lo zip_set_file_comment.lo \
zip_set_file_compression.lo zip_set_name.lo \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
+ mkstemp.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
zip_get_num_entries.c \
zip_get_num_files.c \
zip_get_name.c \
+ zip_hash.c \
zip_io_util.c \
zip_memdup.c \
zip_name_locate.c \
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*) \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_name.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_get_num_entries.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_hash.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_io_util.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@
tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES uninstall-nodist_libincludeHEADERS
+.PRECIOUS: Makefile
+
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
#!/bin/sh
# make_zipconf.sh: create platform specific include file zipconf.h
-# Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
+# Copyright (C) 1999-2011 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>
/*
zip_add_entry.c -- create and init struct zip_entry
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
if (za->nentry+1 >= za->nentry_alloc) {
zip_entry_t *rentries;
- zip_uint64_t nalloc = za->nentry_alloc + 16;
- zip_uint64_t realloc_size = sizeof(struct zip_entry) * (size_t)nalloc;
+ zip_uint64_t nalloc = za->nentry_alloc;
+ zip_uint64_t additional_entries = 2 * nalloc;
+ zip_uint64_t realloc_size;
+
+ if (additional_entries < 16) {
+ additional_entries = 16;
+ }
+ else if (additional_entries > 1024) {
+ additional_entries = 1024;
+ }
+ /* neither + nor * overflows can happen: nentry_alloc * sizeof(struct zip_entry) < UINT64_MAX */
+ nalloc += additional_entries;
+ realloc_size = sizeof(struct zip_entry) * (size_t)nalloc;
if (sizeof(struct zip_entry) * (size_t)za->nentry_alloc > realloc_size) {
zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
}
+int
+_zip_buffer_skip(zip_buffer_t *buffer, zip_uint64_t length) {
+ zip_uint64_t offset = buffer->offset + length;
+
+ if (offset < buffer->offset) {
+ buffer->ok = false;
+ return -1;
+ }
+ return _zip_buffer_set_offset(buffer, offset);
+}
+
zip_uint64_t
_zip_buffer_size(zip_buffer_t *buffer)
{
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*
zip_delete.c -- delete file from zip archive
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
ZIP_EXTERN int
zip_delete(zip_t *za, zip_uint64_t idx)
{
+ const char *name;
+
if (idx >= za->nentry) {
zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
return -1;
}
+ if ((name=_zip_get_name(za, idx, 0, &za->error)) == NULL) {
+ return -1;
+ }
+
+ if (!_zip_hash_delete(za->names, (const zip_uint8_t *)name, &za->error)) {
+ return -1;
+ }
+
/* allow duplicate file names, because the file will
* be removed directly afterwards */
if (_zip_unchange(za, idx, 1) != 0)
/*
zip_dirent.c -- read directory entry (local or central), clean dirent
- Copyright (C) 1999-2015 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2016 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>
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
{
zip_cdir_t *cd;
zip_uint64_t i;
-
+
if ((cd=(zip_cdir_t *)malloc(sizeof(*cd))) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
}
offset = (zip_uint64_t)off;
- is_zip64 = 0;
+ is_zip64 = false;
for (i=0; i<survivors; i++) {
zip_entry_t *entry = za->entry+filelist[i].idx;
zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return -1;
}
-
+
if (is_zip64) {
_zip_buffer_put(buffer, EOCD64_MAGIC, 4);
_zip_buffer_put_64(buffer, EOCD64LEN-12);
_zip_buffer_put_64(buffer, offset+size);
_zip_buffer_put_32(buffer, 1);
}
-
+
_zip_buffer_put(buffer, EOCD_MAGIC, 4);
_zip_buffer_put_32(buffer, 0);
_zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors));
comment = za->comment_changed ? za->comment_changes : za->comment_orig;
_zip_buffer_put_16(buffer, (zip_uint16_t)(comment ? comment->length : 0));
-
+
if (!_zip_buffer_ok(buffer)) {
zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
_zip_buffer_free(buffer);
memcpy(tde, sde, sizeof(*sde));
else
_zip_dirent_init(tde);
-
+
tde->changed = 0;
tde->cloned = 1;
Fills the zip directory entry zde.
If buffer is non-NULL, data is taken from there; otherwise data is read from fp as needed.
-
+
If local is true, it reads a local header instead of a central directory entry.
Returns size of dirent read if successful. On error, error is filled in and -1 is returned.
zip_uint16_t filename_len, comment_len, ef_len;
bool from_buffer = (buffer != NULL);
-
+
size = local ? LENTRYSIZE : CDENTRYSIZE;
if (buffer) {
zde->version_needed = _zip_buffer_get_16(buffer);
zde->bitflags = _zip_buffer_get_16(buffer);
zde->comp_method = _zip_buffer_get_16(buffer);
-
+
/* convert to time_t */
dostime = _zip_buffer_get_16(buffer);
dosdate = _zip_buffer_get_16(buffer);
zde->last_mod = _zip_d2u_time(dostime, dosdate);
-
+
zde->crc = _zip_buffer_get_32(buffer);
zde->comp_size = _zip_buffer_get_32(buffer);
zde->uncomp_size = _zip_buffer_get_32(buffer);
-
+
filename_len = _zip_buffer_get_16(buffer);
ef_len = _zip_buffer_get_16(buffer);
-
+
if (local) {
comment_len = 0;
zde->disk_number = 0;
zde->ext_attrib = _zip_buffer_get_32(buffer);
zde->offset = _zip_buffer_get_32(buffer);
}
-
+
if (!_zip_buffer_ok(buffer)) {
zip_error_set(error, ZIP_ER_INTERNAL, 0);
if (!from_buffer) {
}
else {
_zip_buffer_free(buffer);
-
+
if ((buffer = _zip_buffer_new_from_source(src, variable_size, NULL, error)) == NULL) {
return -1;
}
}
return -1;
}
- if ((zde->extra_fields=_zip_ef_parse(ef, ef_len, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error)) == NULL) {
+ if (!_zip_ef_parse(ef, ef_len, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, &zde->extra_fields, error)) {
free(ef);
if (!from_buffer) {
_zip_buffer_free(buffer);
}
return -1;
}
-
+
if ((ef_buffer = _zip_buffer_new((zip_uint8_t *)ef, got_len)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
if (!from_buffer) {
}
return -1;
}
-
+
if (zde->uncomp_size == ZIP_UINT32_MAX)
zde->uncomp_size = _zip_buffer_get_64(ef_buffer);
- else if (local)
- ef += 8;
+ else if (local) {
+ /* From appnote.txt: This entry in the Local header MUST
+ include BOTH original and compressed file size fields. */
+ (void)_zip_buffer_skip(ef_buffer, 8); /* error is caught by _zip_buffer_eof() call */
+ }
if (zde->comp_size == ZIP_UINT32_MAX)
zde->comp_size = _zip_buffer_get_64(ef_buffer);
if (!local) {
if (zde->disk_number == ZIP_UINT16_MAX)
zde->disk_number = _zip_buffer_get_32(buffer);
}
-
+
if (!_zip_buffer_eof(ef_buffer)) {
zip_error_set(error, ZIP_ER_INCONS, 0);
_zip_buffer_free(ef_buffer);
}
_zip_buffer_free(ef_buffer);
}
-
+
if (!_zip_buffer_ok(buffer)) {
zip_error_set(error, ZIP_ER_INTERNAL, 0);
if (!from_buffer) {
zip_error_set(error, ZIP_ER_SEEK, EFBIG);
return -1;
}
-
+
zde->extra_fields = _zip_ef_remove_internal(zde->extra_fields);
return (zip_int64_t)(size + variable_size);
zip_buffer_t *buffer;
const zip_uint8_t *ef = _zip_ef_get_by_id(de->extra_fields, &ef_len, id, 0, ZIP_EF_BOTH, NULL);
-
+
if (ef == NULL || ef_len < 5 || ef[0] != 1) {
return str;
}
-
+
if ((buffer = _zip_buffer_new((zip_uint8_t *)ef, ef_len)) == NULL) {
return str;
}
-
+
_zip_buffer_get_8(buffer);
ef_crc = _zip_buffer_get_32(buffer);
str = ef_str;
}
}
-
+
_zip_buffer_free(buffer);
-
+
return str;
}
_zip_error_set_from_source(error, src);
return -1;
}
-
+
if ((buffer = _zip_buffer_new_from_source(src, local ? 4 : 6, b, error)) == NULL) {
return -1;
}
for (i=0; i<(local ? 2 : 3); i++) {
size += _zip_buffer_get_16(buffer);
}
-
+
if (!_zip_buffer_eof(buffer)) {
zip_error_set(error, ZIP_ER_INTERNAL, 0);
_zip_buffer_free(buffer);
zip_uint16_t dostime, dosdate;
zip_encoding_type_t com_enc, name_enc;
zip_extra_field_t *ef;
+ zip_extra_field_t *ef64;
+ zip_uint32_t ef_total_size;
bool is_zip64;
bool is_really_zip64;
zip_uint8_t buf[CDENTRYSIZE];
ef = NULL;
- is_zip64 = false;
-
name_enc = _zip_guess_encoding(de->filename, ZIP_ENCODING_UNKNOWN);
com_enc = _zip_guess_encoding(de->comment, ZIP_ENCODING_UNKNOWN);
ef = ef2;
}
}
-
+
is_really_zip64 = _zip_dirent_needs_zip64(de, flags);
is_zip64 = (flags & (ZIP_FL_LOCAL|ZIP_FL_FORCE_ZIP64)) == (ZIP_FL_LOCAL|ZIP_FL_FORCE_ZIP64) || is_really_zip64;
-
+
if (is_zip64) {
zip_uint8_t ef_zip64[EFZIP64SIZE];
zip_buffer_t *ef_buffer = _zip_buffer_new(ef_zip64, sizeof(ef_zip64));
_zip_ef_free(ef);
return -1;
}
-
+
if (flags & ZIP_FL_LOCAL) {
if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX) {
_zip_buffer_put_64(ef_buffer, de->uncomp_size);
}
}
}
-
+
if (!_zip_buffer_ok(ef_buffer)) {
zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
_zip_buffer_free(ef_buffer);
return -1;
}
- zip_extra_field_t *ef64 = _zip_ef_new(ZIP_EF_ZIP64, (zip_uint16_t)(_zip_buffer_offset(ef_buffer)), ef_zip64, ZIP_EF_BOTH);
+ ef64 = _zip_ef_new(ZIP_EF_ZIP64, (zip_uint16_t)(_zip_buffer_offset(ef_buffer)), ef_zip64, ZIP_EF_BOTH);
_zip_buffer_free(ef_buffer);
ef64->next = ef;
ef = ef64;
_zip_ef_free(ef);
return -1;
}
-
+
_zip_buffer_put(buffer, (flags & ZIP_FL_LOCAL) ? LOCAL_MAGIC : CENTRAL_MAGIC, 4);
-
+
if ((flags & ZIP_FL_LOCAL) == 0) {
_zip_buffer_put_16(buffer, (zip_uint16_t)(is_really_zip64 ? 45 : de->version_madeby));
}
_zip_buffer_put_16(buffer, dosdate);
_zip_buffer_put_32(buffer, de->crc);
-
+
if (((flags & ZIP_FL_LOCAL) == ZIP_FL_LOCAL) && ((de->comp_size >= ZIP_UINT32_MAX) || (de->uncomp_size >= ZIP_UINT32_MAX))) {
/* In local headers, if a ZIP64 EF is written, it MUST contain
* both compressed and uncompressed sizes (even if one of the
_zip_buffer_put_16(buffer, _zip_string_length(de->filename));
/* TODO: check for overflow */
- zip_uint32_t ef_total_size = (zip_uint32_t)_zip_ef_size(de->extra_fields, flags) + (zip_uint32_t)_zip_ef_size(ef, ZIP_EF_BOTH);
+ ef_total_size = (zip_uint32_t)_zip_ef_size(de->extra_fields, flags) + (zip_uint32_t)_zip_ef_size(ef, ZIP_EF_BOTH);
_zip_buffer_put_16(buffer, (zip_uint16_t)ef_total_size);
-
+
if ((flags & ZIP_FL_LOCAL) == 0) {
_zip_buffer_put_16(buffer, _zip_string_length(de->comment));
_zip_buffer_put_16(buffer, (zip_uint16_t)de->disk_number);
else
_zip_buffer_put_32(buffer, ZIP_UINT32_MAX);
}
-
+
if (!_zip_buffer_ok(buffer)) {
zip_error_set(&za->error, ZIP_ER_INTERNAL, 0);
_zip_buffer_free(buffer);
_zip_ef_free(ef);
return -1;
}
-
+
_zip_buffer_free(buffer);
if (de->filename) {
struct tm tm;
memset(&tm, 0, sizeof(tm));
-
+
/* 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;
zip_buffer_t *buffer;
zip_extra_field_t *ef;
- raw = _zip_string_get(str, &len, ZIP_FL_ENC_RAW, NULL);
+ if ((raw=_zip_string_get(str, &len, ZIP_FL_ENC_RAW, NULL)) == NULL) {
+ /* error already set */
+ return NULL;
+ }
if (len+5 > ZIP_UINT16_MAX) {
zip_error_set(error, ZIP_ER_INVAL, 0); /* TODO: better error code? */
return NULL;
}
-
+
if ((buffer = _zip_buffer_new(NULL, len+5)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
_zip_buffer_free(buffer);
return NULL;
}
-
+
ef = _zip_ef_new(id, (zip_uint16_t)(_zip_buffer_offset(buffer)), _zip_buffer_data(buffer), ZIP_EF_BOTH);
_zip_buffer_free(buffer);
struct tm *tm;
tm = localtime(&intime);
+ if (tm->tm_year < 80) {
+ tm->tm_year = 80;
+ }
+
*ddate = (zip_uint16_t)(((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5) + tm->tm_mday);
*dtime = (zip_uint16_t)(((tm->tm_hour)<<11) + ((tm->tm_min)<<5) + ((tm->tm_sec)>>1));
/*
zip_discard.c -- discard and free struct zip
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
_zip_string_free(za->comment_orig);
_zip_string_free(za->comment_changes);
+ _zip_hash_free(za->names);
+
if (za->entry) {
for (i=0; i<za->nentry; i++)
_zip_entry_finalize(za->entry+i);
/*
zip_error.c -- zip_error_t helper functions
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
#include <stdlib.h>
#include "zipint.h"
/*
zip_error_sterror.c -- get string representation of struct zip_error
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
*/
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
zip_error_to_str.c -- get string representation of zip error code
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
*/
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-#include "zipint.h"
-
-#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include "zipint.h"
+
zip_extra_field_t *
_zip_ef_clone(const zip_extra_field_t *ef, zip_error_t *error)
}
-zip_extra_field_t *
-_zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_error_t *error)
+bool
+_zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, zip_extra_field_t **ef_head_p, zip_error_t *error)
{
zip_buffer_t *buffer;
zip_extra_field_t *ef, *ef2, *ef_head;
if ((buffer = _zip_buffer_new((zip_uint8_t *)data, len)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
- return NULL;
+ return false;
}
ef_head = ef = NULL;
- while (_zip_buffer_ok(buffer) && !_zip_buffer_eof(buffer)) {
+ while (_zip_buffer_ok(buffer) && _zip_buffer_left(buffer) >= 4) {
zip_uint16_t fid, flen;
zip_uint8_t *ef_data;
ef_data = _zip_buffer_get(buffer, flen);
if (ef_data == NULL) {
- break;
+ zip_error_set(error, ZIP_ER_INCONS, 0);
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef_head);
+ return false;
}
if ((ef2=_zip_ef_new(fid, flen, ef_data, flags)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
_zip_buffer_free(buffer);
_zip_ef_free(ef_head);
- return NULL;
+ return false;
}
if (ef_head) {
}
if (!_zip_buffer_eof(buffer)) {
- zip_error_set(error, ZIP_ER_INCONS, 0);
- _zip_buffer_free(buffer);
- _zip_ef_free(ef_head);
- return NULL;
+ /* Android APK files align stored file data with padding in extra fields; ignore. */
+ /* see https://android.googlesource.com/platform/build/+/master/tools/zipalign/ZipAlign.cpp */
+ size_t glen = _zip_buffer_left(buffer);
+ zip_uint8_t *garbage;
+ garbage = _zip_buffer_get(buffer, glen);
+ if (glen >= 4 || garbage == NULL || memcmp(garbage, "\0\0\0", glen) != 0) {
+ zip_error_set(error, ZIP_ER_INCONS, 0);
+ _zip_buffer_free(buffer);
+ _zip_ef_free(ef_head);
+ return false;
+ }
}
_zip_buffer_free(buffer);
+
+ if (ef_head_p) {
+ *ef_head_p = ef_head;
+ }
+ else {
+ _zip_ef_free(ef_head);
+ }
- return ef_head;
+ return true;
}
if (ef_raw == NULL)
return -1;
- if ((ef=_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &za->error)) == NULL) {
+ if (!_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &ef, &za->error)) {
free(ef_raw);
return -1;
}
free(ef_raw);
-
- ef = _zip_ef_remove_internal(ef);
- e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef);
+
+ if (ef) {
+ ef = _zip_ef_remove_internal(ef);
+ e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef);
+ }
}
e->orig->local_extra_fields_read = 1;
#include "zipint.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
ZIP_EXTERN zip_t *
/*
zip_file_get_offset.c -- get offset of file data in archive.
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
/*
zip_filerange_crc.c -- compute CRC32 for a range of a file
- Copyright (C) 2008-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 2008-2015 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>
#include <stdio.h>
-#include <errno.h>
#include "zipint.h"
/*
zip_fopen_index.c -- open file in zip archive for reading by index
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
*/
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
/*
zip_fopen_index_encrypted.c -- open file for reading by index w/ password
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
*/
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
--- /dev/null
+/*
+ zip_hash.c -- hash table string -> uint64
+ Copyright (C) 2015-2016 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 zip_hash_entry {
+ const zip_uint8_t *name;
+ zip_int64_t orig_index;
+ zip_int64_t current_index;
+ struct zip_hash_entry *next;
+};
+typedef struct zip_hash_entry zip_hash_entry_t;
+
+struct zip_hash {
+ zip_uint16_t table_size;
+ zip_hash_entry_t **table;
+};
+
+zip_hash_t *
+_zip_hash_new(zip_uint16_t table_size, zip_error_t *error)
+{
+ zip_hash_t *hash;
+
+ if (table_size == 0) {
+ zip_error_set(error, ZIP_ER_INTERNAL, 0);
+ return NULL;
+ }
+
+ if ((hash=(zip_hash_t *)malloc(sizeof(zip_hash_t))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+ hash->table_size = table_size;
+ if ((hash->table=(zip_hash_entry_t**)calloc(table_size, sizeof(zip_hash_entry_t *))) == NULL) {
+ free(hash);
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return NULL;
+ }
+
+ return hash;
+}
+
+static void
+_free_list(zip_hash_entry_t *entry)
+{
+ zip_hash_entry_t *next;
+ do {
+ next = entry->next;
+ free(entry);
+ entry = next;
+ } while (entry != NULL);
+}
+
+void
+_zip_hash_free(zip_hash_t *hash)
+{
+ zip_uint16_t i;
+
+ if (hash == NULL) {
+ return;
+ }
+
+ for (i=0; i<hash->table_size; i++) {
+ if (hash->table[i] != NULL) {
+ _free_list(hash->table[i]);
+ }
+ }
+ free(hash->table);
+ free(hash);
+}
+
+static zip_uint16_t
+_hash_string(const zip_uint8_t *name, zip_uint16_t size)
+{
+#define HASH_MULTIPLIER 33
+ zip_uint16_t value = 5381;
+
+ if (name == NULL)
+ return 0;
+
+ while (*name != 0) {
+ value = (zip_uint16_t)(((value * HASH_MULTIPLIER) + (zip_uint8_t)*name) % size);
+ name++;
+ }
+
+ return value;
+}
+
+/* insert into hash, return error on existence or memory issues */
+bool
+_zip_hash_add(zip_hash_t *hash, const zip_uint8_t *name, zip_uint64_t index, zip_flags_t flags, zip_error_t *error)
+{
+ zip_uint16_t hash_value;
+ zip_hash_entry_t *entry;
+
+ if (hash == NULL || name == NULL || index > ZIP_INT64_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return false;
+ }
+
+ hash_value = _hash_string(name, hash->table_size);
+ for (entry = hash->table[hash_value]; entry != NULL; entry = entry->next) {
+ if (strcmp((const char *)name, (const char *)entry->name) == 0) {
+ if (((flags & ZIP_FL_UNCHANGED) && entry->orig_index != -1) || entry->current_index != -1) {
+ zip_error_set(error, ZIP_ER_EXISTS, 0);
+ return false;
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ if (entry == NULL) {
+ if ((entry=(zip_hash_entry_t *)malloc(sizeof(zip_hash_entry_t))) == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ return false;
+ }
+ entry->name = name;
+ entry->next = hash->table[hash_value];
+ hash->table[hash_value] = entry;
+ entry->orig_index = -1;
+ }
+
+ if (flags & ZIP_FL_UNCHANGED) {
+ entry->orig_index = (zip_int64_t)index;
+ }
+ entry->current_index = (zip_int64_t)index;
+
+ return true;
+}
+
+/* remove entry from hash, error if not found */
+bool
+_zip_hash_delete(zip_hash_t *hash, const zip_uint8_t *name, zip_error_t *error)
+{
+ zip_uint16_t hash_value;
+ zip_hash_entry_t *entry, *previous;
+
+ if (hash == NULL || name == NULL) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return false;
+ }
+
+ hash_value = _hash_string(name, hash->table_size);
+ previous = NULL;
+ entry = hash->table[hash_value];
+ while (entry) {
+ if (strcmp((const char *)name, (const char *)entry->name) == 0) {
+ if (entry->orig_index == -1) {
+ if (previous) {
+ previous->next = entry->next;
+ }
+ else {
+ hash->table[hash_value] = entry->next;
+ }
+ free(entry);
+ }
+ else {
+ entry->current_index = -1;
+ }
+ return true;
+ }
+ previous = entry;
+ entry = entry->next;
+ };
+
+ zip_error_set(error, ZIP_ER_NOENT, 0);
+ return false;
+}
+
+/* find value for entry in hash, -1 if not found */
+zip_int64_t
+_zip_hash_lookup(zip_hash_t *hash, const zip_uint8_t *name, zip_flags_t flags, zip_error_t *error)
+{
+ zip_uint16_t hash_value;
+ zip_hash_entry_t *entry;
+
+ if (hash == NULL || name == NULL) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
+ hash_value = _hash_string(name, hash->table_size);
+ for (entry = hash->table[hash_value]; entry != NULL; entry = entry->next) {
+ if (strcmp((const char *)name, (const char *)entry->name) == 0) {
+ if (flags & ZIP_FL_UNCHANGED) {
+ if (entry->orig_index != -1) {
+ return entry->orig_index;
+ }
+ }
+ else {
+ if (entry->current_index != -1) {
+ return entry->current_index;
+ }
+ }
+ break;
+ }
+ }
+
+ zip_error_set(error, ZIP_ER_NOENT, 0);
+ return -1;
+}
+
+void
+_zip_hash_revert(zip_hash_t *hash)
+{
+ zip_uint16_t i;
+ zip_hash_entry_t *entry, *previous;
+
+ for (i = 0; i < hash->table_size; i++) {
+ previous = NULL;
+ entry = hash->table[i];
+ while (entry) {
+ if (entry->orig_index == -1) {
+ zip_hash_entry_t *p;
+ if (previous) {
+ previous->next = entry->next;
+ }
+ else {
+ hash->table[i] = entry->next;
+ }
+ p = entry;
+ entry = entry->next;
+ /* previous does not change */
+ free(p);
+ }
+ else {
+ entry->current_index = entry->orig_index;
+ previous = entry;
+ entry = entry->next;
+ }
+ }
+ }
+}
/*
zip_io_util.c -- I/O helper functions
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
#include <stdlib.h>
#include <string.h>
/*
zip_name_locate.c -- get index by name
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
return -1;
}
- cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
-
- for (i=0; i<za->nentry; i++) {
- fn = _zip_get_name(za, i, flags, error);
-
- /* newly added (partially filled) entry or error */
- if (fn == NULL)
- continue;
-
- if (flags & ZIP_FL_NODIR) {
- p = strrchr(fn, '/');
- if (p)
- fn = p+1;
+ if (flags & (ZIP_FL_NOCASE|ZIP_FL_NODIR|ZIP_FL_ENC_CP437)) {
+ /* can't use hash table */
+ cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
+
+ for (i=0; i<za->nentry; i++) {
+ fn = _zip_get_name(za, i, flags, error);
+
+ /* newly added (partially filled) entry or error */
+ if (fn == NULL)
+ continue;
+
+ if (flags & ZIP_FL_NODIR) {
+ p = strrchr(fn, '/');
+ if (p)
+ fn = p+1;
+ }
+
+ if (cmp(fname, fn) == 0) {
+ _zip_error_clear(error);
+ return (zip_int64_t)i;
+ }
}
- if (cmp(fname, fn) == 0) {
- _zip_error_clear(error);
- return (zip_int64_t)i;
- }
+ zip_error_set(error, ZIP_ER_NOENT, 0);
+ return -1;
+ }
+ else {
+ return _zip_hash_lookup(za->names, (const zip_uint8_t *)fname, flags, error);
}
-
- zip_error_set(error, ZIP_ER_NOENT, 0);
- return -1;
}
/*
zip_new.c -- create and init struct zip
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
return NULL;
}
+ if ((za->names = _zip_hash_new(ZIP_HASH_TABLE_SIZE, error)) == NULL) {
+ free(za);
+ return NULL;
+ }
+
za->src = NULL;
za->open_flags = 0;
zip_error_init(&za->error);
#include <sys/stat.h>
-#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
zip_t *za;
zip_cdir_t *cdir;
struct zip_stat st;
- zip_uint64_t len;
+ zip_uint64_t len, idx;
zip_stat_init(&st);
if (zip_source_stat(src, &st) < 0) {
za->nentry = cdir->nentry;
za->nentry_alloc = cdir->nentry_alloc;
za->comment_orig = cdir->comment;
-
- za->ch_flags = za->flags;
free(cdir);
+ for (idx = 0; idx < za->nentry; idx++) {
+ const zip_uint8_t *name = _zip_string_get(za->entry[idx].orig->filename, NULL, 0, error);
+ if (name == NULL) {
+ /* keep src so discard does not get rid of it */
+ zip_source_keep(src);
+ zip_discard(za);
+ return NULL;
+ }
+
+ if (_zip_hash_add(za->names, name, idx, ZIP_FL_UNCHANGED, &za->error) == false) {
+ if (za->error.zip_err != ZIP_ER_EXISTS || (flags & ZIP_CHECKCONS)) {
+ _zip_error_copy(error, &za->error);
+ /* keep src so discard does not get rid of it */
+ zip_source_keep(src);
+ zip_discard(za);
+ return NULL;
+ }
+ }
+ }
+
+ za->ch_flags = za->flags;
+
return za;
}
if (za == NULL)
return -1;
- if (za->default_password)
- free(za->default_password);
+ free(za->default_password);
if (passwd) {
if ((za->default_password=strdup(passwd)) == NULL) {
/*
zip_set_name.c -- rename helper function
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
{
zip_entry_t *e;
zip_string_t *str;
- int changed;
+ bool same_as_orig;
zip_int64_t i;
+ const zip_uint8_t *old_name, *new_name;
+ zip_string_t *old_str;
if (idx >= za->nentry) {
zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
- if (name && strlen(name) > 0) {
+ if (name && name[0] != '\0') {
/* TODO: check for string too long */
if ((str=_zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL)
return -1;
e = za->entry+idx;
- if (e->changes) {
- _zip_string_free(e->changes->filename);
- e->changes->filename = NULL;
- e->changes->changed &= ~ZIP_DIRENT_FILENAME;
- }
-
if (e->orig)
- changed = !_zip_string_equal(e->orig->filename, str);
+ same_as_orig = _zip_string_equal(e->orig->filename, str);
else
- changed = 1;
-
- if (changed) {
- if (e->changes == NULL) {
- if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- _zip_string_free(str);
- return -1;
- }
- }
- e->changes->filename = str;
- e->changes->changed |= ZIP_DIRENT_FILENAME;
+ same_as_orig = false;
+
+ if (!same_as_orig && e->changes == NULL) {
+ if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ _zip_string_free(str);
+ return -1;
+ }
+ }
+
+ if ((new_name = _zip_string_get(same_as_orig ? e->orig->filename : str, NULL, 0, &za->error)) == NULL) {
+ _zip_string_free(str);
+ return -1;
+ }
+
+ if (e->changes) {
+ old_str = e->changes->filename;
+ }
+ else if (e->orig) {
+ old_str = e->orig->filename;
}
else {
+ old_str = NULL;
+ }
+
+ if (old_str) {
+ if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) {
+ _zip_string_free(str);
+ return -1;
+ }
+ }
+ else {
+ old_name = NULL;
+ }
+
+ if (_zip_hash_add(za->names, new_name, idx, 0, &za->error) == false) {
+ _zip_string_free(str);
+ return -1;
+ }
+ if (old_name) {
+ _zip_hash_delete(za->names, old_name, NULL);
+ }
+
+ if (same_as_orig) {
+ if (e->changes) {
+ if (e->changes->changed & ZIP_DIRENT_FILENAME) {
+ _zip_string_free(e->changes->filename);
+ e->changes->changed &= ~ZIP_DIRENT_FILENAME;
+ if (e->changes->changed == 0) {
+ _zip_dirent_free(e->changes);
+ e->changes = NULL;
+ }
+ else {
+ /* TODO: what if not cloned? can that happen? */
+ e->changes->filename = e->orig->filename;
+ }
+ }
+ }
_zip_string_free(str);
- if (e->changes && e->changes->changed == 0) {
- _zip_dirent_free(e->changes);
- e->changes = NULL;
+ }
+ else {
+ if (e->changes->changed & ZIP_DIRENT_FILENAME) {
+ _zip_string_free(e->changes->filename);
}
+ e->changes->changed |= ZIP_DIRENT_FILENAME;
+ e->changes->filename = str;
}
return 0;
/*
zip_source_buffer.c -- create zip data source from buffer
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2016 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>
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
#include <stdlib.h>
#include <string.h>
buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip_error_t *error)
{
zip_uint64_t n, i, fragment_offset;
+ zip_uint8_t **fragments;
if (buffer->offset + length + buffer->fragment_size - 1 < length) {
zip_error_set(error, ZIP_ER_INVAL, 0);
new_capacity *= 2;
}
- zip_uint8_t **fragments = realloc(buffer->fragments, new_capacity * sizeof(*fragments));
+ fragments = realloc(buffer->fragments, new_capacity * sizeof(*fragments));
if (fragments == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
/*
zip_source_crc.c -- pass-through source that calculates CRC32 and size
- Copyright (C) 2009-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2016 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>
#include "zipint.h"
struct crc_context {
- int eof;
- int validate;
+ int validate; /* whether to check CRC on EOF and return error on mismatch */
+ int crc_complete; /* whether CRC was computed for complete file */
zip_error_t error;
zip_uint64_t size;
+ zip_uint64_t position; /* current reading position */
+ zip_uint64_t crc_position; /* how far we've computed the CRC */
zip_uint32_t crc;
};
return NULL;
}
- ctx->eof = 0;
- ctx->validate = validate;
zip_error_init(&ctx->error);
+ ctx->validate = validate;
+ ctx->crc_complete = 0;
+ ctx->crc_position = 0;
+ ctx->crc = (zip_uint32_t)crc32(0, NULL, 0);
ctx->size = 0;
- ctx->crc = 0;
-
+
return zip_source_layered(za, src, crc_read, ctx);
}
switch (cmd) {
case ZIP_SOURCE_OPEN:
- ctx->eof = 0;
- ctx->crc = (zip_uint32_t)crc32(0, NULL, 0);
- ctx->size = 0;
-
+ ctx->position = 0;
return 0;
case ZIP_SOURCE_READ:
- if (ctx->eof || len == 0)
- return 0;
-
- if ((n=zip_source_read(src, data, len)) < 0) {
+ if ((n = zip_source_read(src, data, len)) < 0) {
_zip_error_set_from_source(&ctx->error, src);
return -1;
}
if (n == 0) {
- ctx->eof = 1;
- if (ctx->validate) {
- struct zip_stat st;
+ if (ctx->crc_position == ctx->position) {
+ ctx->crc_complete = 1;
+ ctx->size = ctx->position;
+
+ if (ctx->validate) {
+ struct zip_stat st;
- if (zip_source_stat(src, &st) < 0) {
- _zip_error_set_from_source(&ctx->error, src);
- return -1;
- }
+ if (zip_source_stat(src, &st) < 0) {
+ _zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
- if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) {
- zip_error_set(&ctx->error, ZIP_ER_CRC, 0);
- return -1;
- }
- if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) {
- zip_error_set(&ctx->error, ZIP_ER_INCONS, 0);
- return -1;
+ if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) {
+ zip_error_set(&ctx->error, ZIP_ER_CRC, 0);
+ return -1;
+ }
+ if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) {
+ zip_error_set(&ctx->error, ZIP_ER_INCONS, 0);
+ return -1;
+ }
}
}
}
- else {
+ else if (!ctx->crc_complete && ctx->position <= ctx->crc_position) {
zip_uint64_t i, nn;
- for (i=0; i < (zip_uint64_t)n; i += nn) {
+ for (i = ctx->crc_position - ctx->position; i < (zip_uint64_t)n; i += nn) {
nn = ZIP_MIN(UINT_MAX, (zip_uint64_t)n-i);
ctx->crc = (zip_uint32_t)crc32(ctx->crc, (const Bytef *)data+i, (uInt)nn);
+ ctx->crc_position += nn;
}
- ctx->size += (zip_uint64_t)n;
}
+ ctx->position += (zip_uint64_t)n;
return n;
case ZIP_SOURCE_CLOSE:
st = (zip_stat_t *)data;
- if (ctx->eof) {
+ if (ctx->crc_complete) {
/* TODO: Set comp_size, comp_method, encryption_method?
After all, this only works for uncompressed data. */
st->size = ctx->size;
return 0;
case ZIP_SOURCE_SUPPORTS:
- return zip_source_make_command_bitmap(ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_CLOSE, ZIP_SOURCE_STAT, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, -1);
+ {
+ zip_int64_t mask = zip_source_supports(src);
+
+ if (mask < 0) {
+ _zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ return mask & ~zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_REMOVE, -1);
+ }
+
+ case ZIP_SOURCE_SEEK:
+ {
+ zip_int64_t new_position;
+ zip_source_args_seek_t *args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error);
+
+ if (args == NULL) {
+ return -1;
+ }
+ if (zip_source_seek(src, args->offset, args->whence) < 0 || (new_position = zip_source_tell(src)) < 0) {
+ _zip_error_set_from_source(&ctx->error, src);
+ return -1;
+ }
+
+ ctx->position = (zip_uint64_t)new_position;
+
+ return 0;
+ }
+
+ case ZIP_SOURCE_TELL:
+ return (zip_int64_t)ctx->position;
default:
zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
*/
-#include <errno.h>
#include <stdio.h>
#include "zipint.h"
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-#include "zipint.h"
-
#include <sys/stat.h>
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "zipint.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef _WIN32
/* WIN32 needs <fcntl.h> for _O_BINARY */
#include <fcntl.h>
#ifndef S_ISREG
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
-#ifndef S_IRWXG
-#define S_IRWXG (S_IRWXU >> 3)
-#endif
-#ifndef S_IRWXO
-#define S_IRWXO (S_IRWXG >> 3)
+#if defined(S_IXUSR) && defined(S_IRWXG) && defined(S_IRWXO)
+#define _SAFE_MASK (S_IXUSR | S_IRWXG | S_IRWXO)
+#elif defined(_S_IWRITE)
+#define _SAFE_MASK (_S_IWRITE)
+#else
+#error do not know safe values for umask, please report this
#endif
#ifdef _MSC_VER
}
sprintf(temp, "%s.XXXXXX", ctx->fname);
- mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
+ mask = umask(_SAFE_MASK);
if ((tfd=mkstemp(temp)) == -1) {
zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
umask(mask);
/*
zip_source_pkware.c -- Traditional PKWARE de/encryption routines
- Copyright (C) 2009-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2015 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>
if (!update_only) {
/* decrypt next byte */
tmp = (zip_uint16_t)(ctx->key[2] | 2);
- tmp = (zip_uint16_t)((tmp * (tmp ^ 1)) >> 8);
+ tmp = (zip_uint16_t)(((zip_uint32_t)tmp * (tmp ^ 1)) >> 8);
b ^= (Bytef)tmp;
}
/*
zip_source_stat.c -- get meta information from zip_source
- Copyright (C) 2009-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 2009-2015 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>
#include "zipint.h"
-int
+ZIP_EXTERN int
zip_source_stat(zip_source_t *src, zip_stat_t *st)
{
if (src->source_closed) {
/*
zip_source_supports.c -- check for supported functions
- Copyright (C) 2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 2014-2015 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>
}
-zip_int64_t
+ZIP_EXTERN zip_int64_t
zip_source_make_command_bitmap(zip_source_cmd_t cmd0, ...)
{
zip_int64_t bitmap;
/*
zip_source_win32a.c -- create data source from Windows file (ANSI)
-Copyright (C) 1999-2015 Dieter Baron and Thomas Klausner
+Copyright (C) 1999-2016 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>
*/
-#include <errno.h>
#include <stdio.h>
#include "zipint.h"
static int _win32_remove_a(const void *fname);
static _zip_source_win32_file_ops_t win32_ops_a = {
- .op_strdup = _win32_strdup_a,
- .op_open = _win32_open_a,
- .op_create_temp = _win32_create_temp_a,
- .op_rename_temp = _win32_rename_temp_a,
- .op_remove = _win32_remove_a
+ _win32_strdup_a,
+ _win32_open_a,
+ _win32_create_temp_a,
+ _win32_rename_temp_a,
+ _win32_remove_a
};
ZIP_EXTERN zip_source_t *
/*
zip_source_win32file.c -- create data source from HANDLE (Win32)
-Copyright (C) 1999-2015 Dieter Baron and Thomas Klausner
+Copyright (C) 1999-2016 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>
#include <wchar.h>
-#include <errno.h>
#include <stdlib.h>
#include <string.h>
static int
_win32_create_temp_file(_zip_source_win32_read_file_t *ctx)
{
+ zip_uint32_t value;
/*
Windows has GetTempFileName(), but it closes the file after
creation, leaving it open to a horrible race condition. So
}
}
- zip_uint32_t value = GetTickCount();
+ value = GetTickCount();
for (i = 0; i < 1024 && th == INVALID_HANDLE_VALUE; i++) {
th = ctx->ops->op_create_temp(ctx, &temp, value + i, psa);
if (th == INVALID_HANDLE_VALUE && GetLastError() != ERROR_FILE_EXISTS)
*/
-#include <errno.h>
#include <stdio.h>
#include "zipint.h"
/*
zip_source_win32w.c -- create data source from Windows file (UTF-16)
-Copyright (C) 1999-2015 Dieter Baron and Thomas Klausner
+Copyright (C) 1999-2016 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>
*/
-#include <errno.h>
#include <stdio.h>
#include "zipint.h"
static int _win32_remove_w(const void *fname);
static _zip_source_win32_file_ops_t win32_ops_w = {
- .op_strdup = _win32_strdup_w,
- .op_open = _win32_open_w,
- .op_create_temp = _win32_create_temp_w,
- .op_rename_temp = _win32_rename_temp_w,
- .op_remove = _win32_remove_w
+ _win32_strdup_w,
+ _win32_open_w,
+ _win32_create_temp_w,
+ _win32_rename_temp_w,
+ _win32_remove_w
};
ZIP_EXTERN zip_source_t *
return INVALID_HANDLE_VALUE;
}
}
- if (swprintf((wchar_t *)*temp, len, L"%s.%08x", (const wchar_t *)ctx->fname, value) != len - 1) {
+ if (_snwprintf((wchar_t *)*temp, len, L"%s.%08x", (const wchar_t *)ctx->fname, value) != len - 1) {
return INVALID_HANDLE_VALUE;
}
/*
zip_unchange.c -- undo changes to file in zip archive
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
_zip_unchange(zip_t *za, zip_uint64_t idx, int allow_duplicates)
{
zip_int64_t i;
+ const char *orig_name, *changed_name;
if (idx >= za->nentry) {
zip_error_set(&za->error, ZIP_ER_INVAL, 0);
}
if (!allow_duplicates && za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_FILENAME)) {
- i = _zip_name_locate(za, _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL), 0, NULL);
- if (i >= 0 && (zip_uint64_t)i != idx) {
- zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
+ if (za->entry[idx].orig != NULL) {
+ if ((orig_name=_zip_get_name(za, idx, ZIP_FL_UNCHANGED, &za->error)) == NULL) {
+ return -1;
+ }
+
+ i = _zip_name_locate(za, orig_name, 0, NULL);
+ if (i >= 0 && (zip_uint64_t)i != idx) {
+ zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
+ return -1;
+ }
+ }
+ else {
+ orig_name = NULL;
+ }
+
+ if ((changed_name=_zip_get_name(za, idx, 0, &za->error)) == NULL) {
+ return -1;
+ }
+
+ if (orig_name) {
+ if (_zip_hash_add(za->names, (const zip_uint8_t *)orig_name, idx, 0, &za->error) == false) {
+ return -1;
+ }
+ }
+ if (_zip_hash_delete(za->names, (const zip_uint8_t *)changed_name, &za->error) == false) {
+ _zip_hash_delete(za->names, (const zip_uint8_t *)orig_name, NULL);
return -1;
}
}
/*
zip_unchange.c -- undo changes to all files in zip archive
- Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2015 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>
int ret;
zip_uint64_t i;
+ _zip_hash_revert(za->names);
+
ret = 0;
for (i=0; i<za->nentry; i++)
ret |= _zip_unchange(za, i, 1);
/*
zipint.h -- internal declarations.
- Copyright (C) 1999-2015 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2016 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>
#define false 0
#endif
+#include <errno.h>
+
+/* at least MinGW does not provide EOPNOTSUPP, see
+ * http://sourceforge.net/p/mingw/bugs/263/
+ */
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP EINVAL
+#endif
+
+/* at least MinGW does not provide EOVERFLOW, see
+ * http://sourceforge.net/p/mingw/bugs/242/
+ */
+#ifndef EOVERFLOW
+#define EOVERFLOW EFBIG
+#endif
+
#ifdef _WIN32
#if defined(HAVE__CLOSE)
#define close _close
#if defined(HAVE__FDOPEN)
#define fdopen _fdopen
#endif
-#if defined(HAVE__FILENO)
+#if !defined(HAVE_FILENO) && defined(HAVE__FILENO)
#define fileno _fileno
#endif
/* Windows' open() doesn't understand Unix permissions */
#define strdup _strdup
#endif
#endif
+#if !defined(HAVE__SETMODE) && defined(HAVE_SETMODE)
+#define _setmode setmode
+#endif
#endif
#ifndef HAVE_FSEEKO
#if !defined(HAVE_STRCASECMP)
#if defined(HAVE__STRICMP)
#define strcasecmp _stricmp
+#elif defined(HAVE_STRICMP)
+#define strcasecmp stricmp
#endif
#endif
#define ZIP_FSEEK_MAX ZIP_OFF_MAX
#define ZIP_FSEEK_MIN ZIP_OFF_MIN
#else
+#include <limits.h>
#define ZIP_FSEEK_MAX LONG_MAX
#define ZIP_FSEEK_MIN LONG_MIN
#endif
typedef enum zip_encoding_type zip_encoding_type_t;
+#ifndef ZIP_HASH_TABLE_SIZE
+#define ZIP_HASH_TABLE_SIZE 8192
+#endif
+
+struct zip_hash;
+
typedef struct zip_cdir zip_cdir_t;
typedef struct zip_dirent zip_dirent_t;
typedef struct zip_entry zip_entry_t;
typedef struct zip_extra_field zip_extra_field_t;
typedef struct zip_string zip_string_t;
typedef struct zip_buffer zip_buffer_t;
-
+typedef struct zip_hash zip_hash_t;
/* zip archive, part of API */
char *default_password; /* password used when no other supplied */
zip_string_t *comment_orig; /* archive comment */
- zip_string_t *comment_changes; /* changed archive comment */
+ zip_string_t *comment_changes; /* changed archive comment */
bool comment_changed; /* whether archive comment was changed */
zip_uint64_t nentry; /* number of entries */
unsigned int nopen_source; /* number of open sources using archive */
unsigned int nopen_source_alloc; /* number of sources allocated */
zip_source_t **open_source; /* open sources using archive */
+
+ zip_hash_t *names; /* hash table for name lookup */
char *tempdir; /* custom temp dir (needed e.g. for OS X sandboxing) */
};
struct zip_dirent {
zip_uint32_t changed;
bool local_extra_fields_read; /* whether we already read in local header extra fields */
- bool cloned; /* whether this instance is cloned, and thus shares non-changed strings */
+ bool cloned; /* whether this instance is cloned, and thus shares non-changed strings */
zip_uint16_t version_madeby; /* (c) version of creator */
zip_uint16_t version_needed; /* (cl) version needed to extract */
struct zip_filelist {
zip_uint64_t idx;
-// TODO const char *name;
+/* TODO const char *name; */
};
typedef struct zip_filelist zip_filelist_t;
int _zip_buffer_put_32(zip_buffer_t *buffer, zip_uint32_t i);
int _zip_buffer_put_64(zip_buffer_t *buffer, zip_uint64_t i);
int _zip_buffer_put_8(zip_buffer_t *buffer, zip_uint8_t i);
+int _zip_buffer_skip(zip_buffer_t *buffer, zip_uint64_t length);
int _zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset);
zip_uint64_t _zip_buffer_size(zip_buffer_t *buffer);
const zip_uint8_t *_zip_ef_get_by_id(const zip_extra_field_t *, zip_uint16_t *, zip_uint16_t, zip_uint16_t, zip_flags_t, zip_error_t *);
zip_extra_field_t *_zip_ef_merge(zip_extra_field_t *, zip_extra_field_t *);
zip_extra_field_t *_zip_ef_new(zip_uint16_t, zip_uint16_t, const zip_uint8_t *, zip_flags_t);
-zip_extra_field_t *_zip_ef_parse(const zip_uint8_t *, zip_uint16_t, zip_flags_t, zip_error_t *);
+bool _zip_ef_parse(const zip_uint8_t *, zip_uint16_t, zip_flags_t, zip_extra_field_t **, zip_error_t *);
zip_extra_field_t *_zip_ef_remove_internal(zip_extra_field_t *);
zip_uint16_t _zip_ef_size(const zip_extra_field_t *, zip_flags_t);
int _zip_ef_write(zip_t *za, const zip_extra_field_t *ef, zip_flags_t flags);
enum zip_encoding_type _zip_guess_encoding(zip_string_t *, enum zip_encoding_type);
zip_uint8_t *_zip_cp437_to_utf8(const zip_uint8_t * const, zip_uint32_t, zip_uint32_t *, zip_error_t *);
+bool _zip_hash_add(zip_hash_t *hash, const zip_uint8_t *name, zip_uint64_t index, zip_flags_t flags, zip_error_t *error);
+bool _zip_hash_delete(zip_hash_t *hash, const zip_uint8_t *key, zip_error_t *error);
+void _zip_hash_free(zip_hash_t *hash);
+zip_int64_t _zip_hash_lookup(zip_hash_t *hash, const zip_uint8_t *name, zip_flags_t flags, zip_error_t *error);
+zip_hash_t *_zip_hash_new(zip_uint16_t hash_size, zip_error_t *error);
+void _zip_hash_revert(zip_hash_t *hash);
+
zip_t *_zip_open(zip_source_t *, unsigned int, zip_error_t *);
int _zip_read(zip_source_t *src, zip_uint8_t *data, zip_uint64_t length, zip_error_t *error);
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/* 0x0501 => Windows XP; needs to be at least this value because of GetFileSizeEx */
+#define _WIN32_WINNT 0x0501
#include <windows.h>
/* context for Win32 source */
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
- if test "$installed" = no && test "$need_relink" = yes; then
+ if test "$installed" = no && test "$need_relink" = yes && \
+ test -n "$relink_command"; then
$ECHO >> $output "\
relink_command=\"$relink_command\""
fi
SET(MDOC1_PAGES
zipcmp.mdoc
zipmerge.mdoc
+ ziptool.mdoc
)
SET(MDOC_PAGES ${MDOC1_PAGES} ${MDOC3_PAGES})
STRING(REGEX REPLACE .mdoc "" MAN1_PAGES "${MDOC1_PAGES}")
DISTCLEANFILES=${HTML}
EXTRA_DIST=${MANDOC} ${MAN} CMakeLists.txt handle_links links
-MAN1= zipcmp.mdoc zipmerge.mdoc
+MAN1= zipcmp.mdoc zipmerge.mdoc ziptool.mdoc
MAN3= \
ZIP_SOURCE_GET_ARGS.mdoc \
libzip.mdoc \
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@SET_MAKE@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
build_triplet = @build@
host_triplet = @host@
subdir = man
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
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/visibility.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
NROFF = nroff
MANS = $(man1_MANS) $(man3_MANS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
man3_MANS = ${MAN3:.mdoc=.${MANFMT}}
DISTCLEANFILES = ${HTML}
EXTRA_DIST = ${MANDOC} ${MAN} CMakeLists.txt handle_links links
-MAN1 = zipcmp.mdoc zipmerge.mdoc
+MAN1 = zipcmp.mdoc zipmerge.mdoc ziptool.mdoc
MAN3 = \
ZIP_SOURCE_GET_ARGS.mdoc \
libzip.mdoc \
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*) \
tags-am uninstall uninstall-am uninstall-hook uninstall-man \
uninstall-man1 uninstall-man3
+.PRECIOUS: Makefile
+
install-data-hook: link-man3
.TH "ZIP_SOURCE_GET_ARGS" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBZIP_SOURCE_GET_ARGS\fP
+\fBZIP_SOURCE_GET_ARGS\fR
\- validate and cast arguments to source callback
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-type *
-ZIP_SOURCE_GET_ARGS type void *data zip_uint64_t len zip_error_t *error
+\fB#include <zip.h>\fR
+.sp
+\fItype *\fR
+.PD 0
+.HP 4n
+\fBZIP_SOURCE_GET_ARGS\fR(\fItype\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The
-ZIP_SOURCE_GET_ARGS
+\fBZIP_SOURCE_GET_ARGS\fR()
macro casts
-\fIdata\fP
+\fIdata\fR
to a pointer to
-\fItype\fP.
+\fItype\fR.
.SH "RETURN VALUES"
On success,
-ZIP_SOURCE_GET_ARGS
+\fBZIP_SOURCE_GET_ARGS\fR()
returns
-\fIdata\fP.
+\fIdata\fR.
In case of error, it returns
-\fRNULL\fP
+\fRNULL\fR
and sets
-\fIerror\fP.
+\fIerror\fR.
.SH "ERRORS"
-ZIP_SOURCE_GET_ARGS
+\fBZIP_SOURCE_GET_ARGS\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIlen\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIlen\fR
is less than the size of
-\fItype\fP
+\fItype\fR
.SH "SEE ALSO"
libzip(3),
zip_source_function(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
-.TH "LIBZIP" "3" "August 2, 2014" "NiH" "Library Functions Manual"
+.TH "LIBZIP" "3" "January 19, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBlibzip\fP
+\fBlibzip\fR
\- library for manipulating zip archives
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
+\fB#include <zip.h>\fR
.SH "DESCRIPTION"
-\fBlibzip\fP
+\fBlibzip\fR
is a library for reading, creating, and modifying zip archives.
.PP
+The main design criteria for
+\fBlibzip\fR
+were:
+.PD 0
+.TP 4n
+\fB\(bu\fR
+Do not create corrupt files, even in case of errors.
+.TP 4n
+\fB\(bu\fR
+Do not delete data.
+.TP 4n
+\fB\(bu\fR
+Be efficient.
+.PD
+.PP
+For this reason, when modifying zip archives,
+\fBlibzip\fR
+writes to a temporary file and replaces the original
+zip archive atomically.
+.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"
zip_error_get_sys_type(3)
zip_errors(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" libzip.mdoc -- general overview of available functions
-.\" Copyright (C) 2005-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2005-2016 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>
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd August 2, 2014
+.Dd January 19, 2016
.Dt LIBZIP 3
.Os
.Sh NAME
.Nm
is a library for reading, creating, and modifying zip archives.
.Pp
+The main design criteria for
+.Nm
+were:
+.Bl -bullet -compact
+.It
+Do not create corrupt files, even in case of errors.
+.It
+Do not delete data.
+.It
+Be efficient.
+.El
+.Pp
+For this reason, when modifying zip archives,
+.Nm
+writes to a temporary file and replaces the original
+zip archive atomically.
+.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
.TH "ZIP_ADD" "3" "October 6, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_add\fP,
-\fBzip_replace\fP
+\fBzip_add\fR,
+\fBzip_replace\fR
\- add file to zip archive or replace file in zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_add zip_t *archive const char *name zip_source_t *source
-int
-zip_replace zip_t *archive zip_uint64_t index zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_source_t\ *source\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_replace\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_add
+\fBzip_add\fR()
is the obsolete version of
zip_file_add(3).
It is the same as calling
zip_file_add(3)
with an empty
-\fIflags\fP
+\fIflags\fR
argument.
Similarly, the
-zip_replace
+\fBzip_replace\fR()
function is the obsolete version of
zip_file_replace(3).
It is the same as calling
zip_file_replace(3)
with an empty
-\fIflags\fP
+\fIflags\fR
argument.
.SH "SEE ALSO"
libzip(3),
zip_file_add(3),
zip_file_replace(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_add.mdoc -- add files to zip archive
-.\" Copyright (C) 2004-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2004-2015 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>
.TH "ZIP_ADD_DIR" "3" "June 23, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_add_dir\fP
+\fBzip_add_dir\fR
\- add directory to zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_add_dir zip_t *archive const char *name
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_add_dir\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_add_dir
+\fBzip_add_dir\fR()
is the obsolete version of
zip_dir_add(3).
It is the same as calling
libzip(3),
zip_dir_add(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_add_dir.mdoc -- add directory to zip archive
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 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>
.TH "ZIP_CLOSE" "3" "February 13, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_close\fP
+\fBzip_close\fR
\- close zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_close zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_close\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_close
+\fBzip_close\fR()
function closes
-\fIarchive\fP
+\fIarchive\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
+\fBzip_close\fR()
fails and
-\fIarchive\fP
+\fIarchive\fR
is left unchanged.
If
-\fIarchive\fP
+\fIarchive\fR
contains no files, the file is completely removed (no empty archive is
written).
.PP
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_close
+\fBzip_close\fR()
will fail if:
-.TP 17n
-[\fRZIP_ER_EOF\fP]
+.TP 19n
+[\fRZIP_ER_EOF\fR]
Unexpected end-of-file found while reading from a file.
-.TP 17n
-[\fRZIP_ER_INTERNAL\fP]
+.TP 19n
+[\fRZIP_ER_INTERNAL\fR]
The callback function of an added or replaced file returned an
error but failed to report which.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
The
-\fIpath\fP
+\fIpath\fR
argument is
-\fRNULL\fP.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+\fRNULL\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_NOZIP\fP]
+.TP 19n
+[\fRZIP_ER_NOZIP\fR]
File is not a zip archive.
-.TP 17n
-[\fRZIP_ER_READ\fP]
+.TP 19n
+[\fRZIP_ER_READ\fR]
A file read failed.
-.TP 17n
-[\fRZIP_ER_RENAME\fP]
+.TP 19n
+[\fRZIP_ER_RENAME\fR]
A temporary file could not be renamed to its final name.
-.TP 17n
-[\fRZIP_ER_SEEK\fP]
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
A file seek failed.
-.TP 17n
-[\fRZIP_ER_TMPOPEN\fP]
+.TP 19n
+[\fRZIP_ER_TMPOPEN\fR]
A temporary file could not be created.
-.TP 17n
-[\fRZIP_ER_WRITE\fP]
+.TP 19n
+[\fRZIP_ER_WRITE\fR]
A file write failed.
-.TP 17n
-[\fRZIP_ER_ZLIB\fP]
+.TP 19n
+[\fRZIP_ER_ZLIB\fR]
An error occurred while (de)compressing a stream with
zlib(3).
+.PD 0
+.PP
Additionally, any errors returned by the callback function
for added or replaced files will be passed back.
+.PD
.SH "SEE ALSO"
libzip(3),
zip_discard(3),
zip_open(3),
zip_strerror(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_close.mdoc -- close zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_DELETE" "3" "March 10, 2009" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_delete\fP
+\fBzip_delete\fR
\- delete file from zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_delete zip_t *archive zip_uint64_t index
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_delete\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR);
+.PD
.SH "DESCRIPTION"
The file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive
-\fIarchive\fP
+\fIarchive\fR
is marked as deleted.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_delete
+\fBzip_delete\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_unchange(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_delete.mdoc -- delete files from zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_DIR_ADD" "3" "December 4, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_dir_add\fP
+\fBzip_dir_add\fR
\- add directory to zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_dir_add zip_t *archive const char *name zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_dir_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_dir_add
+\fBzip_dir_add\fR()
adds a directory to a zip archive.
The argument
-\fIarchive\fP
+\fIarchive\fR
specifies the zip archive to which the directory should be added.
-\fIname\fP
+\fIname\fR
is the directory's name in the zip archive.
The
-\fIflags\fP
+\fIflags\fR
argument can be any of:
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
Guess encoding of
-\fIname\fP
+\fIname\fR
(default).
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_UTF_8\fP
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
Interpret
-\fIname\fP
+\fIname\fR
as UTF-8.
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_CP437\fP
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
Interpret
-\fIname\fP
+\fIname\fR
as code page 437 (CP-437).
.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
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_dir_add
+\fBzip_dir_add\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_EXISTS\fP]
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
There is already an entry called
-\fIname\fP
+\fIname\fR
in the archive.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIarchive\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIarchive\fR
or
-\fIname\fP
+\fIname\fR
are
-\fRNULL\fP,
+\fRNULL\fR,
or invalid UTF-8 encoded file names.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_add(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.SH "CAVEATS"
-zip_dir_add
+\fBzip_dir_add\fR()
does not look in the file system, it just creates one entry in the
archive for the provided name.
.TH "ZIP_DISCARD" "3" "February 13, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_discard\fP
+\fBzip_discard\fR
\- close zip archive and discard changes
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_discard zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_discard\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_discard
+\fBzip_discard\fR()
function closes
-\fIarchive\fP
+\fIarchive\fR
and frees the memory allocated for it.
Any changes to the archive are not written to disk and discarded.
.SH "SEE ALSO"
libzip(3),
zip_close(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_discard.mdoc -- close zip archive and discard changes
-.\" Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2012-2015 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>
.TH "ZIP_ERROR_CLEAR" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_clear\fP,
-\fBzip_file_error_clear\fP
+\fBzip_error_clear\fR,
+\fBzip_file_error_clear\fR
\- clear error state for archive or file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_error_clear zip_t *archive
-void
-zip_file_error_clear zip_file_t *file
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_clear\fR(\fIzip_t\ *archive\fR);
+.PD
+.PP
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_file_error_clear\fR(\fIzip_file_t\ *file\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_clear
+\fBzip_error_clear\fR()
function clears the error state for the zip archive
-\fIarchive\fP.
+\fIarchive\fR.
.PP
The
-zip_file_error_clear
+\fBzip_file_error_clear\fR()
function does the same for the zip file
-\fIfile\fP.
+\fIfile\fR.
.SH "SEE ALSO"
libzip(3),
zip_error_get(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_CODE_SYSTEM" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_code_system\fP
+\fBzip_error_code_system\fR
\- get operating system error part of zip_error
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_error_code_system const zip_error_t *ze
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_code_system\fR(\fIconst\ zip_error_t\ *ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_code_system
+\fBzip_error_code_system\fR()
function returns the system specific part of the error from the
zip_error error
-\fIze\fP.
+\fIze\fR.
For finding out what system reported the error, use
zip_error_system_type(3).
.SH "SEE ALSO"
zip_error_code_zip(3),
zip_error_system_type(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_CODE_ZIP" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_code_zip\fP
+\fBzip_error_code_zip\fR
\- get libzip error part of zip_error
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_error_code_zip const zip_error_t *ze
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_code_zip\fR(\fIconst\ zip_error_t\ *ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_code_zip
+\fBzip_error_code_zip\fR()
function returns the libzip specific part of the error from the
zip_error error
-\fIze\fP.
+\fIze\fR.
.SH "SEE ALSO"
libzip(3),
zip_error_code_system(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_FINI" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_fini\fP
+\fBzip_error_fini\fR
\- clean up zip_error structure
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_error_fini zip_error_t *ze
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_fini\fR(\fIzip_error_t\ *ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_fini
+\fBzip_error_fini\fR()
function cleans up and frees internally allocated memory of the
zip_error pointed to by
-\fIze\fP.
+\fIze\fR.
.SH "SEE ALSO"
libzip(3),
zip_error_init(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_GET" "3" "December 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_get\fP,
-\fBzip_file_error_get\fP
+\fBzip_error_get\fR,
+\fBzip_file_error_get\fR
\- get error codes for archive or file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_error_get zip_t *archive int *zep int *sep
-void
-zip_file_error_get zip_file_t *file int *zep int *sep
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_get\fR(\fIzip_t\ *archive\fR, \fIint\ *zep\fR, \fIint\ *sep\fR);
+.PD
+.PP
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_file_error_get\fR(\fIzip_file_t\ *file\fR, \fIint\ *zep\fR, \fIint\ *sep\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_error_get
+\fBzip_error_get\fR()
and
-zip_file_error_get
+\fBzip_file_error_get\fR()
are deprecated.
Use
zip_error_code_system(3),
instead.
.PP
For
-zip_error_get,
+\fBzip_error_get\fR(),
replace
.nf
+.sp
+.RS 6n
int ze, se;
zip_error_get(za, &ze, &se);
+.RE
.fi
with
.nf
+.sp
+.RS 6n
int ze, se;
zip_error_t *error = zip_get_error(za);
ze = zip_error_code_zip(error);
se = zip_error_code_system(error);
+.RE
.fi
For
-zip_file_error_get,
+\fBzip_file_error_get\fR(),
replace
.nf
+.sp
+.RS 6n
int ze, se;
zip_file_error_get(zf, &ze, &se);
+.RE
.fi
with
.nf
+.sp
+.RS 6n
int ze, se;
zip_error_t *error = zip_file_get_error(zf);
ze = zip_error_code_zip(error);
se = zip_error_code_system(error);
+.RE
.fi
.SH "SEE ALSO"
libzip(3),
zip_file_get_error(3),
zip_get_error(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_GET_SYS_TYPE" "3" "December 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_get_sys_type\fP
+\fBzip_error_get_sys_type\fR
\- get type of system error code
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_error_get_sys_type int ze
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_get_sys_type\fR(\fIint\ ze\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_error_get_sys_type
+\fBzip_error_get_sys_type\fR()
is deprecated; use
zip_error_init_with_code(3)
and
.PP
Replace
.nf
+.sp
+.RS 6n
int i = zip_error_get_sys_type(ze);
+.RE
.fi
with
.nf
+.sp
+.RS 6n
zip_error_t error;
zip_error_init_with_code(&error, ze);
int i = zip_error_system_type(&error);
+.RE
.fi
.SH "SEE ALSO"
libzip(3),
zip_error_init_with_code(3),
zip_error_system_type(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_INIT" "3" "December 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_init\fP,
-\fBzip_error_init_with_code\fP
+\fBzip_error_init\fR,
+\fBzip_error_init_with_code\fR
\- initialize zip_error structure
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_error_init zip_error_t *error
-void
-zip_error_init_with_code zip_error_t *error int ze
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_init\fR(\fIzip_error_t\ *error\fR);
+.PD
+.PP
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_init_with_code\fR(\fIzip_error_t\ *error\fR, \fIint\ ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_init
+\fBzip_error_init\fR()
function initializes the zip_error pointed to by
-\fIerror\fP.
-\fI*error\fP
+\fIerror\fR.
+\fI*error\fR
must be allocated before calling
-zip_error_init.
+\fBzip_error_init\fR().
.PP
The
-zip_error_init_with_code
+\fBzip_error_init_with_code\fR()
function does the same, but additionally sets the zip error code to
-\fIze\fP
+\fIze\fR
and sets the system error code to the current
errno(3)
value, if appropriate.
libzip(3),
zip_error_fini(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_SET" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_set\fP
+\fBzip_error_set\fR
\- fill in zip_error structure
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_error_set zip_error_t *ze int le int se
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_set\fR(\fIzip_error_t\ *ze\fR, \fIint\ le\fR, \fIint\ se\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_set
+\fBzip_error_set\fR()
function sets the zip_error pointed to by
-\fIze\fP
+\fIze\fR
to the libzip error code
-\fIle\fP
+\fIle\fR
and the system error code
-\fIse\fP.
+\fIse\fR.
.PP
-\fIze\fP
+\fIze\fR
must be allocated and initialized with
zip_error_fini(3)
before calling
-zip_error set.
+\fBzip_error\fR(\fIset\fR).
.SH "SEE ALSO"
libzip(3),
zip_error_init(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_STRERROR" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_strerror\fP
+\fBzip_error_strerror\fR
\- create human-readable string for zip_error
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_error_strerror zip_error_t *ze
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_error_strerror\fR(\fIzip_error_t\ *ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_strerror
+\fBzip_error_strerror\fR()
function returns an error message string corresponding to
-\fIze\fP
+\fIze\fR
like
strerror(3).
This string will stay valid until the next call to
-zip_error_strerror
+\fBzip_error_strerror\fR()
or until
zip_error_fini(3)
is called.
strerror(3),
zip_error_fini(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_SYSTEM_TYPE" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_system_type\fP
+\fBzip_error_system_type\fR
\- return type of system error
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_error_system_type const zip_error_t *ze
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_system_type\fR(\fIconst\ zip_error_t\ *ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_error_system_type
+\fBzip_error_system_type\fR()
function returns the type of the system specific part for the zip_error
-\fIze\fP.
+\fIze\fR.
Currently, the following system types are defined:
-.TP ZIP_ET_NONE
-\fRZIP_ET_NONE\fP
+.TP 13n
+\fRZIP_ET_NONE\fR
System specific part of
-\fIze\fP
+\fIze\fR
is unused.
-.TP ZIP_ET_NONE
-\fRZIP_ET_SYS\fP
+.TP 13n
+\fRZIP_ET_SYS\fR
System specific part of
-\fIze\fP
+\fIze\fR
is an
errno(2).
-.TP ZIP_ET_NONE
-\fRZIP_ET_ZLIB\fP
-\fIze\fP
+.TP 13n
+\fRZIP_ET_ZLIB\fR
+\fIze\fR
is a
zlib(3)
error.
libzip(3),
zip_error_code_system(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_TO_DATA" "3" "November 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_to_data\fP
+\fBzip_error_to_data\fR
\- convert zip_error to return value suitable for ZIP_SOURCE_ERROR
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_error_to_data const zip_error_t *ze void *data zip_uint64_t len
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_error_to_data\fR(\fIconst\ zip_error_t\ *ze\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR);
+.PD
.SH "DESCRIPTION"
-zip_error_to_data
+\fBzip_error_to_data\fR()
function converts the zip_error
-\fIze\fP
+\fIze\fR
into data suitable as return value for
-\fRZIP_SOURCE_ERROR\fP.
+\fRZIP_SOURCE_ERROR\fR.
The data is written into the buffer
-\fIdata\fP
+\fIdata\fR
of size
-\fIlen\fP.
+\fIlen\fR.
If the buffer is not large enough to hold 2 ints, an error is
returned.
.SH "RETURN VALUES"
-zip_error_to_data
+\fBzip_error_to_data\fR()
returns 2*(sizeof int) on success, and \-1 on error.
.SH "SEE ALSO"
libzip(3),
zip_source_function(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERROR_TO_STR" "3" "December 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_error_to_str\fP
+\fBzip_error_to_str\fR
\- get string representation of zip error
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_error_to_str char *buf zip_uint64_t len int ze int se
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_to_str\fR(\fIchar\ *buf\fR, \fIzip_uint64_t\ len\fR, \fIint\ ze\fR, \fIint\ se\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_error_to_str
+\fBzip_error_to_str\fR()
is deprecated; use
zip_error_init_with_code(3)
and
.PP
Replace
.nf
+.sp
+.RS 6n
char buf[BUFSIZE];
zip_error_to_str(buf, sizeof(buf), ze, se);
printf("%s", buf);
+.RE
.fi
with
.nf
+.sp
+.RS 6n
zip_error_t error;
zip_error_init_with_code(&error, ze);
printf("%s", zip_error_strerror(&error));
zip_error_fini(&error);
+.RE
.fi
.SH "SEE ALSO"
libzip(3),
zip_error_init_with_code(3),
zip_error_strerror(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_ERRORS" "3" "March 10, 2009" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_errors\fP
+\fBzip_errors\fR
\- list of all libzip error codes
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
+\fB#include <zip.h>\fR
.SH "DESCRIPTION"
The following error codes are used by libzip:
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_OK\fP]
+.TP 23n
+[\fRZIP_ER_OK\fR]
No error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_MULTIDISK\fP]
+.TP 23n
+[\fRZIP_ER_MULTIDISK\fR]
Multi-disk zip archives not supported.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_RENAME\fP]
+.TP 23n
+[\fRZIP_ER_RENAME\fR]
Renaming temporary file failed.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_CLOSE\fP]
+.TP 23n
+[\fRZIP_ER_CLOSE\fR]
Closing zip archive failed.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_SEEK\fP]
+.TP 23n
+[\fRZIP_ER_SEEK\fR]
Seek error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_READ\fP]
+.TP 23n
+[\fRZIP_ER_READ\fR]
Read error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_WRITE\fP]
+.TP 23n
+[\fRZIP_ER_WRITE\fR]
Write error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_CRC\fP]
+.TP 23n
+[\fRZIP_ER_CRC\fR]
CRC error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_ZIPCLOSED\fP]
+.TP 23n
+[\fRZIP_ER_ZIPCLOSED\fR]
Containing zip archive was closed.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_NOENT\fP]
+.TP 23n
+[\fRZIP_ER_NOENT\fR]
No such file.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_EXISTS\fP]
+.TP 23n
+[\fRZIP_ER_EXISTS\fR]
File already exists.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_OPEN\fP]
+.TP 23n
+[\fRZIP_ER_OPEN\fR]
Can't open file.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_TMPOPEN\fP]
+.TP 23n
+[\fRZIP_ER_TMPOPEN\fR]
Failure to create temporary file.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_ZLIB\fP]
+.TP 23n
+[\fRZIP_ER_ZLIB\fR]
Zlib error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_MEMORY\fP]
+.TP 23n
+[\fRZIP_ER_MEMORY\fR]
Malloc failure.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_CHANGED\fP]
+.TP 23n
+[\fRZIP_ER_CHANGED\fR]
Entry has been changed.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_COMPNOTSUPP\fP]
+.TP 23n
+[\fRZIP_ER_COMPNOTSUPP\fR]
Compression method not supported.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_EOF\fP]
+.TP 23n
+[\fRZIP_ER_EOF\fR]
Premature EOF.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_INVAL\fP]
+.TP 23n
+[\fRZIP_ER_INVAL\fR]
Invalid argument.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_NOZIP\fP]
+.TP 23n
+[\fRZIP_ER_NOZIP\fR]
Not a zip archive.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_INTERNAL\fP]
+.TP 23n
+[\fRZIP_ER_INTERNAL\fR]
Internal error.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_INCONS\fP]
+.TP 23n
+[\fRZIP_ER_INCONS\fR]
Zip archive inconsistent.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_REMOVE\fP]
+.TP 23n
+[\fRZIP_ER_REMOVE\fR]
Can't remove file.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_DELETED\fP]
+.TP 23n
+[\fRZIP_ER_DELETED\fR]
Entry has been deleted.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_ENCRNOTSUPP\fP]
+.TP 23n
+[\fRZIP_ER_ENCRNOTSUPP\fR]
Encryption method not supported.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_RDONLY\fP]
+.TP 23n
+[\fRZIP_ER_RDONLY\fR]
Read-only archive.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_NOPASSWD\fP]
+.TP 23n
+[\fRZIP_ER_NOPASSWD\fR]
No password provided.
-.TP XZIPXERXCOMPNOTSUPPXX
-[\fRZIP_ER_WRONGPASSWD\fP]
+.TP 23n
+[\fRZIP_ER_WRONGPASSWD\fR]
Wrong password provided.
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_errors.mdoc -- list of all libzip error codes
-.\" Copyright (C) 2004-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2004-2015 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>
.TH "ZIP_FCLOSE" "3" "October 3, 2003" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_fclose\fP
+\fBzip_fclose\fR
\- close file in zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_fclose zip_file_t *file
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_fclose\fR(\fIzip_file_t\ *file\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_fclose
+\fBzip_fclose\fR()
function closes
-\fIfile\fP
+\fIfile\fR
and frees the memory allocated for it.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
zip_fopen(3),
zip_fread(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_fclose.mdoc -- close file in zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_FDOPEN" "3" "February 13, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_fdopen\fP
+\fBzip_fdopen\fR
\- open zip archive using open file descriptor
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_t *
-zip_fdopen int fd int flags int *errorp
+\fB#include <zip.h>\fR
+.sp
+\fIzip_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fdopen\fR(\fIint\ fd\fR, \fIint\ flags\fR, \fIint\ *errorp\fR);
+.PD
.SH "DESCRIPTION"
The zip archive specified by the open file descriptor
-\fIfd\fP
+\fIfd\fR
is opened and a pointer to a
-struct zip,
+\fIstruct zip\fR,
used to manipulate the archive, is returned.
In contrast to
zip_open(3),
using
-\fBzip_fdopen\fP
+\fBzip_fdopen\fR
the archive can only be opened in read-only mode.
The
-\fIfd\fP
+\fIfd\fR
argument may not be used any longer after calling
-\fBzip_fdopen\fP.
+\fBzip_fdopen\fR.
The
-flags
+\fIflags\fR
are specified by
-\fIor\fP'ing
+\fIor\fR'ing
the following values, or 0 for none of them.
-.TP ZIP_CHECKCONS
-\fRZIP_CHECKCONS\fP
+.RS 6n
+.TP 15n
+\fRZIP_CHECKCONS\fR
Perform additional stricter consistency checks on the archive, and
error if they fail.
+.RE
.PP
If an error occurs and
-\fIerrorp\fP
+\fIerrorp\fR
is
-non-\fRNULL\fP,
+non-\fRNULL\fR,
it will be set to the corresponding error code.
.SH "RETURN VALUES"
Upon successful completion
-zip_fdopen
+\fBzip_fdopen\fR()
returns a
-struct zip
+\fIstruct zip\fR
pointer, and
-\fIfd\fP
+\fIfd\fR
should not be used any longer, nor passed to
close(2).
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and
-\fI*errorp\fP
+\fI*errorp\fR
is set to indicate the error.
In the error case,
-\fIfd\fP
+\fIfd\fR
remains unchanged.
.SH "ERRORS"
The file specified by
-\fIfd\fP
+\fIfd\fR
is prepared for use by
libzip(3)
unless:
-.TP 17n
-[\fRZIP_ER_INCONS\fP]
+.TP 19n
+[\fRZIP_ER_INCONS\fR]
Inconsistencies were found in the file specified by
-\fIpath\fP.
+\fIpath\fR.
This error is often caused by specifying
-\fRZIP_CHECKCONS\fP
+\fRZIP_CHECKCONS\fR
but can also happen without it.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
The
-\fIflags\fP
+\fIflags\fR
argument is invalid.
Not all
zip_open(3)
flags are allowed for
-\fBzip_fdopen\fP,
+\fBzip_fdopen\fR,
see
-\fIDESCRIPTION\fP.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+\fIDESCRIPTION\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_NOZIP\fP]
+.TP 19n
+[\fRZIP_ER_NOZIP\fR]
The file specified by
-\fIfd\fP
+\fIfd\fR
is not a zip archive.
-.TP 17n
-[\fRZIP_ER_OPEN\fP]
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
The file specified by
-\fIfd\fP
+\fIfd\fR
could not be prepared for use by
libzip(3).
-.TP 17n
-[\fRZIP_ER_READ\fP]
+.TP 19n
+[\fRZIP_ER_READ\fR]
A read error occurred; see
-errno
+\fIerrno\fR
for details.
-.TP 17n
-[\fRZIP_ER_SEEK\fP]
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
The file specified by
-\fIfd\fP
+\fIfd\fR
does not allow seeks.
.SH "SEE ALSO"
libzip(3),
zip_error_to_str(3),
zip_open(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_fdopen.mdoc -- open zip archive using existing file descriptor
-.\" Copyright (C) 2009-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2009-2015 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>
.TH "ZIP_FILE_ADD" "3" "August 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_add\fP,
-\fBzip_file_replace\fP
+\fBzip_file_add\fR,
+\fBzip_file_replace\fR
\- add file to zip archive or replace file in zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_file_add zip_t *archive const char *name zip_source_t *source zip_flags_t flags
-int
-zip_file_replace zip_t *archive zip_uint64_t index zip_source_t *source zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_file_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_source_t\ *source\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_replace\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_source_t\ *source\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_file_add
+\fBzip_file_add\fR()
adds a file to a zip archive, while
-zip_file_replace
+\fBzip_file_replace\fR()
replaces an existing file in a zip archive.
The argument
-\fIarchive\fP
+\fIarchive\fR
specifies the zip archive to which the file should be added.
-\fIname\fP
+\fIname\fR
is the file's name in the zip archive (for
-zip_file_add),
+\fBzip_file_add\fR()),
while
-\fIindex\fP
+\fIindex\fR
specifies which file should be replaced (for
-zip_file_replace).
+\fBzip_file_replace\fR()).
The
-\fIflags\fP
+\fIflags\fR
argument can be any combination of
-\fRZIP_FL_OVERWRITE\fP
+\fRZIP_FL_OVERWRITE\fR
with one of
-\fRZIP_FL_ENC_*\fP:
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_OVERWRITE\fP
+\fRZIP_FL_ENC_*\fR:
+.TP 22n
+\fRZIP_FL_OVERWRITE\fR
Overwrite any existing file of the same name.
For
-\fBzip_file_add\fP
+\fBzip_file_add\fR
only.
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
Guess encoding of
-\fIname\fP
+\fIname\fR
(default).
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_UTF_8\fP
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
Interpret
-\fIname\fP
+\fIname\fR
as UTF-8.
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_CP437\fP
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
Interpret
-\fIname\fP
+\fIname\fR
as code page 437 (CP-437).
+.PD 0
+.PP
The data is obtained from the
-\fIsource\fP
+\fIsource\fR
argument, see
zip_source(3).
+.PD
.SH "RETURN VALUES"
Upon successful completion,
-zip_file_add
+\fBzip_file_add\fR()
returns the index of the new file in the archive, and
-zip_file_replace
+\fBzip_file_replace\fR()
returns 0.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "EXAMPLES"
.nf
+.RS 6n
zip_source_t *s;
const char buf="teststring";
zip_source_free(s);
printf("error adding file: %s\en", zip_strerror(archive));
}
+.RE
.fi
.SH "ERRORS"
-zip_file_add
+\fBzip_file_add\fR()
and
-zip_file_replace
+\fBzip_file_replace\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_EXISTS\fP]
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
There is already a file called
-\fIname\fP
+\fIname\fR
in the archive.
(Only applies to
-zip_file_add,
+\fBzip_file_add\fR(),
and only if
-\fRZIP_FL_OVERWRITE\fP
+\fRZIP_FL_OVERWRITE\fR
is not provided).
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIsource\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIsource\fR
or
-\fIname\fP
+\fIname\fR
are
-\fRNULL\fP,
+\fRNULL\fR,
or
-\fIindex\fP
+\fIindex\fR
is invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_RDONLY\fP]
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
Archive was opened in read-only mode.
.SH "SEE ALSO"
libzip(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_FILE_EXTRA_FIELD_DELETE" "3" "July 31, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_extra_field_delete\fP,
-\fBzip_file_extra_field_delete_by_id\fP
+\fBzip_file_extra_field_delete\fR,
+\fBzip_file_extra_field_delete_by_id\fR
\- delete extra field for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_file_extra_field_delete zip_t *archive zip_uint64_t index zip_uint16_t extra_field_index zip_flags_t flags
-int
-zip_file_extra_field_delete_by_id zip_t *archive zip_uint64_t index zip_uint16_t extra_field_id zip_uint16_t extra_field_index zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_delete\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_delete_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_extra_field_delete
+\fBzip_file_extra_field_delete\fR()
function deletes the extra field with index
-\fIextra_field_index\fP
+\fIextra_field_index\fR
for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
.PP
If
-\fIextra_field_index\fP
+\fIextra_field_index\fR
is
-\fRZIP_EXTRA_FIELD_ALL\fP,
+\fRZIP_EXTRA_FIELD_ALL\fR,
then all extra fields will be deleted.
.PP
The following
-\fIflags\fP
+\fIflags\fR
are supported:
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_CENTRAL\fP
+.RS 6n
+.TP 18n
+\fRZIP_FL_CENTRAL\fR
Delete extra fields from the archive's central directory.
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_LOCAL\fP
+.TP 18n
+\fRZIP_FL_LOCAL\fR
Delete extra fields from the local file headers.
+.RE
.PP
The
-zip_file_extra_field_delete_by_id
+\fBzip_file_extra_field_delete_by_id\fR()
function deletes the extra field with ID (two-byte signature)
-\fIextra_field_id\fP
+\fIextra_field_id\fR
and index
-\fIextra_field_index\fP
+\fIextra_field_index\fR
(in other words, the
-\fIextra_field_index\fP'th
+\fIextra_field_index\fR'th
extra field with ID
-\fIextra_field_id\fP)
+\fIextra_field_id\fR)
The other arguments are the same as for
-zip_file_extra_field_delete
-(\fRZIP_EXTRA_FIELD_ALL\fP
+\fBzip_file_extra_field_delete\fR()
+(\fRZIP_EXTRA_FIELD_ALL\fR
will delete all extra fields of the specified ID).
.PP
Please note that due to the library design, the index of an extra
field may be different between central directory and local file
headers.
For this reason, it is not allowed to specify both
-\fRZIP_FL_CENTRAL\fP
+\fRZIP_FL_CENTRAL\fR
and
-\fRZIP_FL_LOCAL\fP
+\fRZIP_FL_LOCAL\fR
in
-\fIflags\fP,
+\fIflags\fR,
except when deleting all extra fields (i.e.,
-\fIextra_field_index\fP
+\fIextra_field_index\fR
being
-\fRZIP_EXTRA_FIELD_ALL\fP).
+\fRZIP_EXTRA_FIELD_ALL\fR).
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_extra_field_delete
+\fBzip_file_extra_field_delete\fR()
and
-zip_file_extra_field_delete_by_id
+\fBzip_file_extra_field_delete_by_id\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_NOENT\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_file_extra_field_get(3),
zip_file_extra_field_set(3),
zip_file_extra_fields_count(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_extra_field_delete.mdoc -- delete extra field for file in zip
-.\" Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2012-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_EXTRA_FIELD_GET" "3" "October 8, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_extra_field_get\fP,
-\fBzip_file_extra_field_get_by_id\fP
+\fBzip_file_extra_field_get\fR,
+\fBzip_file_extra_field_get_by_id\fR
\- get extra field for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const zip_uint8_t *
-zip_file_extra_field_get zip_t *archive zip_uint64_t index zip_uint16_t extra_field_index zip_uint16_t *idp zip_uint16_t *lenp zip_flags_t flags
-const zip_uint8_t *
-zip_file_extra_field_get_by_id zip_t *archive zip_uint64_t index zip_uint16_t extra_field_id zip_uint16_t extra_field_index zip_uint16_t *lenp zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIconst zip_uint8_t *\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_get\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_uint16_t\ *idp\fR, \fIzip_uint16_t\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIconst zip_uint8_t *\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_get_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_uint16_t\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_extra_field_get
+\fBzip_file_extra_field_get\fR()
function returns the extra field with index
-\fIextra_field_index\fP
+\fIextra_field_index\fR
for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
This pointer should not be modified or
free(3)'d,
and becomes invalid when
-\fIarchive\fP
+\fIarchive\fR
is closed.
If
-\fIidp\fP
+\fIidp\fR
is not
-\fRNULL\fP,
+\fRNULL\fR,
the integer to which it points will be set to the ID (two-byte
signature) of the selected extra field.
If
-\fIlenp\fP
+\fIlenp\fR
is not
-\fRNULL\fP,
+\fRNULL\fR,
the integer to which it points will be set to the length of the
extra field.
Generally speaking,
-\fIlenp\fP
+\fIlenp\fR
and
-\fIidp\fP
+\fIidp\fR
should be passed since only the extra field data is returned (i.e.,
neither the ID nor the length, if the
-\fIidp\fP
+\fIidp\fR
and
-\fIlenp\fP
+\fIlenp\fR
arguments are not provided).
.PP
The following
-\fIflags\fP
+\fIflags\fR
are supported:
-.TP ZIP_FL_UNCHANGEDXX
-\fRZIP_FL_CENTRAL\fP
+.RS 6n
+.TP 20n
+\fRZIP_FL_CENTRAL\fR
Return extra fields from the archive's central directory.
-.TP ZIP_FL_UNCHANGEDXX
-\fRZIP_FL_LOCAL\fP
+.TP 20n
+\fRZIP_FL_LOCAL\fR
Return extra fields from the local file headers.
-.TP ZIP_FL_UNCHANGEDXX
-\fRZIP_FL_UNCHANGED\fP
+.TP 20n
+\fRZIP_FL_UNCHANGED\fR
Return the original unchanged extra fields, ignoring any changes made.
+.RE
.PP
The
-zip_file_extra_field_get_by_id
+\fBzip_file_extra_field_get_by_id\fR()
function returns the extra field with ID (two-byte signature)
-\fIextra_field_id\fP
+\fIextra_field_id\fR
and index
-\fIextra_field_index\fP
+\fIextra_field_index\fR
(in other words, the
-\fIextra_field_index\fP'th
+\fIextra_field_index\fR'th
extra field with ID
-\fIextra_field_id\fP)
+\fIextra_field_id\fR)
The other arguments are the same as for
-zip_file_extra_field_get.
+\fBzip_file_extra_field_get\fR().
.SH "RETURN VALUES"
Upon successful completion, a pointer to an extra field is returned,
or
-\fRNULL\fP
+\fRNULL\fR
if there is no extra field with that
-\fIextra_field_index\fP
+\fIextra_field_index\fR
for the file with index
-\fIindex\fP.
+\fIindex\fR.
In case of an error,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_extra_field_get
+\fBzip_file_extra_field_get\fR()
and
-zip_file_extra_field_get_by_id
+\fBzip_file_extra_field_get_by_id\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_NOENT\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP,
+\fIarchive\fR,
or
-\fIextra_field_index\fP
+\fIextra_field_index\fR
is not a valid extra file index (for ID
-\fIextra_field_id\fP).
+\fIextra_field_id\fR).
.SH "SEE ALSO"
libzip(3),
zip_file_extra_field_delete(3),
zip_file_extra_field_set(3),
zip_file_extra_fields_count(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.SH "CAVEATS"
Please note that the extra field IDs 0x0001 (ZIP64 extension),
0x6375 (Infozip UTF-8 comment), and
0x7075 (Infozip UTF-8 file name) can not be read using
-zip_file_extra_field_get
+\fBzip_file_extra_field_get\fR()
since they are used by
libzip(3)
internally.
.TH "ZIP_FILE_EXTRA_FIELD_SET" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_extra_field_set\fP
+\fBzip_file_extra_field_set\fR
\- set extra field for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_file_extra_field_set zip_t *archive zip_uint64_t index zip_uint16_t extra_field_id zip_uint16_t extra_field_index const zip_uint8_t *extra_field_data zip_uint16_t len zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_set\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIconst\ zip_uint8_t\ *extra_field_data\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_extra_field_set
+\fBzip_file_extra_field_set\fR()
function sets the extra field with ID (two-byte signature)
-\fIextra_field_id\fP
+\fIextra_field_id\fR
and index
-\fIextra_field_index\fP
+\fIextra_field_index\fR
for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
The extra field's data will be set to
-\fIextra_field_data\fP
+\fIextra_field_data\fR
and length
-\fIlen\fP.
+\fIlen\fR.
If a new entry shall be appended, set
-\fIextra_field_index\fP
+\fIextra_field_index\fR
to
-\fRZIP_EXTRA_FIELD_NEW\fP.
+\fRZIP_EXTRA_FIELD_NEW\fR.
.PP
At least one of the following
-\fIflags\fP
+\fIflags\fR
must be set:
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_CENTRAL\fP
+.RS 6n
+.TP 18n
+\fRZIP_FL_CENTRAL\fR
Set extra field in the archive's central directory.
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_LOCAL\fP
+.TP 18n
+\fRZIP_FL_LOCAL\fR
Set extra field in the local file headers.
+.RE
.PP
Please note that the extra field IDs 0x0001 (ZIP64 extension),
0x6375 (Infozip UTF-8 comment), and
0x7075 (Infozip UTF-8 file name) can not be set using
-zip_file_extra_field_set
+\fBzip_file_extra_field_set\fR()
since they are set by
libzip(3)
automatically when needed.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_extra_field_set
+\fBzip_file_extra_field_set\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
The extra field size is too large (ID and length need 4 bytes; the
maximum length of all extra fields for one file combined is 65536
bytes).
This error also occurs if
-\fIextra_field_index\fP
+\fIextra_field_index\fR
is too large.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_NOENT\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_file_extra_field_delete(3),
zip_file_extra_field_get(3),
zip_file_extra_fields_count(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_extra_field_set.mdoc -- set extra field for file in zip
-.\" Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2012-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_EXTRA_FIELDS_COUNT" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_extra_fields_count\fP,
-\fBzip_file_extra_fields_count_by_id\fP
+\fBzip_file_extra_fields_count\fR,
+\fBzip_file_extra_fields_count_by_id\fR
\- count extra fields for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int16_t
-zip_file_extra_fields_count zip_t *archive zip_uint64_t index zip_flags_t flags
-zip_int16_t
-zip_file_extra_fields_count_by_id zip_t *archive zip_uint64_t index zip_uint16_t extra_field_id zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int16_t\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_fields_count\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIzip_int16_t\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_fields_count_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_extra_fields_count
+\fBzip_file_extra_fields_count\fR()
function counts the extra fields for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
.PP
The following
-\fIflags\fP
+\fIflags\fR
are supported:
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_CENTRAL\fP
+.RS 6n
+.TP 18n
+\fRZIP_FL_CENTRAL\fR
Count extra fields from the archive's central directory.
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_LOCAL\fP
+.TP 18n
+\fRZIP_FL_LOCAL\fR
Count extra fields from the local file headers.
-.TP ZIP_FL_CENTRALXX
-\fRZIP_FL_UNCHANGED\fP
+.TP 18n
+\fRZIP_FL_UNCHANGED\fR
Count the original unchanged extra fields, ignoring any changes made.
+.RE
.PP
The
-zip_file_extra_fields_count_by_id
+\fBzip_file_extra_fields_count_by_id\fR()
function counts the extra fields with ID (two-byte signature)
-\fIextra_field_id\fP.
+\fIextra_field_id\fR.
The other arguments are the same as for
-zip_file_extra_fields_count.
+\fBzip_file_extra_fields_count\fR().
.PP
Extra fields that are the same in the central directory and the local file
header are merged into one.
Therefore, the counts with
-\fRZIP_FL_CENTRAL\fP
+\fRZIP_FL_CENTRAL\fR
and
-\fRZIP_FL_LOCAL\fP
+\fRZIP_FL_LOCAL\fR
do not need to add up to the same value as when given
-\fRZIP_FL_CENTRAL|ZIP_FL_LOCAL\fP
+\fRZIP_FL_CENTRAL|ZIP_FL_LOCAL\fR
at the same time.
.SH "RETURN VALUES"
Upon successful completion, the requested number of extra fields is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_extra_fields_count
+\fBzip_file_extra_fields_count\fR()
and
-zip_file_extra_fields_count_by_id
+\fBzip_file_extra_fields_count_by_id\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_NOENT\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_file_extra_field_delete(3),
zip_file_extra_field_get(3),
zip_file_extra_field_set(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_extra_fields_count.mdoc -- count extra field for file in zip
-.\" Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2012-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_GET_COMMENT" "3" "September 19, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_get_comment\fP
+\fBzip_file_get_comment\fR
\- get comment for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_file_get_comment zip_t *archive zip_uint64_t index zip_uint32_t *lenp zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_file_get_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint32_t\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_get_comment
+\fBzip_file_get_comment\fR()
function returns the comment for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
The name is in UTF-8 encoding unless
-\fRZIP_FL_ENC_RAW\fP
+\fRZIP_FL_ENC_RAW\fR
was specified (see below).
This pointer should not be modified or
free(3)'d,
and becomes invalid when
-\fIarchive\fP
+\fIarchive\fR
is closed.
If
-\fIlenp\fP
+\fIlenp\fR
is not
-\fRNULL\fP,
+\fRNULL\fR,
the integer to which it points will be set to the length of the
comment.
If
-\fIflags\fP
+\fIflags\fR
is set to
-\fRZIP_FL_UNCHANGED\fP,
+\fRZIP_FL_UNCHANGED\fR,
the original unchanged comment is returned.
.PP
Additionally, the following
-\fIflags\fP
+\fIflags\fR
are supported:
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_RAW\fP
+.RS 6n
+.TP 21n
+\fRZIP_FL_ENC_RAW\fR
Return the unmodified comment as it is in the ZIP archive.
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 21n
+\fRZIP_FL_ENC_GUESS\fR
(Default.)
Guess the encoding of the comment in the ZIP archive and convert it
to UTF-8, if necessary.
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_STRICT\fP
+.TP 21n
+\fRZIP_FL_ENC_STRICT\fR
Follow the ZIP specification for file names and extend it to file
comments, expecting them to be encoded in CP-437 in the ZIP archive
(except if it is a UTF-8 comment from the special extra field).
Convert it to UTF-8.
-\fINote\fP:
+.RE
+\fINote\fR:
ASCII is a subset of both CP-437 and UTF-8.
.SH "RETURN VALUES"
Upon successful completion, a pointer to the comment is returned,
or
-\fRNULL\fP
+\fRNULL\fR
if there is no comment.
In case of an error,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_get_comment
+\fBzip_file_get_comment\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_file_set_comment(3),
zip_get_archive_comment(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_get_comment.mdoc -- get comment for file in zip
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_GET_ERROR" "3" "November 9, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_get_error\fP
+\fBzip_file_get_error\fR
\- extract zip_error from zip_file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_error_t *
-zip_file_get_error zip_file_t *zf
+\fB#include <zip.h>\fR
+.sp
+\fIzip_error_t *\fR
+.PD 0
+.HP 4n
+\fBzip_file_get_error\fR(\fIzip_file_t\ *zf\fR);
+.PD
.SH "DESCRIPTION"
-zip_file_get_error
+\fBzip_file_get_error\fR()
function returns the zip_error associated with the zip_file
-\fIzf\fP.
+\fIzf\fR.
.SH "SEE ALSO"
libzip(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_FILE_GET_EXTERNAL_ATTRIBUTES" "3" "September 19, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_get_external_attributes\fP
+\fBzip_file_get_external_attributes\fR
\- get external attributes for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_file_get_external_attributes zip_t *archive zip_uint64_t index zip_flags_t flags zip_uint8_t *opsys zip_uint32_t *attributes
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_file_get_external_attributes\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint8_t\ *opsys\fR, \fIzip_uint32_t\ *attributes\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_get_external_attributes
+\fBzip_file_get_external_attributes\fR()
function returns the operating system and external attributes for the
file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
The external attributes usually contain the operating system-specific
file permissions.
If
-\fIflags\fP
+\fIflags\fR
is set to
-\fRZIP_FL_UNCHANGED\fP,
+\fRZIP_FL_UNCHANGED\fR,
the original unchanged values are returned.
If
-\fIopsys\fP
+\fIopsys\fR
or
-\fIattributes\fP
+\fIattributes\fR
are
-\fRNULL\fP,
+\fRNULL\fR,
they are not filled in.
.PP
The following operating systems are defined by the zip specification:
-.TP
-\fRZIP_OPSYS_ACORN_RISC\fP
-.TP
-\fRZIP_OPSYS_ALTERNATE_MVS\fP
-.TP
-\fRZIP_OPSYS_AMIGA\fP
-.TP
-\fRZIP_OPSYS_ATARI_ST\fP
-.TP
-\fRZIP_OPSYS_BEOS\fP
-.TP
-\fRZIP_OPSYS_CPM\fP
-.TP
-\fRZIP_OPSYS_DOS\fP
-.TP
-\fRZIP_OPSYS_MACINTOSH\fP
-.TP
-\fRZIP_OPSYS_MVS\fP
-.TP
-\fRZIP_OPSYS_OPENVMS\fP
-.TP
-\fRZIP_OPSYS_OS_2\fP
-.TP
-\fRZIP_OPSYS_OS_400\fP
-.TP
-\fRZIP_OPSYS_OS_X\fP
-.TP
-\fRZIP_OPSYS_TANDEM\fP
-.TP
-\fRZIP_OPSYS_UNIX\fP
-.TP
-\fRZIP_OPSYS_VFAT\fP
-.TP
-\fRZIP_OPSYS_VM_CMS\fP
-.TP
-\fRZIP_OPSYS_VSE\fP
-.TP
-\fRZIP_OPSYS_WINDOWS_NTFS\fP
+.RS 6n
+.PD 0
+.PP
+\fRZIP_OPSYS_ACORN_RISC\fR
+.PP
+\fRZIP_OPSYS_ALTERNATE_MVS\fR
+.PP
+\fRZIP_OPSYS_AMIGA\fR
+.PP
+\fRZIP_OPSYS_ATARI_ST\fR
+.PP
+\fRZIP_OPSYS_BEOS\fR
+.PP
+\fRZIP_OPSYS_CPM\fR
+.PP
+\fRZIP_OPSYS_DOS\fR
+.PP
+\fRZIP_OPSYS_MACINTOSH\fR
+.PP
+\fRZIP_OPSYS_MVS\fR
+.PP
+\fRZIP_OPSYS_OPENVMS\fR
+.PP
+\fRZIP_OPSYS_OS_2\fR
+.PP
+\fRZIP_OPSYS_OS_400\fR
+.PP
+\fRZIP_OPSYS_OS_X\fR
+.PP
+\fRZIP_OPSYS_TANDEM\fR
+.PP
+\fRZIP_OPSYS_UNIX\fR
+.PP
+\fRZIP_OPSYS_VFAT\fR
+.PP
+\fRZIP_OPSYS_VM_CMS\fR
+.PP
+\fRZIP_OPSYS_VSE\fR
+.PP
+\fRZIP_OPSYS_WINDOWS_NTFS\fR
(uncommon, use
-\fRZIP_OPSYS_DOS\fP
+\fRZIP_OPSYS_DOS\fR
instead)
-.TP
-\fRZIP_OPSYS_Z_SYSTEM\fP
+.PP
+\fRZIP_OPSYS_Z_SYSTEM\fR
+.RE
+.PD
.PP
The defines above follow the PKWARE Inc. Appnote; please note that
the InfoZIP Appnote has a slightly different mapping.
.SH "RETURN VALUES"
Upon successful completion, 0 is returned.
In case of an error,
-\fR\-1\fP
+\fR\-1\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "EXAMPLES"
The following code can be used to expand
-\fIattributes\fP
+\fIattributes\fR
if the operating system is
-\fRZIP_OPSYS_DOS\fP.
+\fRZIP_OPSYS_DOS\fR.
.nf
+.sp
+.RS 0n
#include <sys/stat.h>
#define FA_RDONLY 0x01 // FILE_ATTRIBUTE_READONLY
return m;
}
+.RE
.fi
.SH "ERRORS"
-zip_file_get_external_attributes
+\fBzip_file_get_external_attributes\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_file_set_external_attributes(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_get_external_attributes.mdoc -- get external attributes for file in zip
-.\" Copyright (C) 2013-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2013-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_RENAME" "3" "June 23, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_rename\fP
+\fBzip_file_rename\fR
\- rename file in zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_file_rename zip_t *archive zip_uint64_t index const char *name zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_rename\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *name\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive
-\fIarchive\fP
+\fIarchive\fR
is renamed to
-\fIname\fP.
+\fIname\fR.
The
-\fIflags\fP
+\fIflags\fR
argument can be any of:
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
Guess encoding of
-\fIname\fP
+\fIname\fR
(default).
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_UTF_8\fP
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
Interpret
-\fIname\fP
+\fIname\fR
as UTF-8.
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_CP437\fP
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
Interpret
-\fIname\fP
+\fIname\fR
as code page 437 (CP-437).
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_rename
+\fBzip_rename\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_DELETED\fP]
+.TP 19n
+[\fRZIP_ER_DELETED\fR]
The file to be renamed has been deleted from the archive.
-.TP 17n
-[\fRZIP_ER_EXISTS\fP]
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
There is already a file called
-\fIname\fP
+\fIname\fR
in the archive.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP,
-\fIname is\fP
-\fRNULL\fP,
+\fIarchive\fR,
+\fIname is\fR
+\fRNULL\fR,
the empty string, or not a valid UTF-8 encoded string.
Also a file cannot be renamed to a directory or vice versa.
Directories are denoted by a trailing slash.
libzip(3),
zip_unchange(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_rename.mdoc -- rename file in zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_FILE_SET_COMMENT" "3" "September 19, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_set_comment\fP
+\fBzip_file_set_comment\fR
\- set comment for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_file_comment zip_t *archive zip_uint64_t index const char *comment zip_uint16_t len zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_set_comment
+\fBzip_file_set_comment\fR()
function sets the comment for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive to
-\fIcomment\fP
+\fIcomment\fR
of length
-\fIlen\fP.
+\fIlen\fR.
If
-\fIcomment\fP
+\fIcomment\fR
is
-\fRNULL\fP
+\fRNULL\fR
and
-\fIlen\fP
+\fIlen\fR
is 0, the file comment will be removed.
The
-\fIflags\fP
+\fIflags\fR
argument can be any of:
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
Guess encoding of
-\fIcomment\fP
+\fIcomment\fR
(default).
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_UTF_8\fP
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
Interpret
-\fIcomment\fP
+\fIcomment\fR
as UTF-8.
-.TP XZIPXFLXENCXSTRICTXX
-\fRZIP_FL_ENC_CP437\fP
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
Interpret
-\fIcomment\fP
+\fIcomment\fR
as code page 437 (CP-437).
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_set_comment
+\fBzip_file_set_comment\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP,
+\fIarchive\fR,
or
-\fIlen\fP
+\fIlen\fR
is less than 0 or longer than the maximum comment length in a zip file
(65535), or
-\fIcomment\fP
+\fIcomment\fR
is not a valid UTF-8 encoded string.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_RDONLY\fP]
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
The
-\fIarchive\fP
+\fIarchive\fR
was opened in read-only mode.
.SH "SEE ALSO"
libzip(3),
zip_get_archive_comment(3),
zip_set_archive_comment(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_set_comment.mdoc -- set comment for file in zip
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_SET_EXTERNAL_ATTRIBUTES" "3" "September 19, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_set_external_attributes\fP
+\fBzip_file_set_external_attributes\fR
\- set external attributes for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_file_set_external_attributes zip_t *archive zip_uint64_t index zip_flags_t flags zip_uint8_t opsys zip_uint32_t attributes
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_file_set_external_attributes\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint8_t\ opsys\fR, \fIzip_uint32_t\ attributes\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_set_external_attributes
+\fBzip_file_set_external_attributes\fR()
function sets the operating system and external attributes for the
file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive.
Currently, no
-\fIflags\fP
+\fIflags\fR
are supported.
.PP
For a list of known
-\fIopsys\fP
+\fIopsys\fR
values, see
zip_file_get_external_attributes(3).
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_set_external_attributes
+\fBzip_file_set_external_attributes\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+\fIarchive\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_RDONLY\fP]
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
The
-\fIarchive\fP
+\fIarchive\fR
was opened in read-only mode.
.SH "SEE ALSO"
libzip(3),
zip_file_get_external_attributes(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_set_external_attributes.mdoc -- set external attributes for file in zip
-.\" Copyright (C) 2013-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2013-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_FILE_SET_MTIME" "3" "August 5, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_set_mtime\fP
+\fBzip_file_set_mtime\fR
\- set last modification time (mtime) for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_file_mtime zip_t *archive zip_uint64_t index time_t mtime zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_file_mtime\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fItime_t\ mtime\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_file_set_mtime
+\fBzip_file_set_mtime\fR()
function sets the last modification time (mtime) for the file at
position
-\fIindex\fP
+\fIindex\fR
in the zip archive to
-\fImtime\fP.
+\fImtime\fR.
Currently, no support for any
-\fIflags\fP
+\fIflags\fR
is implemented.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_file_set_mtime
+\fBzip_file_set_mtime\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+\fIarchive\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_RDONLY\fP]
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
The
-\fIarchive\fP
+\fIarchive\fR
was opened in read-only mode.
.SH "SEE ALSO"
libzip(3),
zip_stat(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_FILE_STRERROR" "3" "December 27, 2004" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_file_strerror\fP,
-\fBzip_strerror\fP
+\fBzip_file_strerror\fR,
+\fBzip_strerror\fR
\- get string representation for a zip error
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_file_strerror zip_file_t *file
-const char *
-zip_strerror zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_file_strerror\fR(\fIzip_file_t\ *file\fR);
+.PD
+.PP
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_strerror\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_strerror
+\fBzip_strerror\fR()
function returns a string describing the last error for the zip archive
-\fIarchive\fP,
+\fIarchive\fR,
while the
-zip_file_strerror
+\fBzip_file_strerror\fR()
function does the same for a zip file
-\fIfile\fP
+\fIfile\fR
(one file in an archive).
The returned string must not be modified or freed, and becomes invalid when
-\fIarchive\fP
+\fIarchive\fR
or
-\fIfile\fP,
+\fIfile\fR,
respectively,
is closed or on the next call to
-zip_strerror
+\fBzip_strerror\fR()
or
-zip_file_strerror,
+\fBzip_file_strerror\fR(),
respectively,
for the same archive.
.SH "RETURN VALUES"
-zip_file_strerror
+\fBzip_file_strerror\fR()
and
-zip_strerror
+\fBzip_strerror\fR()
return a pointer to the error string.
.SH "SEE ALSO"
libzip(3),
zip_error_to_str(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_file_strerror.mdoc -- get string representation for a zip error
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_FOPEN" "3" "October 23, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_fopen\fP,
-\fBzip_fopen_index\fP
+\fBzip_fopen\fR,
+\fBzip_fopen_index\fR
\- open file in zip archive for reading
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_file_t *
-zip_fopen zip_t *archive const char *fname zip_flags_t flags
-zip_file_t *
-zip_fopen_index zip_t *archive zip_uint64_t index zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen_index\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_fopen
+\fBzip_fopen\fR()
function opens the file name
-\fIfname\fP
+\fIfname\fR
in
-\fIarchive\fP.
+\fIarchive\fR.
The
-\fIflags\fP
+\fIflags\fR
argument specifies how the name lookup should be done, according to
the values are described in
zip_name_locate(3).
Also, the following values may be
-\fIor\fP'ed
+\fIor\fR'ed
to it.
-.TP ZIP_FL_COMPRESSED
-\fRZIP_FL_COMPRESSED\fP
+.RS 6n
+.TP 19n
+\fRZIP_FL_COMPRESSED\fR
Read the compressed data.
Otherwise the data is uncompressed by
-zip_fread.
-.TP ZIP_FL_COMPRESSED
-\fRZIP_FL_UNCHANGED\fP
+\fBzip_fread\fR().
+.TP 19n
+\fRZIP_FL_UNCHANGED\fR
Read the original data from the zip archive, ignoring any changes made
to the file.
+.RE
.PP
The
-zip_fopen_index
+\fBzip_fopen_index\fR()
function opens the file at position
-\fIindex\fP.
+\fIindex\fR.
.PP
If encrypted data is encountered, the functions call
zip_fopen_encrypted(3)
zip_set_default_password(3).
.SH "RETURN VALUES"
Upon successful completion, a
-struct zip_file
+\fIstruct zip_file\fR
pointer is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-.TP 17n
-[\fRZIP_ER_CHANGED\fP]
+.TP 19n
+[\fRZIP_ER_CHANGED\fR]
The file data has been changed.
-.TP 17n
-[\fRZIP_ER_COMPNOTSUPP\fP]
+.TP 19n
+[\fRZIP_ER_COMPNOTSUPP\fR]
The compression method used is not supported.
-.TP 17n
-[\fRZIP_ER_ENCRNOTSUPP\fP]
+.TP 19n
+[\fRZIP_ER_ENCRNOTSUPP\fR]
The encryption method used is not supported.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_NOPASSWD\fP]
+.TP 19n
+[\fRZIP_ER_NOPASSWD\fR]
The file is encrypted, but no password has been provided.
-.TP 17n
-[\fRZIP_ER_READ\fP]
+.TP 19n
+[\fRZIP_ER_READ\fR]
A file read error occurred.
-.TP 17n
-[\fRZIP_ER_SEEK\fP]
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
A file seek error occurred.
-.TP 17n
-[\fRZIP_ER_WRONGPASSWD\fP]
+.TP 19n
+[\fRZIP_ER_WRONGPASSWD\fR]
The provided password does not match the password used for encryption.
Note that some incorrect passwords are not detected by the check done by
-zip_fopen.
-.TP 17n
-[\fRZIP_ER_ZLIB\fP]
+\fBzip_fopen\fR().
+.TP 19n
+[\fRZIP_ER_ZLIB\fR]
Initializing the zlib stream failed.
.PP
The function
-zip_fopen
+\fBzip_fopen\fR()
may also fail and set
-zip_err
+\fIzip_err\fR
for any of the errors specified for the routine
zip_name_locate(3).
.PP
The function
-zip_fopen_index
+\fBzip_fopen_index\fR()
may also fail with
-\fRZIP_ER_INVAL\fP
+\fRZIP_ER_INVAL\fR
if
-\fIindex\fP
+\fIindex\fR
is invalid.
.SH "SEE ALSO"
libzip(3),
zip_name_locate(3),
zip_set_default_password(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_fopen.mdoc -- open file in zip archive for reading
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_FOPEN_ENCRYPTED" "3" "July 22, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_fopen_encrypted\fP,
-\fBzip_fopen_index_encrypted\fP
+\fBzip_fopen_encrypted\fR,
+\fBzip_fopen_index_encrypted\fR
\- open encrypted file in zip archive for reading
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_file_t *
-zip_fopen_encrypted zip_t *archive const char *fname zip_flags_t flags const char *password
-zip_file_t *
-zip_fopen_index_encrypted zip_t *archive zip_uint64_t index zip_flags_t flags const char *password
+\fB#include <zip.h>\fR
+.sp
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen_encrypted\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR, \fIconst\ char\ *password\fR);
+.PD
+.PP
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen_index_encrypted\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIconst\ char\ *password\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_fopen_encrypted
+\fBzip_fopen_encrypted\fR()
function opens the encrypted file name
-\fIfname\fP
+\fIfname\fR
in
-\fIarchive\fP
+\fIarchive\fR
using the password given in the
-\fIpassword\fP
+\fIpassword\fR
argument.
The
-\fIflags\fP
+\fIflags\fR
argument are the same as for
zip_fopen(3).
.PP
The
-zip_fopen_index_encrypted
+\fBzip_fopen_index_encrypted\fR()
function opens the file at position
-\fIindex\fP,
+\fIindex\fR,
see
zip_fopen_index(3).
These functions are called automatically by
zip_set_default_password(3)).
.SH "RETURN VALUES"
Upon successful completion, a
-struct zip_file
+\fIstruct zip_file\fR
pointer is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-.TP ZIP_ER_ENCRNOTSUPPXX
-[\fRZIP_ER_NOPASSWD\fP]
+.TP 22n
+[\fRZIP_ER_NOPASSWD\fR]
No password was provided.
.PP
The function
-zip_fopen_encrypted
+\fBzip_fopen_encrypted\fR()
may also fail and set
-zip_err
+\fIzip_err\fR
for any of the errors specified for the routine
zip_fopen(3).
.PP
The function
-zip_fopen_index_encrypted
+\fBzip_fopen_index_encrypted\fR()
may also fail and set
-zip_err
+\fIzip_err\fR
for any of the errors specified for the routine
zip_fopen_index(3).
.SH "SEE ALSO"
zip_get_num_entries(3),
zip_name_locate(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_fopen_encrypted.mdoc -- open encrypted file in zip archive for reading
-.\" Copyright (C) 2011-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2011-2015 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>
.TH "ZIP_FREAD" "3" "March 10, 2009" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_fread\fP
+\fBzip_fread\fR
\- read from file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_fread zip_file_t *file void *buf zip_uint64_t nbytes
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_fread\fR(\fIzip_file_t\ *file\fR, \fIvoid\ *buf\fR, \fIzip_uint64_t\ nbytes\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_fread
+\fBzip_fread\fR()
function reads at most
-\fInbytes\fP
+\fInbytes\fR
bytes from
-\fIfile\fP
+\fIfile\fR
into
-\fIbuf\fP.
+\fIbuf\fR.
.SH "RETURN VALUES"
If successful, the number of bytes actually read is returned.
Otherwise, \-1 is returned.
zip_fclose(3),
zip_fopen(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_GET_ARCHIVE_COMMENT" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_archive_comment\fP
+\fBzip_get_archive_comment\fR
\- get zip archive comment
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_get_archive_comment zip_t *archive int *lenp zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_get_archive_comment\fR(\fIzip_t\ *archive\fR, \fIint\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_get_archive_comment
+\fBzip_get_archive_comment\fR()
function returns the comment for the entire zip archive.
The name is in UTF-8 encoding unless
-\fRZIP_FL_ENC_RAW\fP
+\fRZIP_FL_ENC_RAW\fR
was specified (see below).
This pointer should not be modified or
free(3)'d,
and becomes invalid when
-\fIarchive\fP
+\fIarchive\fR
is closed.
If
-\fIlenp\fP
+\fIlenp\fR
is not
-\fRNULL\fP,
+\fRNULL\fR,
the integer to which it points will be set to the length of the
comment.
If
-\fIflags\fP
+\fIflags\fR
is set to
-\fRZIP_FL_UNCHANGED\fP,
+\fRZIP_FL_UNCHANGED\fR,
the original unchanged comment is returned.
.PP
Additionally, the following
-\fIflags\fP
+\fIflags\fR
are supported:
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_RAW\fP
+.RS 6n
+.TP 21n
+\fRZIP_FL_ENC_RAW\fR
Return the unmodified archive comment as it is in the ZIP archive.
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 21n
+\fRZIP_FL_ENC_GUESS\fR
(Default.)
Guess the encoding of the archive comment in the ZIP archive and convert it
to UTF-8, if necessary.
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_STRICT\fP
+.TP 21n
+\fRZIP_FL_ENC_STRICT\fR
Follow the ZIP specification for file names and extend it to the
archive comment, thus also expecting it in CP-437 encoding.
Convert it to UTF-8.
-\fINote\fP:
+.RE
+\fINote\fR:
ASCII is a subset of both CP-437 and UTF-8.
.SH "RETURN VALUES"
Upon successful completion, a pointer to the comment is returned,
or
-\fRNULL\fP
+\fRNULL\fR
if there is no comment.
.SH "SEE ALSO"
libzip(3),
zip_get_file_comment(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_get_archive_comment.mdoc -- get zip archive comment
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 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>
.TH "ZIP_GET_ARCHIVE_FLAG" "3" "April 29, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_archive_flag\fP
+\fBzip_get_archive_flag\fR
\- get status flags for zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_get_archive_flag zip_t *archive zip_flags_t flag zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_get_archive_flag\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flag\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_get_archive_flag
+\fBzip_get_archive_flag\fR()
function returns if the flag
-\fIflag\fP
+\fIflag\fR
is set for the archive
-\fIarchive\fP.
+\fIarchive\fR.
The archive flags might have been changed with
-zip_set_archive_flag;
+\fBzip_set_archive_flag\fR();
if
-\fIflags\fP
+\fIflags\fR
is set to
-\fRZIP_FL_UNCHANGED\fP,
+\fRZIP_FL_UNCHANGED\fR,
the original unchanged flags are tested.
.PP
Supported flags are:
-.TP XZIPXAFLXRDONLYXXX
-\fRZIP_AFL_RDONLY\fP
+.TP 20n
+\fRZIP_AFL_RDONLY\fR
The archive is read-only.
.SH "RETURN VALUES"
-zip_get_archive_flag
+\fBzip_get_archive_flag\fR()
returns 1 if
-\fIflag\fP
+\fIflag\fR
is set for
-\fIarchive\fP,
+\fIarchive\fR,
0 if not,
and \-1 if an error occurred.
.SH "SEE ALSO"
libzip(3),
zip_set_archive_flag(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_GET_ERROR" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_error\fP
+\fBzip_get_error\fR
\- get zip error for archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_error_t *
-zip_get_error zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIzip_error_t *\fR
+.PD 0
+.HP 4n
+\fBzip_get_error\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_get_error
+\fBzip_get_error\fR()
function returns the zip error for the zip archive
-\fIarchive\fP.
+\fIarchive\fR.
.SH "SEE ALSO"
libzip(3),
zip_error_code_system(3),
zip_error_code_zip(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_GET_FILE_COMMENT" "3" "June 23, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_file_comment\fP
+\fBzip_get_file_comment\fR
\- get comment for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_get_file_comment zip_t *archive zip_uint64_t index int *lenp int flags
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_get_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIint\ *lenp\fR, \fIint\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_get_file_comment
+\fBzip_get_file_comment\fR()
function is the obsolete version of
zip_file_get_comment(3).
The only differences are the types of the
-\fIlenp\fP
+\fIlenp\fR
and
-\fIflags\fP
+\fIflags\fR
arguments.
.SH "SEE ALSO"
libzip(3),
zip_file_get_comment(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_get_file_comment.mdoc -- get comment for file in zip
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_GET_NAME" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_name\fP
+\fBzip_get_name\fR
\- get name of file by index
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-const char *
-zip_get_name zip_t *archive zip_uint64_t index zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_get_name\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_get_name
+\fBzip_get_name\fR()
function returns the name of the file at position
-\fIindex\fP
+\fIindex\fR
in
-\fIarchive\fP.
+\fIarchive\fR.
The name is in UTF-8 encoding unless
-\fRZIP_FL_ENC_RAW\fP
+\fRZIP_FL_ENC_RAW\fR
was specified (see below).
.PP
If
-\fIflags\fP
+\fIflags\fR
is set to
-\fRZIP_FL_UNCHANGED\fP,
+\fRZIP_FL_UNCHANGED\fR,
the original unchanged filename is returned.
The returned string must not be modified or freed, and becomes invalid when
-\fIarchive\fP
+\fIarchive\fR
is closed.
.PP
Additionally, the following
-\fIflags\fP
+\fIflags\fR
are supported:
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_RAW\fP
+.RS 6n
+.TP 21n
+\fRZIP_FL_ENC_RAW\fR
Return the unmodified names as it is in the ZIP archive.
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_GUESS\fP
+.TP 21n
+\fRZIP_FL_ENC_GUESS\fR
(Default.)
Guess the encoding of the name in the ZIP archive and convert it
to UTF-8, if necessary.
-.TP ZIP_FL_ENC_STRICTXX
-\fRZIP_FL_ENC_STRICT\fP
+.TP 21n
+\fRZIP_FL_ENC_STRICT\fR
Follow the ZIP specification and expect CP-437 encoded names in
the ZIP archive (except if they are explicitly marked as UTF-8).
Convert it to UTF-8.
-\fINote\fP:
+.RE
+\fINote\fR:
ASCII is a subset of both CP-437 and UTF-8.
.SH "RETURN VALUES"
Upon successful completion, a pointer to the name is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_get_name
+\fBzip_get_name\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_DELETED\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_DELETED\fR]
+\fIindex\fR
refers to a file that has been deleted
(see
zip_delete(3)).
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP,
+\fIarchive\fR,
or
-\fIindex\fP
+\fIindex\fR
points to an added file and
-\fRZIP_FL_UNCHANGED\fP
+\fRZIP_FL_UNCHANGED\fR
is set.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_name_locate(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_get_name.mdoc -- get name of file by index
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_GET_NUM_ENTRIES" "3" "August 1, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_num_entries\fP
+\fBzip_get_num_entries\fR
\- get number of files in archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_get_num_entries zip_t *archive zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_get_num_entries\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_get_num_entries
+\fBzip_get_num_entries\fR()
function returns the number of files in
-\fIarchive\fP.
+\fIarchive\fR.
If
-\fIflags\fP
+\fIflags\fR
is set to
-\fRZIP_FL_UNCHANGED\fP,
+\fRZIP_FL_UNCHANGED\fR,
the original number of entries is returned.
.SH "RETURN VALUES"
-zip_get_num_entries
+\fBzip_get_num_entries\fR()
returns the number of files in the zip archive,
or \-1 if
-\fIarchive\fP
+\fIarchive\fR
is
-\fRNULL\fP.
+\fRNULL\fR.
.SH "SEE ALSO"
libzip(3),
zip_fopen_index(3),
zip_stat_index(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_get_num_entries.mdoc -- get number of files in archive
-.\" Copyright (C) 2011-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2011-2015 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>
.TH "ZIP_GET_NUM_FILES" "3" "February 14, 2011" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_get_num_files\fP
+\fBzip_get_num_files\fR
\- get number of files in archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_get_num_files zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_get_num_files\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
-\fIThis function is deprecated\fP.
-\fIUse\fP
+\fIThis function is deprecated\fR.
+\fIUse\fR
zip_get_num_entries(3)
-\fIinstead\fP.
+\fIinstead\fR.
.PP
The
-zip_get_num_files
+\fBzip_get_num_files\fR()
function returns the number of files in
-\fIarchive\fP.
+\fIarchive\fR.
.SH "RETURN VALUES"
-zip_get_num_files
+\fBzip_get_num_files\fR()
returns the number of files in the zip archive,
or \-1 if
-\fIarchive\fP
+\fIarchive\fR
is
-\fRNULL\fP.
+\fRNULL\fR.
.SH "SEE ALSO"
libzip(3),
zip_fopen_index(3),
zip_stat_index(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_get_num_files.mdoc -- get number of files in archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_NAME_LOCATE" "3" "July 21, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_name_locate\fP
+\fBzip_name_locate\fR
\- get index of file by name
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_name_locate zip_t *archive const char *fname zip_flags_t flags
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_name_locate\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_name_locate
+\fBzip_name_locate\fR()
function returns the index of the file named
-\fIfname\fP
+\fIfname\fR
in
-\fIarchive\fP.
+\fIarchive\fR.
If
-\fIarchive\fP
+\fIarchive\fR
does not contain a file with that name, \-1 is returned.
The
-flags
+\fIflags\fR
are specified by
-\fIor\fP'ing
+\fIor\fR'ing
the following values, or 0 for none of them.
-.TP ZIP_FL_NOCASE
-\fRZIP_FL_NOCASE\fP
+.RS 6n
+.TP 15n
+\fRZIP_FL_NOCASE\fR
Ignore case distinctions.
(Will only work well if the file names are ASCII.)
-.TP ZIP_FL_NOCASE
-\fRZIP_FL_NODIR\fP
+.TP 15n
+\fRZIP_FL_NODIR\fR
Ignore directory part of file name in archive.
-.TP ZIP_FL_NOCASE
-\fRZIP_FL_ENC_RAW\fP
+.TP 15n
+\fRZIP_FL_ENC_RAW\fR
+.br
Compare against the unmodified names as it is in the ZIP archive.
-.TP ZIP_FL_NOCASE
-\fRZIP_FL_ENC_GUESS\fP
+.TP 15n
+\fRZIP_FL_ENC_GUESS\fR
(Default.)
Guess the encoding of the name in the ZIP archive and convert it
to UTF-8, if necessary, before comparing.
-.TP ZIP_FL_NOCASE
-\fRZIP_FL_ENC_STRICT\fP
+.TP 15n
+\fRZIP_FL_ENC_STRICT\fR
Follow the ZIP specification and expect CP-437 encoded names in
the ZIP archive (except if they are explicitly marked as UTF-8).
Convert it to UTF-8 before comparing.
-\fINote\fP:
+.RE
+\fINote\fR:
ASCII is a subset of both CP-437 and UTF-8.
.SH "RETURN VALUES"
-zip_name_locate
+\fBzip_name_locate\fR()
returns the index of the file named
-\fIfname\fP
+\fIfname\fR
or \-1, if
-\fIarchive\fP
+\fIarchive\fR
does not contain an entry of that name.
.SH "ERRORS"
-zip_name_locate
+\fBzip_name_locate\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_NOENT\fP]
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
No entry of the name
-\fIfname\fP
+\fIfname\fR
is found in the archive.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
One of the arguments is invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_get_name(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_name_locate.mdoc -- get index of file by name
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_OPEN" "3" "November 9, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_open\fP,
-\fBzip_open_from_source\fP
+\fBzip_open\fR,
+\fBzip_open_from_source\fR
\- open zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_t *
-zip_open const char *path int flags int *errorp
-zip_t *
-zip_open_from_source zip_source_t *zs int flags zip_error_t *ze
+\fB#include <zip.h>\fR
+.sp
+\fIzip_t *\fR
+.PD 0
+.HP 4n
+\fBzip_open\fR(\fIconst\ char\ *path\fR, \fIint\ flags\fR, \fIint\ *errorp\fR);
+.PD
+.PP
+\fIzip_t *\fR
+.PD 0
+.HP 4n
+\fBzip_open_from_source\fR(\fIzip_source_t\ *zs\fR, \fIint\ flags\fR, \fIzip_error_t\ *ze\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_open
+\fBzip_open\fR()
function opens the zip archive specified by
-\fIpath\fP
+\fIpath\fR
and returns a pointer to a
-struct zip,
+\fIstruct zip\fR,
used to manipulate the archive.
The
-flags
+\fIflags\fR
are specified by
-\fIor\fP'ing
+\fIor\fR'ing
the following values, or 0 for none of them.
-.TP ZIP_CHECKCONS
-\fRZIP_CHECKCONS\fP
+.RS 6n
+.TP 15n
+\fRZIP_CHECKCONS\fR
Perform additional stricter consistency checks on the archive, and
error if they fail.
-.TP ZIP_CHECKCONS
-\fRZIP_CREATE\fP
+.TP 15n
+\fRZIP_CREATE\fR
Create the archive if it does not exist.
-.TP ZIP_CHECKCONS
-\fRZIP_EXCL\fP
+.TP 15n
+\fRZIP_EXCL\fR
Error if archive already exists.
-.TP ZIP_CHECKCONS
-\fRZIP_TRUNCATE\fP
+.TP 15n
+\fRZIP_TRUNCATE\fR
If archive exists, ignore its current contents.
In other words, handle it the same way as an empty archive.
-.TP ZIP_CHECKCONS
-\fRZIP_RDONLY\fP
+.TP 15n
+\fRZIP_RDONLY\fR
Open archive in read-only mode.
+.RE
.PP
If an error occurs and
-\fIerrorp\fP
+\fIerrorp\fR
is
-non-\fRNULL\fP,
+non-\fRNULL\fR,
it will be set to the corresponding error code.
.PP
The
-zip_open_from_source
+\fBzip_open_from_source\fR()
function opens a zip archive encapsulated by the zip_source
-zs
+\fIzs\fR
using the provided
-flags.
+\fIflags\fR.
In case of error, the zip_error
-ze
+\fIze\fR
is filled in.
.SH "RETURN VALUES"
Upon successful completion
-zip_open
+\fBzip_open\fR()
and
-zip_open_from_source
+\fBzip_open_from_source\fR()
return a
-struct zip
+\fIstruct zip\fR
pointer.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and
-zip_open
+\fBzip_open\fR()
sets
-\fI*errorp\fP
+\fI*errorp\fR
to indicate the error, while
-zip_open_from source
+\fBzip_open_from\fR(\fIsource\fR)
sets
-\fIze\fP
+\fIze\fR
to indicate the error.
.SH "ERRORS"
The archive specified by
-\fIpath\fP
+\fIpath\fR
is opened unless:
-.TP 17n
-[\fRZIP_ER_EXISTS\fP]
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
The file specified by
-\fIpath\fP
+\fIpath\fR
exists and
-\fRZIP_EXCL\fP
+\fRZIP_EXCL\fR
is set.
-.TP 17n
-[\fRZIP_ER_INCONS\fP]
+.TP 19n
+[\fRZIP_ER_INCONS\fR]
Inconsistencies were found in the file specified by
-\fIpath\fP.
+\fIpath\fR.
This error is often caused by specifying
-\fRZIP_CHECKCONS\fP
+\fRZIP_CHECKCONS\fR
but can also happen without it.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
The
-\fIpath\fP
+\fIpath\fR
argument is
-\fRNULL\fP.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+\fRNULL\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_NOENT\fP]
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
The file specified by
-\fIpath\fP
+\fIpath\fR
does not exist and
-\fRZIP_CREATE\fP
+\fRZIP_CREATE\fR
is not set.
-.TP 17n
-[\fRZIP_ER_NOZIP\fP]
+.TP 19n
+[\fRZIP_ER_NOZIP\fR]
The file specified by
-\fIpath\fP
+\fIpath\fR
is not a zip archive.
-.TP 17n
-[\fRZIP_ER_OPEN\fP]
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
The file specified by
-\fIpath\fP
+\fIpath\fR
could not be opened.
-.TP 17n
-[\fRZIP_ER_READ\fP]
+.TP 19n
+[\fRZIP_ER_READ\fR]
A read error occurred; see
-errno
+\fIerrno\fR
for details.
-.TP 17n
-[\fRZIP_ER_SEEK\fP]
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
The file specified by
-\fIpath\fP
+\fIpath\fR
does not allow seeks.
.SH "SEE ALSO"
libzip(3),
zip_error_to_str(3),
zip_fdopen(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_RENAME" "3" "June 23, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_rename\fP
+\fBzip_rename\fR
\- rename file in zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_rename zip_t *archive zip_uint64_t index const char *name
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_rename\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *name\fR);
+.PD
.SH "DESCRIPTION"
-zip_rename
+\fBzip_rename\fR()
is the obsolete version of
zip_file_rename(3).
It is the same as calling
libzip(3),
zip_file_rename(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_rename.mdoc -- rename file in zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_SET_ARCHIVE_COMMENT" "3" "July 22, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_set_archive_comment\fP
+\fBzip_set_archive_comment\fR
\- set zip archive comment
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_archive_comment zip_t *archive const char *comment zip_uint16_t len
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_archive_comment\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_set_archive_comment
+\fBzip_set_archive_comment\fR()
function sets the comment for the entire zip archive.
If
-\fIcomment\fP
+\fIcomment\fR
is
-\fRNULL\fP
+\fRNULL\fR
and
-\fIlen\fP
+\fIlen\fR
is 0, the archive comment will be removed.
-\fIcomment\fP
+\fIcomment\fR
must be encoded in ASCII or UTF-8.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_set_archive_comment
+\fBzip_set_archive_comment\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIlen\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIlen\fR
is less than 0 or longer than the maximum comment length in a zip file
(65535), or
-\fIcomment\fP
+\fIcomment\fR
is not a valid UTF-8 encoded string.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_get_file_comment(3),
zip_set_file_comment(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_set_archive_comment.mdoc -- set zip archive comment
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 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>
.TH "ZIP_SET_ARCHIVE_FLAG" "3" "April 29, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_set_archive_flag\fP
+\fBzip_set_archive_flag\fR
\- set zip archive flag
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_archive_flag zip_t *archive zip_flags_t flag int value
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_archive_flag\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flag\fR, \fIint\ value\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_set_archive_flag
+\fBzip_set_archive_flag\fR()
function sets the flag
-\fIflag\fP
+\fIflag\fR
for the archive
-\fIarchive\fP
+\fIarchive\fR
to the value
-\fIvalue\fP.
+\fIvalue\fR.
.PP
Currently there are no supported flags.
.SH "RETURN VALUES"
libzip(3),
zip_get_archive_flag(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SET_DEFAULT_PASSWORD" "3" "January 3, 2011" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_set_default_password\fP
+\fBzip_set_default_password\fR
\- set default password for encrypted files in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_default_password zip_t *archive const char *password
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_default_password\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *password\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_set_default_password
+\fBzip_set_default_password\fR()
function sets the default password used when accessing encrypted files.
If
-\fIpassword\fP
+\fIpassword\fR
is
-\fRNULL\fP,
+\fRNULL\fR,
the default password is unset.
.PP
If you prefer a different password for single files, use
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_set_default_password
+\fBzip_set_default_password\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_fopen(3),
zip_fopen_encrypted(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_set_default_password.mdoc -- set default password for zip
-.\" Copyright (C) 2011-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2011-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_SET_FILE_COMMENT" "3" "June 23, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_set_file_comment\fP
+\fBzip_set_file_comment\fR
\- set comment for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_file_comment zip_t *archive zip_uint64_t index const char *comment int len
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIint\ len\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_set_file_comment
+\fBzip_set_file_comment\fR()
function is the obsolete version of
zip_file_set_comment(3).
The only differences are the type of the
-\fIlen\fP
+\fIlen\fR
argument and the additional
-\fIflags\fP
+\fIflags\fR
argument.
-zip_set_file_comment
+\fBzip_set_file_comment\fR()
is the same as calling
zip_file_set_comment(3)
with an empty
-\fIflags\fP
+\fIflags\fR
argument.
.SH "SEE ALSO"
libzip(3),
zip_file_set_comment(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_set_file_comment.mdoc -- set comment for file in zip
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
.TH "ZIP_SET_FILE_COMPRESSION" "3" "May 1, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_set_file_compression\fP
+\fBzip_set_file_compression\fR
\- set compression method for file in zip
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_set_file_compression zip_t *archive zip_uint64_t index zip_int32_t comp zip_uint32_t comp_flags
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_file_compression\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_int32_t\ comp\fR, \fIzip_uint32_t\ comp_flags\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_set_file_compression
+\fBzip_set_file_compression\fR()
function sets the compression method for the file at position
-\fIindex\fP
+\fIindex\fR
in the zip archive to
-\fIcomp\fP
+\fIcomp\fR
with the compression method specific
-\fIcomp_flags\fP.
+\fIcomp_flags\fR.
The
-\fIcomp\fP
+\fIcomp\fR
is the same as returned by
zip_stat(3).
For the
-\fIcomp\fP
+\fIcomp\fR
argument, currently only the following values are supported:
-.TP ZIP_CM_DEFLATE_XX
-\fRZIP_CM_DEFAULT\fP
+.TP 19n
+\fRZIP_CM_DEFAULT\fR
default compression; currently the same as
-\fRZIP_CM_DEFLATE\fP.
-.TP ZIP_CM_DEFLATE_XX
-\fRZIP_CM_STORE\fP
+\fRZIP_CM_DEFLATE\fR.
+.TP 19n
+\fRZIP_CM_STORE\fR
Store the file uncompressed.
-.TP ZIP_CM_DEFLATE_XX
-\fRZIP_CM_DEFLATE\fP
+.TP 19n
+\fRZIP_CM_DEFLATE\fR
Deflate the file with the
zlib(3)
algorithm and default options
.PP
The
-\fIcomp_flags\fP
+\fIcomp_flags\fR
argument is currently ignored.
.PP
The current compression method for a file in a zip archive can be
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_set_file_compression
+\fBzip_set_file_compression\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIarchive\fP,
+\fIarchive\fR,
or the argument combination is invalid.
-.TP 17n
-[\fRZIP_ER_COMPNOTSUPP\fP]
+.TP 19n
+[\fRZIP_ER_COMPNOTSUPP\fR]
Unsupported compression method requested.
-.TP 17n
-[\fRZIP_ER_RDONLY\fP]
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
Read-only zip file, no changes allowed.
.SH "SEE ALSO"
libzip(3),
zip_stat(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_set_file_compression.mdoc -- set compression method and its flags
-.\" Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2012-2015 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <libzip@nih.at>
-.TH "ZIP_SOURCE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.TH "ZIP_SOURCE" "3" "October 24, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source\fP
+\fBzip_source\fR
\- zip data source structure
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_source_t *zs;
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *zs\fR;
.SH "DESCRIPTION"
A
-struct zip_source
+\fIstruct zip_source\fR
is a data source used by
libzip(3)
for adding or replacing file contents for a file in a zip archive.
zip_source_function_create(3),
or
zip_source_zip(3).
-zip_source_t
+\fIzip_source_t\fR
is reference counted, and created with a reference count of 1.
zip_open_from_source(3),
zip_file_add(3),
and
-zip_file_replace(3).
+zip_file_replace(3)
will decrement the reference count of the
-zip_source_t
+\fIzip_source_t\fR
when they are done using it, so
zip_source_free(3)
only needs to be called when these functions return an error.
zip_source_function(3),
zip_source_zip(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_source.mdoc -- description of zip data source
-.\" Copyright (C) 2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2014-2015 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>
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd November 18, 2014
+.Dd October 24, 2015
.Dt ZIP_SOURCE 3
.Os
.Sh NAME
.Xr zip_open_from_source 3 ,
.Xr zip_file_add 3 ,
and
-.Xr zip_file_replace 3 .
+.Xr zip_file_replace 3
will decrement the reference count of the
.Vt zip_source_t
when they are done using it, so
.TH "ZIP_SOURCE_BEGIN_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_begin_write\fP
+\fBzip_source_begin_write\fR
\- prepare zip source for writing
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_begin_write zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_begin_write\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_begin_write
+\fBzip_source_begin_write\fR()
prepares
-source
+\fIsource\fR
for writing.
Usually this involves creating temporary files or allocating buffers.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_tell_write(3),
zip_source_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_BUFFER" "3" "October 17, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_buffer\fP
+\fBzip_source_buffer\fR
\- create zip data source from buffer
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_source_t *
-zip_source_buffer zip_t *archive const void *data zip_uint64_t len int freep
-zip_source_t *
-zip_source_buffer_create const void *data zip_uint64_t len int freep zip_error_t *error
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_buffer\fR(\fIzip_t\ *archive\fR, \fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR, \fIint\ freep\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_buffer_create\fR(\fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR, \fIint\ freep\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_buffer
+\fBzip_source_buffer\fR()
and
-zip_source_buffer_create
+\fBzip_source_buffer_create\fR()
create a zip source from the buffer
-\fIdata\fP
+\fIdata\fR
of size
-\fIlen\fP.
+\fIlen\fR.
If
-\fIfreep\fP
+\fIfreep\fR
is non-zero, the buffer will be freed when it is no longer needed.
-\fIdata\fP
+\fIdata\fR
must remain valid for the lifetime of the created source.
.PP
The source can be used to open a zip archive from.
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_buffer
+\fBzip_source_buffer\fR()
and
-zip_source_buffer_create
+\fBzip_source_buffer_create\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIlen\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIlen\fR
is greater than zero and
-\fIdata\fP
+\fIdata\fR
is
-\fRNULL\fP.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+\fRNULL\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_replace(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_CLOSE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_close\fP
+\fBzip_source_close\fR
\- open zip_source (which was open for reading)
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_close zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_close\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_close
+\fBzip_source_close\fR()
closes
-source,
+\fIsource\fR,
indicating that no more data will be read.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_free(3),
zip_source_open(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_COMMIT_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_commit_write\fP
+\fBzip_source_commit_write\fR
\- finalize changes to zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_commit_write zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_commit_write\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_commit_write
+\fBzip_source_commit_write\fR()
finishes writing data to
-source
+\fIsource\fR
and replaces the original with the newly written data.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_tell_write(3),
zip_source_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_ERROR" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_error\fP
+\fBzip_source_error\fR
\- get zip error for data source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_error_t *
-zip_source_error zip_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIzip_error_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_error\fR(\fIzip_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_source_error
+\fBzip_source_error\fR()
function returns the zip error for the data source
-\fIsource\fP.
+\fIsource\fR.
.SH "SEE ALSO"
libzip(3),
zip_error_code_system(3),
zip_error_code_zip(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_FILE" "3" "March 11, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_file\fP
+\fBzip_source_file\fR
\- create data source from a file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip_source_t *
-zip_source_file zip_t *archive const char *fname zip_uint64_t start zip_int64_t len
-zip_source_t *
-zip_source_file_create const char *fname zip_uint64_t start zip_int64_t len zip_error_t *error
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_file\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_file_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_file
+\fBzip_source_file\fR()
and
-zip_source_file_create
+\fBzip_source_file_create\fR()
create a zip source from a file.
They open
-\fIfname\fP
+\fIfname\fR
and read
-\fIlen\fP
+\fIlen\fR
bytes from offset
-\fIstart\fP
+\fIstart\fR
from it.
If
-\fIlen\fP
+\fIlen\fR
is 0 or \-1, the whole file (starting from
-\fIstart\fP)
+\fIstart\fR)
is used.
.PP
If the file supports seek, the source can be used to open a zip archive from.
.PP
The file is opened and read when the data from the source is used, usually by
-zip_close
+\fBzip_close\fR()
or
-zip_open_from_source.
+\fBzip_open_from_source\fR().
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_file
+\fBzip_source_file\fR()
and
-zip_source_file_create
+\fBzip_source_file_create\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIfname\fP,
-\fIstart\fP,
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
or
-\fIlen\fP
+\fIlen\fR
are invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_OPEN\fP]
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
Opening
-\fIfname\fP
+\fIfname\fR
failed.
.SH "SEE ALSO"
libzip(3),
zip_replace(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
-.TH "ZIP_SOURCE_FILEP" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.TH "ZIP_SOURCE_FILEP" "3" "November 10, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_filep\fP
+\fBzip_source_filep\fR
\- create data source from FILE *
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip_source_t *
-zip_source_filep zip_t *archive FILE *file zip_uint64_t start zip_int64_t len
-zip_source_t *
-zip_source_filep FILE *file zip_uint64_t start zip_int64_t len zip_error_t *error
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_filep\fR(\fIzip_t\ *archive\fR, \fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_filep\fR(\fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_filep
+\fBzip_source_filep\fR()
and
-zip_source_filep_create
+\fBzip_source_filep_create\fR()
create a zip source from a file stream.
They read
-\fIlen\fP
+\fIlen\fR
bytes from offset
-\fIstart\fP
+\fIstart\fR
from the open file stream
-\fIfile\fP.
+\fIfile\fR.
If
-\fIlen\fP
+\fIlen\fR
is 0 or \-1, the whole file (starting from
-\fIstart\fP)
+\fIstart\fR)
is used.
.PP
-If the file stream supports seeking, the source can be used to open a read-only zip archive from.
+If the file stream supports seeking, the source can be used to open
+a read-only zip archive from.
+.PP
+The file stream is closed when the source is being freed, usually
+by
+zip_close(3).
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_filep
+\fBzip_source_filep\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIfile\fP,
-\fIstart\fP,
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfile\fR,
+\fIstart\fR,
or
-\fIlen\fP
+\fIlen\fR
are invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_replace(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_source_filep.mdoc -- create data source from a file stream
-.\" Copyright (C) 2004-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2004-2015 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>
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd November 18, 2014
+.Dd November 10, 2015
.Dt ZIP_SOURCE_FILEP 3
.Os
.Sh NAME
.Ar start )
is used.
.Pp
-If the file stream supports seeking, the source can be used to open a read-only zip archive from.
+If the file stream supports seeking, the source can be used to open
+a read-only zip archive from.
+.Pp
+The file stream is closed when the source is being freed, usually
+by
+.Xr zip_close 3 .
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.TH "ZIP_SOURCE_FREE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_free\fP
+\fBzip_source_free\fR
\- free zip data source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_source_free zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_source_free\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_free
+\fBzip_source_free\fR()
decrements the reference count of
-\fIsource\fP
+\fIsource\fR
and frees it if the reference count drops to 0.
If
-\fIsource\fP
+\fIsource\fR
is
-\fRNULL\fP,
+\fRNULL\fR,
it does nothing.
.PP
-\fINOTE\fP:
+\fINOTE\fR:
This function should not be called on a
-\fIsource\fP
+\fIsource\fR
after it was used successfully in a
zip_open_from_source(3),
zip_add(3),
zip_source(3),
zip_source_keep(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_FUNCTION" "3" "November 13, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_function\fP
+\fBzip_source_function\fR
\- create data source from function
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_source_t *
-zip_source_function zip_t *archive zip_source_callback fn void *userdata
-zip_source_t *
-zip_source_function_create zip_source_callback fn void *userdata zip_error_t *error
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_function\fR(\fIzip_t\ *archive\fR, \fIzip_source_callback\ fn\fR, \fIvoid\ *userdata\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_function_create\fR(\fIzip_source_callback\ fn\fR, \fIvoid\ *userdata\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_function
+\fBzip_source_function\fR()
and
-zip_source_function_create
+\fBzip_source_function_create\fR()
creates a zip source from the user-provided function
-\fIfn\fP,
+\fIfn\fR,
which must be of the following type:
.PP
-typedef zip_int64_t
-\fR(*\fPzip_source_callback\fR)\fP
-void *userdata void *data zip_uint64_t len zip_source_cmd_t cmd
+\fItypedef zip_int64_t\fR
+\fB\fR(*\fPzip_source_callback\fR)\fP\fR(\fIvoid\ *userdata\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR, \fIzip_source_cmd_t\ cmd\fR)
.PP
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
are used for reporting errors and can be
-\fRNULL\fP.
+\fRNULL\fR.
.PP
When called by the library, the first argument is the
-\fIuserdata\fP
+\fIuserdata\fR
argument supplied to the function.
The next two arguments are a buffer
-\fIdata\fP
+\fIdata\fR
of size
-\fIlen\fP
+\fIlen\fR
when data is passed in or expected to be returned, or else
-\fRNULL\fP
+\fRNULL\fR
and 0.
The last argument,
-\fIcmd\fP,
+\fIcmd\fR,
specifies which action the function should perform.
.PP
Depending on the uses, there are three useful sets of commands to be supported by a
-zip_source_callback:
-.TP seekable-read-sourceXX
+\fBzip_source_callback\fR():
+.TP 24n
read source
Providing streamed data (for file data added to archives).
Must support
-\fRZIP_SOURCE_OPEN\fP,
-\fRZIP_SOURCE_READ\fP,
-\fRZIP_SOURCE_CLOSE\fP,
-\fRZIP_SOURCE_STAT\fP,
+\fRZIP_SOURCE_OPEN\fR,
+\fRZIP_SOURCE_READ\fR,
+\fRZIP_SOURCE_CLOSE\fR,
+\fRZIP_SOURCE_STAT\fR,
and
-\fRZIP_SOURCE_ERROR\fP.
-.TP seekable-read-sourceXX
+\fRZIP_SOURCE_ERROR\fR.
+.TP 24n
seekable read source
Same as previous, but from a source allowing reading from arbitrary
offsets (also for read-only zip archive).
Must additionally support
-\fRZIP_SOURCE_SEEK\fP,
-\fRZIP_SOURCE_TELL\fP,
+\fRZIP_SOURCE_SEEK\fR,
+\fRZIP_SOURCE_TELL\fR,
and
-\fRZIP_SOURCE_SUPPORTS\fP.
-.TP seekable-read-sourceXX
+\fRZIP_SOURCE_SUPPORTS\fR.
+.TP 24n
read/write source
Same as previous, but additionally allowing writing (also for writable
zip archives).
Must additionally support
-\fRZIP_SOURCE_BEGIN_WRITE\fP,
-\fRZIP_SOURCE_COMMIT_WRITE\fP,
-\fRZIP_SOURCE_ROLLBACK_WRITE\fP,
-\fRZIP_SOURCE_SEEK_WRITE\fP,
-\fRZIP_SOURCE_TELL_WRITE\fP,
+\fRZIP_SOURCE_BEGIN_WRITE\fR,
+\fRZIP_SOURCE_COMMIT_WRITE\fR,
+\fRZIP_SOURCE_ROLLBACK_WRITE\fR,
+\fRZIP_SOURCE_SEEK_WRITE\fR,
+\fRZIP_SOURCE_TELL_WRITE\fR,
and
-\fRZIP_SOURCE_REMOVE\fP.
-.SS "\fRZIP_SOURCE_BEGIN_WRITE\fP"
+\fRZIP_SOURCE_REMOVE\fR.
+.SS "\fRZIP_SOURCE_BEGIN_WRITE\fR"
Prepare the source for writing.
Use this to create any temporary file(s).
-.SS "\fRZIP_SOURCE_CLOSE\fP"
+.SS "\fRZIP_SOURCE_CLOSE\fR"
Reading is done.
-.SS "\fRZIP_SOURCE_COMMIT_WRITE\fP"
+.SS "\fRZIP_SOURCE_COMMIT_WRITE\fR"
Finish writing to the source.
Replace the original data with the newly written data.
Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the
newly written data.
-.SS "\fRZIP_SOURCE_ERROR\fP"
+.SS "\fRZIP_SOURCE_ERROR\fR"
Get error information.
-\fIdata\fP
+\fIdata\fR
points to an array of two ints, which should be filled with the libzip
error code and the corresponding system error code for the error that
occurred.
zip_error_to_data(3)
and return its return value.
Otherwise, return 2 * sizeof(int).
-.SS "\fRZIP_SOURCE_FREE\fP"
+.SS "\fRZIP_SOURCE_FREE\fR"
Clean up and free all resources, including
-\fIstate\fP.
+\fIstate\fR.
The callback function will not be called again.
-.SS "\fRZIP_SOURCE_OPEN\fP"
+.SS "\fRZIP_SOURCE_OPEN\fR"
Prepare for reading.
-.SS "\fRZIP_SOURCE_READ\fP"
+.SS "\fRZIP_SOURCE_READ\fR"
Read data into the buffer
-\fIdata\fP
+\fIdata\fR
of size
-\fIlen\fP.
+\fIlen\fR.
Return the number of bytes placed into
-\fIdata\fP
+\fIdata\fR
on success.
-.SS "\fRZIP_SOURCE_REMOVE\fP"
+.SS "\fRZIP_SOURCE_REMOVE\fR"
Remove the underlying file.
This is called if a zip archive is empty when closed.
-.SS "\fRZIP_SOURCE_ROLLBACK_WRITE\fP"
+.SS "\fRZIP_SOURCE_ROLLBACK_WRITE\fR"
Abort writing to the source.
Discard written data.
Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the
original data.
-.SS "\fRZIP_SOURCE_SEEK\fP"
+.SS "\fRZIP_SOURCE_SEEK\fR"
Specify position to read next byte from, like
fseek(3).
Use
ZIP_SOURCE_GET_ARGS(3)
to decode the arguments into the following struct:
.nf
+.sp
+.RS 0n
struct zip_source_args_seek {
zip_int64_t offset;
int whence;
};
+.RE
.fi
.PP
If the size of the source's data is known, use
zip_source_seek_compute_offset(3)
to validate the arguments and compute the new offset.
-.SS "\fRZIP_SOURCE_SEEK_WRITE\fP"
+.SS "\fRZIP_SOURCE_SEEK_WRITE\fR"
Specify position to write next byte to, like
fseek(3).
See
-\fRZIP_SOURCE_SEEK\fP
+\fRZIP_SOURCE_SEEK\fR
for details.
-.SS "\fRZIP_SOURCE_STAT\fP"
+.SS "\fRZIP_SOURCE_STAT\fR"
Get meta information for the input data.
-\fIdata\fP
+\fIdata\fR
points to an allocated
-struct zip_stat,
+\fIstruct zip_stat\fR,
which should be initialized using
zip_stat_init(3)
and then filled in.
Information only available after the source has been read (e.g. size)
can be omitted in an earlier call.
Return sizeof(struct zip_stat) on success.
-\fINOTE\fP:
-zip_source_function
+\fINOTE\fR:
+\fBzip_source_function\fR()
may be called with this argument even after being called with
-\fRZIP_SOURCE_CLOSE\fP.
-.SS "\fRZIP_SOURCE_SUPPORTS\fP"
+\fRZIP_SOURCE_CLOSE\fR.
+.SS "\fRZIP_SOURCE_SUPPORTS\fR"
Return bitmap specifying which commands are supported.
Use
zip_source_make_command_bitmap(3).
If this command is not implemented, the source is assumed to be a
read source without seek support.
-.SS "\fRZIP_SOURCE_TELL\fP"
+.SS "\fRZIP_SOURCE_TELL\fR"
Return the current read offset in the source, like
ftell(3).
-.SS "\fRZIP_SOURCE_TELL_WRITE\fP"
+.SS "\fRZIP_SOURCE_TELL_WRITE\fR"
Return the current write offset in the source, like
ftell(3).
-.SS "\fRZIP_SOURCE_WRITE\fP"
+.SS "\fRZIP_SOURCE_WRITE\fR"
Write data to the source.
Return number of bytes written.
.SS "Return Values"
Commands should return \-1 on error.
-\fRZIP_SOURCE_ERROR\fP
+\fRZIP_SOURCE_ERROR\fR
will be called to retrieve the error code.
On success, commands return 0, unless specified otherwise in the
description above.
.SS "Calling Conventions"
The library will always issue
-\fRZIP_SOURCE_OPEN\fP
+\fRZIP_SOURCE_OPEN\fR
before issuing
-\fRZIP_SOURCE_READ\fP,
-\fRZIP_SOURCE_SEEK\fP,
+\fRZIP_SOURCE_READ\fR,
+\fRZIP_SOURCE_SEEK\fR,
or
-\fRZIP_SOURCE_TELL\fP.
+\fRZIP_SOURCE_TELL\fR.
When it no longer wishes to read from this source, it will issue
-\fRZIP_SOURCE_CLOSE\fP.
+\fRZIP_SOURCE_CLOSE\fR.
If the library wishes to read the data again, it will issue
-\fRZIP_SOURCE_OPEN\fP
+\fRZIP_SOURCE_OPEN\fR
a second time.
If the function is unable to provide the data again, it should
return \-1.
.PP
-\fRZIP_SOURCE_BEGIN_WRITE\fP
+\fRZIP_SOURCE_BEGIN_WRITE\fR
will be called before
-\fRZIP_SOURCE_WRITE\fP,
-\fRZIP_SOURCE_SEEK_WRITE\fP,
+\fRZIP_SOURCE_WRITE\fR,
+\fRZIP_SOURCE_SEEK_WRITE\fR,
or
-\fRZIP_SOURCE_TELL_WRITE\fP.
+\fRZIP_SOURCE_TELL_WRITE\fR.
When writing is complete, either
-\fRZIP_SOURCE_COMMIT_WRITE\fP
+\fRZIP_SOURCE_COMMIT_WRITE\fR
or
-\fRZIP_SOURCE_ROLLBACK_WRITE\fP
+\fRZIP_SOURCE_ROLLBACK_WRITE\fR
will be called.
.PP
-\fRZIP_SOURCE_STAT\fP
+\fRZIP_SOURCE_STAT\fR
can be issued at any time.
.PP
-\fRZIP_SOURCE_ERROR\fP
+\fRZIP_SOURCE_ERROR\fR
will only be issued in response to the function
returning \-1.
.PP
-\fRZIP_SOURCE_FREE\fP
+\fRZIP_SOURCE_FREE\fR
will be the last command issued;
if
-\fRZIP_SOURCE_OPEN\fP
+\fRZIP_SOURCE_OPEN\fR
was called and succeeded,
-\fRZIP_SOURCE_CLOSE\fP
+\fRZIP_SOURCE_CLOSE\fR
will be called before
-\fRZIP_SOURCE_FREE\fP,
+\fRZIP_SOURCE_FREE\fR,
and similarly for
-\fRZIP_SOURCE_BEGIN_WRITE\fP
+\fRZIP_SOURCE_BEGIN_WRITE\fR
and
-\fRZIP_SOURCE_COMMIT_WRITE\fP
+\fRZIP_SOURCE_COMMIT_WRITE\fR
or
-\fRZIP_SOURCE_ROLLBACK_WRITE\fP.
+\fRZIP_SOURCE_ROLLBACK_WRITE\fR.
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error (unless
it is
-\fRNULL\fP).
+\fRNULL\fR).
.SH "ERRORS"
-zip_source_function
+\fBzip_source_function\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
.SH "SEE ALSO"
libzip(3),
zip_source(3),
zip_stat_init(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_IS_DELETED" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_is_deleted\fP
+\fBzip_source_is_deleted\fR
\- check if zip_source is deleted
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_is_deleted zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_is_deleted\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_is_deleted
+\fBzip_source_is_deleted\fR()
returns whether the zip_source was deleted.
This can for example happen when all entries are removed from a zip archive.
.SH "RETURN VALUES"
-zip_source_is_deleted
+\fBzip_source_is_deleted\fR()
returns 1 if the zip_source is deleted and 0 otherwise.
.SH "SEE ALSO"
libzip(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_KEEP" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_keep\fP
+\fBzip_source_keep\fR
\- increment reference count of zip data source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_source_keep zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_source_keep\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_keep
+\fBzip_source_keep\fR()
increments the reference count of
-\fIsource\fP.
+\fIsource\fR.
.SH "SEE ALSO"
libzip(3),
zip_source(3),
zip_source_free(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_MAKE_COMMAND_BITMAP" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_make_command_bitmap\fP
+\fBzip_source_make_command_bitmap\fR
\- create bitmap of supported source operations
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_source_make_command_bitmap zip_source_cmd_t command ...
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_make_command_bitmap\fR(\fIzip_source_cmd_t\ command\fR, \fI...\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_source_make_command_bitmap
+\fBzip_source_make_command_bitmap\fR()
function returns a bitmap of source commands suitable as return value
for
-\fRZIP_SOURCE_SUPPORTS\fP.
+\fRZIP_SOURCE_SUPPORTS\fR.
It includes all the commands from the argument list, which must be
terminated by \-1.
.SH "SEE ALSO"
libzip(3),
zip_source_function(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_OPEN" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_open\fP
+\fBzip_source_open\fR
\- open zip_source for reading
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_open zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_open\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_open
+\fBzip_source_open\fR()
opens
-source
+\fIsource\fR
for reading.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_seek(3),
zip_source_tell(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_READ" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_read\fP
+\fBzip_source_read\fR
\- read data from zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_source_read zip_source_t *source void *data zip_uint64_t len
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_read\fR(\fIzip_source_t\ *source\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_read
+\fBzip_source_read\fR()
reads up to
-\fIlen\fP
+\fIlen\fR
bytes of data from
-\fIsource\fP
+\fIsource\fR
at the current read offset into the buffer
-\fIdata\fP.
+\fIdata\fR.
.PP
The zip source
-\fIsource\fP
+\fIsource\fR
has to be opened for reading by calling
zip_source_open(3)
first.
.SH "RETURN VALUES"
Upon successful completion the number of bytes read is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_tell(3),
zip_source_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_ROLLBACK_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_rollback_write\fP
+\fBzip_source_rollback_write\fR
\- undo changes to zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_rollback_write zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_rollback_write\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_rollback_write
+\fBzip_source_rollback_write\fR()
reverts changes written to
-source,
+\fIsource\fR,
restoring the data before
zip_source_begin_write(3)
was called.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_tell_write(3),
zip_source_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.Fn zip_source_rollback_write
reverts changes written to
.Fa source ,
-restoring the data before
+restoring the data before
.Xr zip_source_begin_write 3
was called.
Usually this removes temporary files or frees buffers.
.TH "ZIP_SOURCE_SEEK" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_seek\fP
+\fBzip_source_seek\fR
\- set read offset in zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_seek zip_source_t *source zip_int64_t offset int whence
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_seek\fR(\fIzip_source_t\ *source\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_seek
+\fBzip_source_seek\fR()
sets the current read offset for
-source.
+\fIsource\fR.
Just like in
fseek(3),
depending on the
-\fIwhence\fP
+\fIwhence\fR
argument, the
-\fIoffset\fP
+\fIoffset\fR
is counted relative from:
-.TP SEEK_CURXX
-\fRSEEK_SET\fP
+.RS 6n
+.TP 12n
+\fRSEEK_SET\fR
start of file
-.TP SEEK_CURXX
-\fRSEEK_CUR\fP
+.TP 12n
+\fRSEEK_CUR\fR
current read offset in file
-.TP SEEK_CURXX
-\fRSEEK_END\fP
+.TP 12n
+\fRSEEK_END\fR
end of file
+.RE
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_read(3),
zip_source_tell(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
-.TH "ZIP_SOURCE_SEEK_COMPUTE_OFFSET" "1" "November 13, 2014" "NiH" "LOCAL"
+.TH "ZIP_SOURCE_SEEK_COMPUTE_OFFSET" "3" "November 13, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_seek_compute_offset\fP
+\fBzip_source_seek_compute_offset\fR
\- validate arguments and compute offset
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_source_seek_compute_offset zip_uint64_t offset zip_uint64_t length void *data zip_uint64_t data_length zip_error_t *error
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_seek_compute_offset\fR(\fIzip_uint64_t\ offset\fR, \fIzip_uint64_t\ length\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ data_length\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
Use this function to compute the offset for a
-\fRZIP_SOURCE_SEEK\fP
+\fRZIP_SOURCE_SEEK\fR
or
-\fRZIP_SOURCE_SEEK_WRITE\fP
+\fRZIP_SOURCE_SEEK_WRITE\fR
command.
-\fIdata\fP
+\fIdata\fR
and
-\fIdata_length\fP
+\fIdata_length\fR
are the arguments to the source callback,
-\fIoffset\fP
+\fIoffset\fR
is the current offset and
-\fIlength\fP
+\fIlength\fR
is the length of the source data or, for
-\fRZIP_SOURCE_SEEK_WRITE\fP,
+\fRZIP_SOURCE_SEEK_WRITE\fR,
the amount of data written.
.SH "RETURN VALUES"
On success, it returns the new offset, on error it returns \-1 and
sets
-\fIerror\fP.
+\fIerror\fR.
.SH "ERRORS"
-zip_source_seek_compute_offset
+\fBzip_source_seek_compute_offset\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
One of the arguments is invalid or the seek would place the offset
outside the data.
.SH "SEE ALSO"
zip_source_function(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 13, 2014
-.Dt ZIP_SOURCE_SEEK_COMPUTE_OFFSET
+.Dt ZIP_SOURCE_SEEK_COMPUTE_OFFSET 3
.Os
.Sh NAME
.Nm zip_source_seek_compute_offset
.TH "ZIP_SOURCE_SEEK_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_seek_write\fP
+\fBzip_source_seek_write\fR
\- set write offset in zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_seek_write zip_source_t *source zip_int64_t offset int whence
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_seek_write\fR(\fIzip_source_t\ *source\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_seek_write
+\fBzip_source_seek_write\fR()
sets the current write offset for
-source.
+\fIsource\fR.
Just like in
fseek(3),
depending on the
-\fIwhence\fP
+\fIwhence\fR
argument, the
-\fIoffset\fP
+\fIoffset\fR
is counted relative from:
-.TP SEEK_CURXX
-\fRSEEK_SET\fP
+.RS 6n
+.TP 12n
+\fRSEEK_SET\fR
start of file
-.TP SEEK_CURXX
-\fRSEEK_CUR\fP
+.TP 12n
+\fRSEEK_CUR\fR
current write offset in file
-.TP SEEK_CURXX
-\fRSEEK_END\fP
+.TP 12n
+\fRSEEK_END\fR
end of file
+.RE
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_tell_write(3),
zip_source_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_STAT" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_stat\fP
+\fBzip_source_stat\fR
\- get information about zip_source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_source_stat zip_source_t *source zip_stat_t *sb
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_stat\fR(\fIzip_source_t\ *source\fR, \fIzip_stat_t\ *sb\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_source_stat
+\fBzip_source_stat\fR()
function obtains information about the zip source
-\fIsource\fP
+\fIsource\fR
.PP
The
-\fIsb\fP
+\fIsb\fR
argument is a pointer to a
-struct zip_source_stat
+\fIstruct zip_source_stat\fR
(shown below), into which information about the zip source is placed.
.nf
+.sp
+.RS 0n
struct zip_source_stat {
zip_uint64_t valid; /* which fields have valid values */
const char *name; /* name of the file */
zip_uint16_t encryption_method; /* encryption method used */
zip_uint32_t flags; /* reserved for future use */
};
+.RE
.fi
The structure pointed to by
-\fIsb\fP
+\fIsb\fR
must be initialized with
-zip_stat_init 3
+\fBzip_stat_init\fR(\fI3\fR)
before calling
-zip_source_stat.
+\fBzip_source_stat\fR().
.PP
The
-\fIvalid\fP
+\fIvalid\fR
field of the structure specifies which other fields are valid.
Check if the flag defined by the following defines are in
-\fIvalid\fP
+\fIvalid\fR
before accessing the fields:
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_NAME\fP
-\fIname\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_INDEX\fP
-\fIindex\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_SIZE\fP
-\fIsize\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_COMP_SIZE\fP
-\fIcomp_size\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_MTIME\fP
-\fImtime\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_CRC\fP
-\fIcrc\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_COMP_METHOD\fP
-\fIcomp_method\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_ENCRYPTION_METHOD\fP
-\fIencryption_method\fP
-.TP ZIP_SOURCE_STAT_ENCRYPTION_METHODXX
-\fRZIP_SOURCE_STAT_FLAGS\fP
-\fIflags\fP
+.RS 6n
+.PD 0
+.TP 37n
+\fRZIP_SOURCE_STAT_NAME\fR
+\fIname\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_INDEX\fR
+\fIindex\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_SIZE\fR
+\fIsize\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_COMP_SIZE\fR
+\fIcomp_size\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_MTIME\fR
+\fImtime\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_CRC\fR
+\fIcrc\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_COMP_METHOD\fR
+\fIcomp_method\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_ENCRYPTION_METHOD\fR
+\fIencryption_method\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_FLAGS\fR
+\fIflags\fR
+.RE
+.PD
.PP
-\fINOTE\fP:
+\fINOTE\fR:
Some fields may only be filled out after all data has been read from
the source, for example the
-\fIcrc\fP
+\fIcrc\fR
or
-\fIsize\fP
+\fIsize\fR
fields.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_TELL" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_tell\fP
+\fBzip_source_tell\fR
\- report current read offset in zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_source_tell zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_tell\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_tell
+\fBzip_source_tell\fR()
returns the current read offset
for
-source.
+\fIsource\fR.
The return value can be passed to
zip_source_seek(3)
with
-\fIwhence\fP
+\fIwhence\fR
set to
-\fRSEEK_SET\fP
+\fRSEEK_SET\fR
to return to the same location in the source.
.SH "RETURN VALUES"
Upon successful completion the current read offset is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_read(3),
zip_source_tell(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_TELL_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_tell_write\fP
+\fBzip_source_tell_write\fR
\- report current write offset in zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_source_tell_write zip_source_t *source
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_tell_write\fR(\fIzip_source_t\ *source\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_tell_write
+\fBzip_source_tell_write\fR()
returns the current write offset
for
-source.
+\fIsource\fR.
The return value can be passed to
zip_source_seek_write(3)
with
-\fIwhence\fP
+\fIwhence\fR
set to
-\fRSEEK_SET\fP
+\fRSEEK_SET\fR
to return to the same location in the source.
.SH "RETURN VALUES"
Upon successful completion the current write offset is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_tell_write(3),
zip_source_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_WIN32A" "3" "March 11, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_win32a\fP,
-\fBzip_source_win32a_create\fP
+\fBzip_source_win32a\fR,
+\fBzip_source_win32a_create\fR
\- create data source from a Windows ANSI file name
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip_source_t *
-zip_source_win32a zip_t *archive const char *fname zip_uint64_t start zip_int64_t len
-zip_source_t *
-zip_source_win32a_create const char *fname zip_uint64_t start zip_int64_t len zip_error_t *error
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32a\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32a_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_win32a
+\fBzip_source_win32a\fR()
and
-zip_source_win32a_create
+\fBzip_source_win32a_create\fR()
create a zip source on Windows using a Windows ANSI name.
They open
-\fIfname\fP
+\fIfname\fR
and read
-\fIlen\fP
+\fIlen\fR
bytes from offset
-\fIstart\fP
+\fIstart\fR
from it.
If
-\fIlen\fP
+\fIlen\fR
is 0 or \-1, the whole file (starting from
-\fIstart\fP)
+\fIstart\fR)
is used.
.PP
If the file supports seek, the source can be used to open a zip archive from.
.PP
The file is opened and read when the data from the source is used, usually by
-zip_close
+\fBzip_close\fR()
or
-zip_open_from_source.
+\fBzip_open_from_source\fR().
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_win32a
+\fBzip_source_win32a\fR()
and
-zip_source_win32a_create
+\fBzip_source_win32a_create\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIfname\fP,
-\fIstart\fP,
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
or
-\fIlen\fP
+\fIlen\fR
are invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_OPEN\fP]
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
Opening
-\fIfname\fP
+\fIfname\fR
failed.
.SH "SEE ALSO"
libzip(3),
zip_source_win32handle(3),
zip_source_win32w(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_WIN32HANDLE" "3" "March 11, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_win32handle\fP,
-\fBzip_source_win32handle_create\fP
+\fBzip_source_win32handle\fR,
+\fBzip_source_win32handle_create\fR
\- create data source from a Windows file handle
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip_source_t *
-zip_source_win32handle zip_t *archive HANDLE h zip_uint64_t start zip_int64_t len
-zip_source_t *
-zip_source_win32handle_create HANDLE h zip_uint64_t start zip_int64_t len zip_error_t *error
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32handle\fR(\fIzip_t\ *archive\fR, \fIHANDLE\ h\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32handle_create\fR(\fIHANDLE\ h\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_win32handle
+\fBzip_source_win32handle\fR()
and
-zip_source_win32handle_create
+\fBzip_source_win32handle_create\fR()
create a zip source from a Windows file handle.
They open
-\fIfname\fP
+\fIfname\fR
and read
-\fIlen\fP
+\fIlen\fR
bytes from offset
-\fIstart\fP
+\fIstart\fR
from it.
If
-\fIlen\fP
+\fIlen\fR
is 0 or \-1, the whole file (starting from
-\fIstart\fP)
+\fIstart\fR)
is used.
.PP
If the file supports seek, the source can be used to open a zip archive from.
.PP
The file is opened and read when the data from the source is used, usually by
-zip_close
+\fBzip_close\fR()
or
-zip_open_from_source.
+\fBzip_open_from_source\fR().
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_w32handle
+\fBzip_source_w32handle\fR()
and
-zip_source_w32handle_create
+\fBzip_source_w32handle_create\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIfname\fP,
-\fIstart\fP,
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
or
-\fIlen\fP
+\fIlen\fR
are invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_OPEN\fP]
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
Opening
-\fIfname\fP
+\fIfname\fR
failed.
.SH "SEE ALSO"
libzip(3),
zip_source_win32a(3),
zip_source_win32w(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_WIN32W" "3" "March 11, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_win32w\fP,
-\fBzip_source_win32w_create\fP
+\fBzip_source_win32w\fR,
+\fBzip_source_win32w_create\fR
\- create data source from a Windows Unicode file name
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip_source_t *
-zip_source_win32w zip_t *archive const char *fname zip_uint64_t start zip_int64_t len
-zip_source_t *
-zip_source_win32w_create const char *fname zip_uint64_t start zip_int64_t len zip_error_t *error
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32w\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32w_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
.SH "DESCRIPTION"
The functions
-zip_source_win32w
+\fBzip_source_win32w\fR()
and
-zip_source_win32w_create
+\fBzip_source_win32w_create\fR()
create a zip source on Windows using a Windows Unicode name.
They open
-\fIfname\fP
+\fIfname\fR
and read
-\fIlen\fP
+\fIlen\fR
bytes from offset
-\fIstart\fP
+\fIstart\fR
from it.
If
-\fIlen\fP
+\fIlen\fR
is 0 or \-1, the whole file (starting from
-\fIstart\fP)
+\fIstart\fR)
is used.
.PP
If the file supports seek, the source can be used to open a zip archive from.
.PP
The file is opened and read when the data from the source is used, usually by
-zip_close
+\fBzip_close\fR()
or
-zip_open_from_source.
+\fBzip_open_from_source\fR().
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
or
-\fIerror\fP
+\fIerror\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_win32w
+\fBzip_source_win32w\fR()
and
-zip_source_win32w_create
+\fBzip_source_win32w_create\fR()
fail if:
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIfname\fP,
-\fIstart\fP,
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
or
-\fIlen\fP
+\fIlen\fR
are invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
-.TP 17n
-[\fRZIP_ER_OPEN\fP]
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
Opening
-\fIfname\fP
+\fIfname\fR
failed.
.SH "SEE ALSO"
libzip(3),
zip_source_win32a(3),
zip_source_win32handle(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_write\fP
+\fBzip_source_write\fR
\- write data to zip source
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_int64_t
-zip_source_write zip_source_t *source const void *data zip_uint64_t len
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_write\fR(\fIzip_source_t\ *source\fR, \fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_write
+\fBzip_source_write\fR()
writes
-\fIlen\fP
+\fIlen\fR
bytes from the buffer
-\fIdata\fP
+\fIdata\fR
to the zip source
-\fIsource\fP
+\fIsource\fR
at the current write offset.
.PP
The zip source
-\fIsource\fP
+\fIsource\fR
has to be prepared for writing by calling
zip_source_begin_write(3)
first.
.SH "RETURN VALUES"
Upon successful completion the number of bytes written is returned.
Otherwise, \-1 is returned and the error information in
-\fIsource\fP
+\fIsource\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_source_seek_write(3),
zip_source_tell_write(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_SOURCE_ZIP" "3" "August 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_source_zip\fP
+\fBzip_source_zip\fR
\- create data source from zip file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-zip_source_t *
-zip_source_zip zip_t *archive zip_t *srcarchive zip_uint64_t srcidx zip_flags_t flags zip_uint64_t start zip_int64_t len
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_zip\fR(\fIzip_t\ *archive\fR, \fIzip_t\ *srcarchive\fR, \fIzip_uint64_t\ srcidx\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
.SH "DESCRIPTION"
The function
-zip_source_zip
+\fBzip_source_zip\fR()
creates a zip source from a file in a zip archive.
The
-\fIsrcarchive\fP
+\fIsrcarchive\fR
argument is the (open) zip archive containing the source zip file
at index
-\fIsrcidx\fP.
-\fIlen\fP
+\fIsrcidx\fR.
+\fIlen\fR
bytes from offset
-\fIstart\fP
+\fIstart\fR
will be used in the zip_source.
If
-\fIlen\fP
+\fIlen\fR
is 0 or \-1, the rest of the file, starting from
-\fIstart\fP,
+\fIstart\fR,
is used.
If
-\fIstart\fP
+\fIstart\fR
is zero and
-\fIlen\fP
+\fIlen\fR
is \-1, the whole file will be copied without decompressing it.
.PP
Supported flags are:
-.TP XZIPXFLXRECOMPRESSXXX
-\fRZIP_FL_UNCHANGED\fP
+.TP 23n
+\fRZIP_FL_UNCHANGED\fR
Try to get the original data without any changes that may have been
made to
-\fIsrcarchive\fP
+\fIsrcarchive\fR
after opening it.
-.TP XZIPXFLXRECOMPRESSXXX
-\fRZIP_FL_RECOMPRESS\fP
+.TP 23n
+\fRZIP_FL_RECOMPRESS\fR
When adding the data from
-\fIsrcarchive\fP,
+\fIsrcarchive\fR,
re-compress it using the current settings instead of copying the
compressed data.
.SH "RETURN VALUES"
Upon successful completion, the created source is returned.
Otherwise,
-\fRNULL\fP
+\fRNULL\fR
is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_source_zip
+\fBzip_source_zip\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_CHANGED\fP]
+.TP 19n
+[\fRZIP_ER_CHANGED\fR]
Unchanged data was requested, but it is not available.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIsrcarchive\fP,
-\fIsrcidx\fP,
-\fIstart\fP,
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIsrcarchive\fR,
+\fIsrcidx\fR,
+\fIstart\fR,
or
-\fIlen\fP
+\fIlen\fR
are invalid.
-.TP 17n
-[\fRZIP_ER_MEMORY\fP]
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
Required memory could not be allocated.
+.PD 0
+.PP
Additionally, it can return all error codes from
-zip_stat_index
+\fBzip_stat_index\fR()
and
-zip_fopen_index.
+\fBzip_fopen_index\fR().
+.PD
.SH "SEE ALSO"
libzip(3),
zip_add(3),
zip_replace(3),
zip_source(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.TH "ZIP_STAT" "3" "July 22, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_stat\fP,
-\fBzip_stat_index\fP
+\fBzip_stat\fR,
+\fBzip_stat_index\fR
\- get information about file
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_stat zip_t *archive const char *fname zip_flags_t flags zip_stat_t *sb
-int
-zip_stat_index zip_t *archive int index zip_flags_t flags zip_stat_t *sb
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_stat\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR, \fIzip_stat_t\ *sb\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_stat_index\fR(\fIzip_t\ *archive\fR, \fIint\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_stat_t\ *sb\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_stat
+\fBzip_stat\fR()
function obtains information about the file named
-\fIfname\fP
+\fIfname\fR
in
-\fIarchive\fP.
+\fIarchive\fR.
The
-\fIflags\fP
+\fIflags\fR
argument specifies how the name lookup should be done.
Its values are described in
zip_name_locate(3).
Also,
-\fRZIP_FL_UNCHANGED\fP
+\fRZIP_FL_UNCHANGED\fR
may be
-\fIor\fP'ed
+\fIor\fR'ed
to it to request information about the original file in the archive,
ignoring any changes made.
.PP
The
-zip_stat_index
+\fBzip_stat_index\fR()
function obtains information about the file at position
-\fIindex\fP.
+\fIindex\fR.
.PP
The
-\fIsb\fP
+\fIsb\fR
argument is a pointer to a
-struct zip_stat
+\fIstruct zip_stat\fR
(shown below), into which information about the file is placed.
.nf
+.sp
+.RS 0n
struct zip_stat {
zip_uint64_t valid; /* which fields have valid values */
const char *name; /* name of the file */
zip_uint16_t encryption_method; /* encryption method used */
zip_uint32_t flags; /* reserved for future use */
};
+.RE
.fi
The structure pointed to by
-\fIsb\fP
+\fIsb\fR
must be allocated before calling
-zip_stat
+\fBzip_stat\fR()
or
-zip_stat_index.
+\fBzip_stat_index\fR().
.PP
The
-\fIvalid\fP
+\fIvalid\fR
field of the structure specifies which other fields are valid.
Check if the flag defined by the following defines are in
-\fIvalid\fP
+\fIvalid\fR
before accessing the fields:
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_NAME\fP
-\fIname\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_INDEX\fP
-\fIindex\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_SIZE\fP
-\fIsize\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_COMP_SIZE\fP
-\fIcomp_size\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_MTIME\fP
-\fImtime\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_CRC\fP
-\fIcrc\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_COMP_METHOD\fP
-\fIcomp_method\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_ENCRYPTION_METHOD\fP
-\fIencryption_method\fP
-.TP ZIP_STAT_ENCRYPTION_METHODXX
-\fRZIP_STAT_FLAGS\fP
-\fIflags\fP
+.RS 6n
+.PD 0
+.TP 30n
+\fRZIP_STAT_NAME\fR
+\fIname\fR
+.TP 30n
+\fRZIP_STAT_INDEX\fR
+\fIindex\fR
+.TP 30n
+\fRZIP_STAT_SIZE\fR
+\fIsize\fR
+.TP 30n
+\fRZIP_STAT_COMP_SIZE\fR
+\fIcomp_size\fR
+.TP 30n
+\fRZIP_STAT_MTIME\fR
+\fImtime\fR
+.TP 30n
+\fRZIP_STAT_CRC\fR
+\fIcrc\fR
+.TP 30n
+\fRZIP_STAT_COMP_METHOD\fR
+\fIcomp_method\fR
+.TP 30n
+\fRZIP_STAT_ENCRYPTION_METHOD\fR
+\fIencryption_method\fR
+.TP 30n
+\fRZIP_STAT_FLAGS\fR
+\fIflags\fR
+.RE
+.PD
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
The function
-zip_stat
+\fBzip_stat\fR()
can fail for any of the errors specified for the routine
zip_name_locate(3).
.PP
The function
-zip_stat_index
+\fBzip_stat_index\fR()
fails and sets the error information to
-\fRZIP_ER_INVAL\fP
+\fRZIP_ER_INVAL\fR
if
-\fIindex\fP
+\fIindex\fR
is invalid.
If
-\fRZIP_FL_UNCHANGED\fP
+\fRZIP_FL_UNCHANGED\fR
is not set and no information can be obtained from the source
callback, the error information is set to
-\fRZIP_ER_CHANGED\fP.
+\fRZIP_ER_CHANGED\fR.
.SH "SEE ALSO"
libzip(3),
zip_get_num_entries(3),
zip_name_locate(3),
zip_stat_init(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_stat.mdoc -- get information about file
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_STAT_INIT" "3" "September 22, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_stat_init\fP
+\fBzip_stat_init\fR
\- initialize zip_stat structure
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-void
-zip_stat_init zip_stat_t *sb
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_stat_init\fR(\fIzip_stat_t\ *sb\fR);
+.PD
.SH "DESCRIPTION"
The
-zip_stat_init
+\fBzip_stat_init\fR()
function initializes the members of a struct zip_stat.
The current members are described in
zip_stat(3),
but this function should be used to initialize it to
make sure none are missed.
The structure pointed to by
-\fIsb\fP
+\fIsb\fR
must be allocated before calling
-zip_stat_init.
+\fBzip_stat_init\fR().
.PP
This function should be used by functions provided to
zip_source_function(3)
when returning
-\fRZIP_SOURCE_STAT\fP
+\fRZIP_SOURCE_STAT\fR
information to make sure all fields are initialized.
.SH "RETURN VALUES"
If
-\fIsb\fP
+\fIsb\fR
is valid, the function is always successful.
.SH "SEE ALSO"
libzip(3),
zip_stat(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_stat_init.mdoc -- init zip_stat structure
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 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>
.TH "ZIP_UNCHANGE" "3" "April 23, 2006" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_unchange\fP
+\fBzip_unchange\fR
\- undo changes to file in zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_unchange zip_t *archive int index
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_unchange\fR(\fIzip_t\ *archive\fR, \fIint\ index\fR);
+.PD
.SH "DESCRIPTION"
Changes to the file at position
-\fIindex\fP
+\fIindex\fR
are reverted.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "ERRORS"
-zip_unchange
+\fBzip_unchange\fR()
fails if:
-.TP 17n
-[\fRZIP_ER_EXISTS\fP]
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
Unchanging the name would result in a duplicate name in the archive.
-.TP 17n
-[\fRZIP_ER_INVAL\fP]
-\fIindex\fP
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
is not a valid file index in
-\fIzip\fP.
+\fIzip\fR.
.SH "SEE ALSO"
libzip(3),
zip_unchange_all(3),
zip_unchange_archive(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_unchange.mdoc -- undo changes to file in zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_UNCHANGE_ALL" "3" "April 23, 2006" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_unchange_all\fP
+\fBzip_unchange_all\fR
\- undo all changes in a zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_unchange_all zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_unchange_all\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
All changes to files and global information in
-\fIarchive\fP
+\fIarchive\fR
are reverted.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_unchange(3),
zip_unchange_archive(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_unchange_all.mdoc -- undo changes to all files in zip archive
-.\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2015 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>
.TH "ZIP_UNCHANGE_ARCHIVE" "3" "May 14, 2008" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzip_unchange_archive\fP
+\fBzip_unchange_archive\fR
\- undo global changes to zip archive
.SH "LIBRARY"
libzip (-lzip)
.SH "SYNOPSIS"
-zip.h
-int
-zip_unchange_archive zip_t *archive
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_unchange_archive\fR(\fIzip_t\ *archive\fR);
+.PD
.SH "DESCRIPTION"
Revert all global changes to the archive
-\fIarchive\fP.
+\fIarchive\fR.
This reverts changes to the archive comment and global flags.
.SH "RETURN VALUES"
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
-\fIarchive\fP
+\fIarchive\fR
is set to indicate the error.
.SH "SEE ALSO"
libzip(3),
zip_unchange(3),
zip_unchange_all(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zip_unchange_archive.mdoc -- undo changes to all files in zip archive
-.\" Copyright (C) 2006-2014 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2006-2015 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>
-.TH "ZIPCMP" "1" "April 29, 2015" "NiH" "General Commands Manual"
+.TH "ZIPCMP" "1" "January 19, 2016" "NiH" "General Commands Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzipcmp\fP
+\fBzipcmp\fR
\- compare contents of zip archives
.SH "SYNOPSIS"
-\fBzipcmp\fP
-[\fB-hipqtVv\fP]
-\fIarchive1 archive2\fP
+.HP 7n
+\fBzipcmp\fR
+[\fB\-hipqtVv\fR]
+\fIarchive1\ archive2\fR
.SH "DESCRIPTION"
-\fBzipcmp\fP
+\fBzipcmp\fR
compares the zip archives or directories
-\fIarchive1\fP
+\fIarchive1\fR
and
-\fIarchive2\fP
+\fIarchive2\fR
and checks if they contain the same files, comparing their names,
uncompressed sizes, and CRCs.
File order and compressed size differences are ignored.
.PP
Supported options:
-.TP MMM
-\fB-h\fP
+.TP 5n
+\fB\-h\fR
Display a short help message and exit.
-.TP MMM
-\fB-i\fP
+.TP 5n
+\fB\-i\fR
Compare names ignoring case distinctions.
-.TP MMM
-\fB-p\fP
+.TP 5n
+\fB\-p\fR
Enable paranoid checks.
Compares extra fields and other meta data.
(Automatically disabled if one of the archives is a directory.)
-.TP MMM
-\fB-q\fP
+.TP 5n
+\fB\-q\fR
Quiet mode.
Compare
-\fB-v\fP.
-.TP MMM
-\fB-t\fP
+\fB\-v\fR.
+.TP 5n
+\fB\-t\fR
Test zip files by comparing the contents to their checksums.
-.TP MMM
-\fB-V\fP
+.TP 5n
+\fB\-V\fR
Display version information and exit.
-.TP MMM
-\fB-v\fP
+.TP 5n
+\fB\-v\fR
Verbose mode.
Print details about differences to stdout.
(This is the default.)
.SH "EXIT STATUS"
-\fBzipcmp\fP
+\fBzipcmp\fR
exits 0 if the two archives contain the same files, 1 if they differ,
and >1 if an error occurred.
.SH "SEE ALSO"
zipmerge(1),
+ziptool(1),
libzip(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zipcmp.mdoc -- compare zip archives
-.\" Copyright (C) 2003-2015 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2003-2016 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>
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 29, 2015
+.Dd January 19, 2016
.Dt ZIPCMP 1
.Os
.Sh NAME
and \*[Gt]1 if an error occurred.
.Sh SEE ALSO
.Xr zipmerge 1 ,
+.Xr ziptool 1 ,
.Xr libzip 3
.Sh AUTHORS
.An -nosplit
-.TH "ZIPMERGE" "1" "April 29, 2015" "NiH" "General Commands Manual"
+.TH "ZIPMERGE" "1" "January 19, 2016" "NiH" "General Commands Manual"
+.nh
+.if n .ad l
.SH "NAME"
-\fBzipmerge\fP
+\fBzipmerge\fR
\- merge zip archives
.SH "SYNOPSIS"
-\fBzipmerge\fP
-[\fB-DhIiSsV\fP]
-\fItarget-zip\fP
-\fIsource-zip\fP [\fIsource-zip ...\fP]
+.HP 9n
+\fBzipmerge\fR
+[\fB\-DhIiSsV\fR]
+\fItarget-zip\fR
+\fIsource-zip\fR\ [\fIsource-zip\ ...\fR]
.SH "DESCRIPTION"
-\fBzipmerge\fP
+\fBzipmerge\fR
merges the source zip archives
-\fIsource-zip\fP
+\fIsource-zip\fR
into the target zip archive
-\fItarget-zip\fP.
+\fItarget-zip\fR.
By default, files in the source zip archives overwrite
existing files of the same name in the target zip archive.
.PP
Supported options:
-.TP MMM
-\fB-D\fP
+.TP 5n
+\fB\-D\fR
Ignore directory components in file name comparisons.
-.TP MMM
-\fB-h\fP
+.TP 5n
+\fB\-h\fR
Display a short help message and exit.
-.TP MMM
-\fB-I\fP
+.TP 5n
+\fB\-I\fR
Ignore case in file name comparisons
-.TP MMM
-\fB-i\fP
+.TP 5n
+\fB\-i\fR
Ask before overwriting files.
See also
-\fB-s\fP.
-.TP MMM
-\fB-S\fP
+\fB\-s\fR.
+.TP 5n
+\fB\-S\fR
Do not overwrite files that have the same size and
CRC32 in both the source and target archives.
-.TP MMM
-\fB-s\fP
+.TP 5n
+\fB\-s\fR
When
-\fB-i\fP
+\fB\-i\fR
is given, do not before overwriting files that have the same size
and CRC32.
-.TP MMM
-\fB-V\fP
+.TP 5n
+\fB\-V\fR
Display version information and exit.
.SH "EXIT STATUS"
-\fBzipmerge\fP
+\fBzipmerge\fR
exits 0 on success and >1 if an error occurred.
.SH "SEE ALSO"
zipcmp(1),
+ziptool(1),
libzip(3)
.SH "AUTHORS"
-Dieter Baron <dillo@nih.at>
+Dieter Baron <\fIdillo@nih.at\fR>
and
-Thomas Klausner <tk@giga.or.at>
+Thomas Klausner <\fItk@giga.or.at\fR>
.\" zipmerge.mdoc -- merge zip archives
-.\" Copyright (C) 2004-2015 Dieter Baron and Thomas Klausner
+.\" Copyright (C) 2004-2016 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>
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 29, 2015
+.Dd January 19, 2016
.Dt ZIPMERGE 1
.Os
.Sh NAME
exits 0 on success and \*[Gt]1 if an error occurred.
.Sh SEE ALSO
.Xr zipcmp 1 ,
+.Xr ziptool 1 ,
.Xr libzip 3
.Sh AUTHORS
.An -nosplit
--- /dev/null
+.TH "ZIPTOOL" "1" "January 19, 2016" "NiH" "General Commands Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBziptool\fR
+\- modify zip archives
+.SH "SYNOPSIS"
+.HP 8n
+\fBziptool\fR
+[\fB\-cegHhmnrst\fR]
+\fIzip-archive\fR
+\fBcommand\fR\ [\fIcommand-args\ ...\fR]
+[\fBcommand\fR\ [\fIcommand-args\ ...\fR]\ ...]
+.SH "DESCRIPTION"
+\fBziptool\fR
+modifies the zip archive
+\fIzip-archive\fR
+according to the
+\fIcommands\fR
+given.
+.PP
+Supported options:
+.TP 5n
+\fB\-c\fR
+Check zip archive consistency when opening it.
+.TP 5n
+\fB\-e\fR
+Error if archive already exists (only useful with
+\fB\-n\fR).
+.TP 5n
+\fB\-g\fR
+Guess file name encoding (for
+\fBstat\fR
+command).
+.TP 5n
+\fB\-H\fR
+Write files with
+\(Lqholes\(Rq
+compactly.
+In other words, when the modified zip archive contains long runs of zeroes,
+write a basic run-length encoded block instead.
+\fINote\fR:
+This command is for internal testing of
+libzip(3)
+and will usually create invalid zip archives.
+.TP 5n
+\fB\-h\fR
+Display help.
+.TP 5n
+\fB\-m\fR
+Read archive into memory, and modify there; write out at end.
+\fINote\fR:
+This command is for internal testing of
+libzip(3).
+.TP 5n
+\fB\-n\fR
+Create archive if it doesn't exist.
+See also
+\fB\-e\fR.
+.TP 5n
+\fB\-r\fR
+Print raw file name encoding without translation (for
+\fBstat\fR
+command).
+.TP 5n
+\fB\-s\fR
+Follow file name convention strictly (for
+\fBstat\fR
+command).
+.TP 5n
+\fB\-t\fR
+Disregard current file contents, if any.
+\fINote\fR:
+use this with care, it deletes all existing file contents when
+you modify the archive.
+.SS "Commands"
+For all commands below, the index is zero-based.
+In other words, the first entry in the zip archive has index 0.
+.PP
+Supported commands and arguments are:
+.TP 12n
+\fBadd\fR \fIname content\fR
+Add file called
+\fIname\fR
+using the string
+\fIcontent\fR
+from the command line as data.
+.TP 12n
+\fBadd_dir\fR \fIname\fR
+Add directory
+\fIname\fR.
+.TP 12n
+\fBadd_file\fR \fIname file_to_add offset len\fR
+Add file
+\fIname\fR
+to archive, using
+\fIlen\fR
+bytes from the file
+\fIfile_to_add\fR
+as input data, starting at
+\fIoffset\fR.
+.TP 12n
+\fBadd_from_zip\fR \fIname archivename index offset len\fR
+Add file called
+\fIname\fR
+to archive using data from another zip archive
+\fIarchivename\fR
+using the entry with index
+\fIindex\fR
+and reading
+\fIlen\fR
+bytes from
+\fIoffset\fR.
+.TP 12n
+\fBadd_nul\fR \fIname length\fR
+Add a file
+\fIname\fR
+consisting of
+\fIlength\fR
+NUL bytes.
+(Mostly useful for testing.)
+.TP 12n
+\fBcat\fR \fIindex\fR
+Output file contents for entry
+\fIindex\fR
+to stdout.
+.TP 12n
+\fBcount_extra\fR \fIindex flags\fR
+Print the number of extra fields for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBcount_extra_by_id\fR \fIindex extra_id flags\fR
+Print number of extra fields of type
+\fIextra_id\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBdelete\fR \fIindex\fR
+Remove entry at
+\fIindex\fR
+from zip archive.
+.TP 12n
+\fBdelete_extra\fR \fIindex extra_idx flags\fR
+Remove extra field number
+\fIextra_idx\fR
+from archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBdelete_extra_by_id\fR \fIindex extra_id extra_index flags\fR
+Remove extra field number
+\fIextra_index\fR
+of type
+\fIextra_id\fR
+from archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBget_archive_comment\fR
+Print archive comment.
+.TP 12n
+\fBget_extra\fR \fIindex extra_index flags\fR
+Print extra field
+\fIextra_index\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBget_extra_by_id\fR \fIindex extra_id extra_index flags\fR
+Print extra field
+\fIextra_index\fR
+of type
+\fIextra_id\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBget_file_comment\fR \fIindex\fR
+Get file comment for archive entry
+\fIindex\fR.
+.TP 12n
+\fBget_num_entries\fR \fIflags\fR
+Print number of entries in archive using
+\fIflags\fR.
+.TP 12n
+\fBname_locate\fR \fIname flags\fR
+Find entry in archive with the filename
+\fIname\fR
+using
+\fIflags\fR
+and print its index.
+.TP 12n
+\fBrename\fR \fIindex name\fR
+Rename archive entry
+\fIindex\fR
+to
+\fIname\fR.
+.TP 12n
+\fBreplace_file_contents\fR \fIindex data\fR
+Replace file contents for archive entry
+\fIindex\fR
+with the string
+\fIdata\fR.
+.TP 12n
+\fBset_archive_comment\fR \fIcomment\fR
+Set archive comment to
+\fIcomment\fR.
+.TP 12n
+\fBset_extra\fR \fIindex extra_id extra_index flags value\fR
+Set extra field number
+\fIextra_index\fR
+of type
+\fIextra_id\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR
+to
+\fIvalue\fR.
+.TP 12n
+\fBset_file_comment\fR \fIindex comment\fR
+Set file comment for archive entry
+\fIindex\fR
+to string
+\fIcomment\fR.
+.TP 12n
+\fBset_file_compression\fR \fIindex method compression_flags\fR
+Set file compression method for archive entry
+\fIindex\fR
+to
+\fImethod\fR
+using
+\fIcompression_flags\fR.
+\fINote\fR:
+Currently,
+\fIcompression_flags\fR
+are ignored.
+.TP 12n
+\fBset_file_mtime\fR \fIindex timestamp\fR
+Set file modification time for archive entry
+\fIindex\fR
+to UNIX mtime
+\fItimestamp\fR.
+.TP 12n
+\fBset_file_mtime_all\fR \fItimestamp\fR
+Set file modification time for all archive entries to UNIX mtime
+\fItimestamp\fR.
+.TP 12n
+\fBset_password\fR \fIpassword\fR
+Set default password for encryption/decryption to
+\fIpassword\fR.
+.TP 12n
+\fBstat\fR \fIindex\fR
+Print information about archive entry
+\fIindex\fR.
+.TP 12n
+\fBunchange_all\fR
+Revert all changes up to that point.
+Mostly useful for testing.
+.TP 12n
+\fBzin_close\fR \fIindex\fR
+Close input zip_source
+\fIindex\fR.
+For internal tests only.
+.SS "Flags"
+Some commands take flag arguments.
+Supported flags are:
+.RS 6n
+.PD 0
+.TP 5n
+\fIC\fR
+\fRZIP_FL_NOCASE\fR
+.TP 5n
+\fIc\fR
+\fRZIP_FL_CENTRAL\fR
+.TP 5n
+\fId\fR
+\fRZIP_FL_NODIR\fR
+.TP 5n
+\fIl\fR
+\fRZIP_FL_LOCAL\fR
+.TP 5n
+\fIu\fR
+\fRZIP_FL_UNCHANGED\fR
+.RE
+.PD
+.SS "Compression Methods"
+Some commands take compression method arguments.
+Supported methods are:
+.RS 6n
+.PD 0
+.TP 4n
+\fB\(bu\fR
+\fRdefault\fR
+.TP 4n
+\fB\(bu\fR
+\fRdeflate\fR
+.TP 4n
+\fB\(bu\fR
+\fRstore\fR
+.RE
+.PD
+.SH "EXIT STATUS"
+.br
+The \fBziptool\fR utility exits\~0 on success, and\~>0 if an error occurs.
+.SH "EXAMPLES"
+Add a file called
+\fIteststring.txt\fR
+to the zip archive
+\fItestbuffer.zip\fR
+with data
+\(LqThis is a test.\en\(Rq
+where
+\(Lq\en\(Rq
+is replaced with a newline character:
+.nf
+.sp
+.RS 6n
+ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
+.RE
+.fi
+.PP
+Delete the first file from the zip archive
+\fItestfile.zip\fR:
+.nf
+.sp
+.RS 6n
+ziptool testfile.zip delete 0
+.RE
+.fi
+.SH "SEE ALSO"
+zipcmp(1),
+zipmerge(1),
+libzip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
--- /dev/null
+.\" ziptool.mdoc -- modify zip archives in multiple ways
+.\" Copyright (C) 2016 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 January 19, 2016
+.Dt ZIPTOOL 1
+.Os
+.Sh NAME
+.Nm ziptool
+.Nd modify zip archives
+.Sh SYNOPSIS
+.Nm
+.Op Fl cegHhmnrst
+.Ar zip-archive
+.Cm command Op Ar command-args ...
+.Op Cm command Oo Ar command-args ... Oc ...
+.Sh DESCRIPTION
+.Nm
+modifies the zip archive
+.Ar zip-archive
+according to the
+.Ar commands
+given.
+.Pp
+Supported options:
+.Bl -tag -width MMM
+.It Fl c
+Check zip archive consistency when opening it.
+.It Fl e
+Error if archive already exists (only useful with
+.Fl n ) .
+.It Fl g
+Guess file name encoding (for
+.Cm stat
+command).
+.It Fl H
+Write files with
+.Dq holes
+compactly.
+In other words, when the modified zip archive contains long runs of zeroes,
+write a basic run-length encoded block instead.
+.Em Note :
+This command is for internal testing of
+.Xr libzip 3
+and will usually create invalid zip archives.
+.It Fl h
+Display help.
+.It Fl m
+Read archive into memory, and modify there; write out at end.
+.Em Note :
+This command is for internal testing of
+.Xr libzip 3 .
+.It Fl n
+Create archive if it doesn't exist.
+See also
+.Fl e .
+.It Fl r
+Print raw file name encoding without translation (for
+.Cm stat
+command).
+.It Fl s
+Follow file name convention strictly (for
+.Cm stat
+command).
+.It Fl t
+Disregard current file contents, if any.
+.Em Note :
+use this with care, it deletes all existing file contents when
+you modify the archive.
+.El
+.Ss Commands
+For all commands below, the index is zero-based.
+In other words, the first entry in the zip archive has index 0.
+.Pp
+Supported commands and arguments are:
+.Bl -tag -width 10n
+.It Cm add Ar name content
+Add file called
+.Ar name
+using the string
+.Ar content
+from the command line as data.
+.It Cm add_dir Ar name
+Add directory
+.Ar name .
+.It Cm add_file Ar name file_to_add offset len
+Add file
+.Ar name
+to archive, using
+.Ar len
+bytes from the file
+.Ar file_to_add
+as input data, starting at
+.Ar offset .
+.It Cm add_from_zip Ar name archivename index offset len
+Add file called
+.Ar name
+to archive using data from another zip archive
+.Ar archivename
+using the entry with index
+.Ar index
+and reading
+.Ar len
+bytes from
+.Ar offset .
+.It Cm add_nul Ar name length
+Add a file
+.Ar name
+consisting of
+.Ar length
+NUL bytes.
+(Mostly useful for testing.)
+.It Cm cat Ar index
+Output file contents for entry
+.Ar index
+to stdout.
+.It Cm count_extra Ar index flags
+Print the number of extra fields for archive entry
+.Ar index
+using
+.Ar flags .
+.It Cm count_extra_by_id Ar index extra_id flags
+Print number of extra fields of type
+.Ar extra_id
+for archive entry
+.Ar index
+using
+.Ar flags .
+.It Cm delete Ar index
+Remove entry at
+.Ar index
+from zip archive.
+.It Cm delete_extra Ar index extra_idx flags
+Remove extra field number
+.Ar extra_idx
+from archive entry
+.Ar index
+using
+.Ar flags .
+.It Cm delete_extra_by_id Ar index extra_id extra_index flags
+Remove extra field number
+.Ar extra_index
+of type
+.Ar extra_id
+from archive entry
+.Ar index
+using
+.Ar flags .
+.It Cm get_archive_comment
+Print archive comment.
+.It Cm get_extra Ar index extra_index flags
+Print extra field
+.Ar extra_index
+for archive entry
+.Ar index
+using
+.Ar flags .
+.It Cm get_extra_by_id Ar index extra_id extra_index flags
+Print extra field
+.Ar extra_index
+of type
+.Ar extra_id
+for archive entry
+.Ar index
+using
+.Ar flags .
+.It Cm get_file_comment Ar index
+Get file comment for archive entry
+.Ar index .
+.It Cm get_num_entries Ar flags
+Print number of entries in archive using
+.Ar flags .
+.It Cm name_locate Ar name flags
+Find entry in archive with the filename
+.Ar name
+using
+.Ar flags
+and print its index.
+.It Cm rename Ar index name
+Rename archive entry
+.Ar index
+to
+.Ar name .
+.It Cm replace_file_contents Ar index data
+Replace file contents for archive entry
+.Ar index
+with the string
+.Ar data .
+.It Cm set_archive_comment Ar comment
+Set archive comment to
+.Ar comment .
+.It Cm set_extra Ar index extra_id extra_index flags value
+Set extra field number
+.Ar extra_index
+of type
+.Ar extra_id
+for archive entry
+.Ar index
+using
+.Ar flags
+to
+.Ar value .
+.It Cm set_file_comment Ar index comment
+Set file comment for archive entry
+.Ar index
+to string
+.Ar comment .
+.It Cm set_file_compression Ar index method compression_flags
+Set file compression method for archive entry
+.Ar index
+to
+.Ar method
+using
+.Ar compression_flags .
+.Em Note :
+Currently,
+.Ar compression_flags
+are ignored.
+.It Cm set_file_mtime Ar index timestamp
+Set file modification time for archive entry
+.Ar index
+to UNIX mtime
+.Ar timestamp .
+.It Cm set_file_mtime_all Ar timestamp
+Set file modification time for all archive entries to UNIX mtime
+.Ar timestamp .
+.It Cm set_password Ar password
+Set default password for encryption/decryption to
+.Ar password .
+.It Cm stat Ar index
+Print information about archive entry
+.Ar index .
+.It Cm unchange_all
+Revert all changes up to that point.
+Mostly useful for testing.
+.It Cm zin_close Ar index
+Close input zip_source
+.Ar index .
+For internal tests only.
+.El
+.Ss Flags
+Some commands take flag arguments.
+Supported flags are:
+.Bl -tag -width MMM -compact -offset indent
+.It Ar C
+.Dv ZIP_FL_NOCASE
+.It Ar c
+.Dv ZIP_FL_CENTRAL
+.It Ar d
+.Dv ZIP_FL_NODIR
+.It Ar l
+.Dv ZIP_FL_LOCAL
+.It Ar u
+.Dv ZIP_FL_UNCHANGED
+.El
+.Ss Compression Methods
+Some commands take compression method arguments.
+Supported methods are:
+.Bl -bullet -compact -offset indent
+.It
+.Dv default
+.It
+.Dv deflate
+.It
+.Dv store
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Add a file called
+.Pa teststring.txt
+to the zip archive
+.Pa testbuffer.zip
+with data
+.Dq This is a test.\en
+where
+.Dq \en
+is replaced with a newline character:
+.Bd -literal -offset indent
+ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
+.Ed
+.Pp
+Delete the first file from the zip archive
+.Pa testfile.zip :
+.Bd -literal -offset indent
+ziptool testfile.zip delete 0
+.Ed
+.Sh SEE ALSO
+.Xr zipcmp 1 ,
+.Xr zipmerge 1 ,
+.Xr libzip 3
+.Sh AUTHORS
+.An -nosplit
+.An Dieter Baron Aq Mt dillo@nih.at
+and
+.An Thomas Klausner Aq Mt tk@giga.or.at
scriptversion=2013-10-28.13; # UTC
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
)
SET(HELPER_TEST_PROGRAMS
-# modify
# tryopen
)
tryopen
)
-SET(HOLE_USERS
- hole
- modify
-)
-
SET(EXTRA_TESTS
add_dir.test
add_from_buffer.test
add_from_zip_stored.test
add_stored.test
add_stored_in_memory.test
+ count_entries.test
+ decrypt-correct-password.test
+ decrypt-wrong-password.test
delete_add_same.test
delete_invalid.test
delete_last.test
extra_count_ignore_zip64.test
extra_delete.test
extra_delete_by_id.test
+ extra_field_align.test
extra_get.test
extra_get_by_id.test
extra_set.test
ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}.c ${SRC_EXTRA_FILES})
TARGET_LINK_LIBRARIES(${PROGRAM} zip)
ENDFOREACH(PROGRAM ${GETOPT_USERS})
-FOREACH(PROGRAM ${HOLE_USERS})
- ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}.c ${SRC_EXTRA_FILES} source_hole.c)
- TARGET_LINK_LIBRARIES(${PROGRAM} zip)
-ENDFOREACH(PROGRAM ${HOLE_USERS})
ADD_TEST(fread ${CMAKE_CURRENT_SOURCE_DIR}/runtest ${CMAKE_CURRENT_SOURCE_DIR}/fread)
add_from_filep \
fopen_unchanged \
fread \
- hole \
- modify \
tryopen
-modify_SOURCES= \
- modify.c \
- source_hole.c
+pkglib_LTLIBRARIES= malloc.la
+malloc_la_SOURCES= malloc.c
+malloc_la_LDFLAGS= -module -avoid-version
-hole_SOURCES= \
- hole.c \
- source_hole.c
+install-pkglibLTLIBRARIES:
+ @echo not installing shared objects needed only for testing
EXTRA_DIST= \
CMakeLists.txt \
bogus.zip \
broken.zip \
cm-default.zip \
+ encrypt-aes.zip \
encrypt.zip \
encrypt_plus_extra.zip \
encrypt_plus_extra_modified_c.zip \
encrypt_plus_extra_modified_l.zip \
+ extra_field_align_1-0.zip \
+ extra_field_align_1-ff.zip \
+ extra_field_align_2-0.zip \
+ extra_field_align_2-ff.zip \
+ extra_field_align_3-0.zip \
+ extra_field_align_3-ff.zip \
+ extra_field_align_4-ff.zip \
+ extra_field_align_1-ef_00.zip \
+ extra_field_align_1-ef_ff.zip \
+ extra_field_align_2-ef_00.zip \
+ extra_field_align_2-ef_ff.zip \
+ extra_field_align_3-ef_00.zip \
+ extra_field_align_3-ef_ff.zip \
filename_duplicate.zip \
filename_duplicate_empty.zip \
filename_empty.zip \
incons-ef-central-size-wrong.zip \
incons-ef-local-id-size.zip \
incons-ef-local-id.zip \
- incons-ef-local-incomplete1.zip \
- incons-ef-local-incomplete2.zip \
- incons-ef-local-incomplete3.zip \
- incons-ef-local-incomplete4.zip \
incons-ef-local-size.zip \
incons-eocd-magic-bad.zip \
incons-file-count-high.zip \
teststored.zip \
utf-8-standardization-input.zip \
utf-8-standardization-output.zip \
+ zip-in-archive-comment.zip \
zip64.zip
TESTS_ENVIRONMENT= ZIPCMP=${top_builddir}/src/zipcmp
add_from_zip_stored.test \
add_stored.test \
add_stored_in_memory.test \
+ count_entries.test \
+ decrypt-aes-correct-password.test \
+ decrypt-aes-wrong-password.test \
+ decrypt-correct-password.test \
+ decrypt-wrong-password.test \
delete_add_same.test \
delete_invalid.test \
delete_last.test \
extra_count_ignore_zip64.test \
extra_delete.test \
extra_delete_by_id.test \
+ extra_field_align.test \
extra_get.test \
extra_get_by_id.test \
extra_set.test \
stat_index_utf8_unmarked_strict.test \
stat_index_zip64.test \
utf-8-standardization.test \
+ zip-in-archive-comment.test \
zip64_creation.test \
zip64_stored_creation.test
-XFAIL_TESTS= \
- open_filename_duplicate_consistency.test \
- open_filename_duplicate_empty_consistency.test
+#XFAIL_TESTS=
+
AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib -I${top_srcdir}/src
LDADD=${top_builddir}/lib/libzip.la
check-am: bigzero.zip manyfiles.zip runtest
bigzero.zip: bigzero-zip.zip
- ${builddir}/modify ${srcdir}/bigzero-zip.zip cat 0 > ${builddir}/bigzero.zip
+ ${top_builddir}/src/ziptool ${srcdir}/bigzero-zip.zip cat 0 > ${builddir}/bigzero.zip
manyfiles.zip: manyfiles-zip.zip
- ${builddir}/modify ${srcdir}/manyfiles-zip.zip cat 0 > ${builddir}/manyfiles.zip
+ ${top_builddir}/src/ziptool ${srcdir}/manyfiles-zip.zip cat 0 > ${builddir}/manyfiles.zip
runtest: runtest.in
sed -e 's!@[s]rcdir@!${srcdir}!g' -e 's!@[a]bs_srcdir@!${abs_srcdir}!g' ${srcdir}/runtest.in > runtest
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@SET_MAKE@
+
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = add_from_filep$(EXEEXT) fopen_unchanged$(EXEEXT) \
- fread$(EXEEXT) hole$(EXEEXT) modify$(EXEEXT) tryopen$(EXEEXT)
+ fread$(EXEEXT) tryopen$(EXEEXT)
subdir = regress
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/depcomp $(top_srcdir)/test-driver
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/visibility.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
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__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(pkglibdir)"
+LTLIBRARIES = $(pkglib_LTLIBRARIES)
+malloc_la_LIBADD =
+am_malloc_la_OBJECTS = malloc.lo
+malloc_la_OBJECTS = $(am_malloc_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+malloc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(malloc_la_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(noinst_PROGRAMS)
add_from_filep_SOURCES = add_from_filep.c
add_from_filep_OBJECTS = add_from_filep.$(OBJEXT)
add_from_filep_LDADD = $(LDADD)
add_from_filep_DEPENDENCIES = ${top_builddir}/lib/libzip.la
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 =
fopen_unchanged_SOURCES = fopen_unchanged.c
fopen_unchanged_OBJECTS = fopen_unchanged.$(OBJEXT)
fopen_unchanged_LDADD = $(LDADD)
fread_OBJECTS = fread.$(OBJEXT)
fread_LDADD = $(LDADD)
fread_DEPENDENCIES = ${top_builddir}/lib/libzip.la
-am_hole_OBJECTS = hole.$(OBJEXT) source_hole.$(OBJEXT)
-hole_OBJECTS = $(am_hole_OBJECTS)
-hole_LDADD = $(LDADD)
-hole_DEPENDENCIES = ${top_builddir}/lib/libzip.la
-am_modify_OBJECTS = modify.$(OBJEXT) source_hole.$(OBJEXT)
-modify_OBJECTS = $(am_modify_OBJECTS)
-modify_LDADD = $(LDADD)
-modify_DEPENDENCIES = ${top_builddir}/lib/libzip.la
tryopen_SOURCES = tryopen.c
tryopen_OBJECTS = tryopen.$(OBJEXT)
tryopen_LDADD = $(LDADD)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = add_from_filep.c fopen_unchanged.c fread.c $(hole_SOURCES) \
- $(modify_SOURCES) tryopen.c
-DIST_SOURCES = add_from_filep.c fopen_unchanged.c fread.c \
- $(hole_SOURCES) $(modify_SOURCES) tryopen.c
+SOURCES = $(malloc_la_SOURCES) add_from_filep.c fopen_unchanged.c \
+ fread.c tryopen.c
+DIST_SOURCES = $(malloc_la_SOURCES) add_from_filep.c fopen_unchanged.c \
+ fread.c tryopen.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
std='\e[m'; \
fi; \
}
-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__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
am__recheck_rx = ^[ ]*:recheck:[ ]*
am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
*) \
b='$*';; \
esac
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
+ $(top_srcdir)/test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = parallel-tests
noinst_SCRIPTS = runtest
-modify_SOURCES = \
- modify.c \
- source_hole.c
-
-hole_SOURCES = \
- hole.c \
- source_hole.c
-
+pkglib_LTLIBRARIES = malloc.la
+malloc_la_SOURCES = malloc.c
+malloc_la_LDFLAGS = -module -avoid-version
EXTRA_DIST = \
CMakeLists.txt \
NiHTest.pm \
bogus.zip \
broken.zip \
cm-default.zip \
+ encrypt-aes.zip \
encrypt.zip \
encrypt_plus_extra.zip \
encrypt_plus_extra_modified_c.zip \
encrypt_plus_extra_modified_l.zip \
+ extra_field_align_1-0.zip \
+ extra_field_align_1-ff.zip \
+ extra_field_align_2-0.zip \
+ extra_field_align_2-ff.zip \
+ extra_field_align_3-0.zip \
+ extra_field_align_3-ff.zip \
+ extra_field_align_4-ff.zip \
+ extra_field_align_1-ef_00.zip \
+ extra_field_align_1-ef_ff.zip \
+ extra_field_align_2-ef_00.zip \
+ extra_field_align_2-ef_ff.zip \
+ extra_field_align_3-ef_00.zip \
+ extra_field_align_3-ef_ff.zip \
filename_duplicate.zip \
filename_duplicate_empty.zip \
filename_empty.zip \
incons-ef-central-size-wrong.zip \
incons-ef-local-id-size.zip \
incons-ef-local-id.zip \
- incons-ef-local-incomplete1.zip \
- incons-ef-local-incomplete2.zip \
- incons-ef-local-incomplete3.zip \
- incons-ef-local-incomplete4.zip \
incons-ef-local-size.zip \
incons-eocd-magic-bad.zip \
incons-file-count-high.zip \
teststored.zip \
utf-8-standardization-input.zip \
utf-8-standardization-output.zip \
+ zip-in-archive-comment.zip \
zip64.zip
TESTS_ENVIRONMENT = ZIPCMP=${top_builddir}/src/zipcmp
add_from_zip_stored.test \
add_stored.test \
add_stored_in_memory.test \
+ count_entries.test \
+ decrypt-aes-correct-password.test \
+ decrypt-aes-wrong-password.test \
+ decrypt-correct-password.test \
+ decrypt-wrong-password.test \
delete_add_same.test \
delete_invalid.test \
delete_last.test \
extra_count_ignore_zip64.test \
extra_delete.test \
extra_delete_by_id.test \
+ extra_field_align.test \
extra_get.test \
extra_get_by_id.test \
extra_set.test \
stat_index_utf8_unmarked_strict.test \
stat_index_zip64.test \
utf-8-standardization.test \
+ zip-in-archive-comment.test \
zip64_creation.test \
zip64_stored_creation.test
-XFAIL_TESTS = \
- open_filename_duplicate_consistency.test \
- open_filename_duplicate_empty_consistency.test
+#XFAIL_TESTS=
AM_CPPFLAGS = -I${top_srcdir}/lib -I../lib -I${top_srcdir}/src
LDADD = ${top_builddir}/lib/libzip.la
CLEANFILES = bigzero.zip manyfiles.zip runtest
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign regress/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign regress/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+uninstall-pkglibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
+ done
+
+clean-pkglibLTLIBRARIES:
+ -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
+ @list='$(pkglib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+malloc.la: $(malloc_la_OBJECTS) $(malloc_la_DEPENDENCIES) $(EXTRA_malloc_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(malloc_la_LINK) -rpath $(pkglibdir) $(malloc_la_OBJECTS) $(malloc_la_LIBADD) $(LIBS)
+
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
@rm -f fread$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(fread_OBJECTS) $(fread_LDADD) $(LIBS)
-hole$(EXEEXT): $(hole_OBJECTS) $(hole_DEPENDENCIES) $(EXTRA_hole_DEPENDENCIES)
- @rm -f hole$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(hole_OBJECTS) $(hole_LDADD) $(LIBS)
-
-modify$(EXEEXT): $(modify_OBJECTS) $(modify_DEPENDENCIES) $(EXTRA_modify_DEPENDENCIES)
- @rm -f modify$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(modify_OBJECTS) $(modify_LDADD) $(LIBS)
-
tryopen$(EXEEXT): $(tryopen_OBJECTS) $(tryopen_DEPENDENCIES) $(EXTRA_tryopen_DEPENDENCIES)
@rm -f tryopen$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tryopen_OBJECTS) $(tryopen_LDADD) $(LIBS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_from_filep.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen_unchanged.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fread.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hole.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modify.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source_hole.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tryopen.Po@am__quote@
.c.o:
if test -n "$$am__remaking_logs"; then \
echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
"recursion detected" >&2; \
- else \
+ elif test -n "$$redo_logs"; then \
am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
fi; \
if $(am__make_dryrun); then :; else \
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-all-am: Makefile $(PROGRAMS) $(SCRIPTS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS)
installdirs:
+ for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
- mostlyclean-am
+ clean-pkglibLTLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
install-dvi-am:
-install-exec-am:
+install-exec-am: install-pkglibLTLIBRARIES
install-html: install-html-am
ps-am:
-uninstall-am:
+uninstall-am: uninstall-pkglibLTLIBRARIES
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
- clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
- ctags ctags-am 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-info \
- install-info-am install-man install-pdf install-pdf-am \
+ clean-generic clean-libtool clean-noinstPROGRAMS \
+ clean-pkglibLTLIBRARIES cscopelist-am ctags ctags-am 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-info install-info-am install-man \
+ install-pdf install-pdf-am install-pkglibLTLIBRARIES \
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 \
- recheck tags tags-am uninstall uninstall-am
+ recheck tags tags-am uninstall uninstall-am \
+ uninstall-pkglibLTLIBRARIES
+
+.PRECIOUS: Makefile
+
+install-pkglibLTLIBRARIES:
+ @echo not installing shared objects needed only for testing
check-am: bigzero.zip manyfiles.zip runtest
bigzero.zip: bigzero-zip.zip
- ${builddir}/modify ${srcdir}/bigzero-zip.zip cat 0 > ${builddir}/bigzero.zip
+ ${top_builddir}/src/ziptool ${srcdir}/bigzero-zip.zip cat 0 > ${builddir}/bigzero.zip
manyfiles.zip: manyfiles-zip.zip
- ${builddir}/modify ${srcdir}/manyfiles-zip.zip cat 0 > ${builddir}/manyfiles.zip
+ ${top_builddir}/src/ziptool ${srcdir}/manyfiles-zip.zip cat 0 > ${builddir}/manyfiles.zip
runtest: runtest.in
sed -e 's!@[s]rcdir@!${srcdir}!g' -e 's!@[a]bs_srcdir@!${abs_srcdir}!g' ${srcdir}/runtest.in > runtest
use Cwd;
use File::Copy;
-use File::Path qw(mkpath);
+use File::Path qw(mkpath remove_tree);
use IPC::Open3;
use Symbol 'gensym';
use UNIVERSAL;
use Data::Dumper qw(Dumper);
# NiHTest -- package to run regression tests
-# Copyright (C) 2002-2014 Dieter Baron and Thomas Klausner
+# Copyright (C) 2002-2015 Dieter Baron and Thomas Klausner
#
# This file is part of ckmame, a program to check rom sets for MAME.
# The authors can be contacted at <ckmame@nih.at>
return $ok;
}
+sub file_cmp($$) {
+ my ($a, $b) = @_;
+ my $result = 0;
+ open my $fha, "< $a";
+ open my $fhb, "< $b";
+ binmode $fha;
+ binmode $fhb;
+ BYTE: while (!eof $fha && !eof $fhb) {
+ if (getc $fha ne getc $fhb) {
+ $result = 1;
+ last BYTE;
+ }
+ }
+ $result = 1 if eof $fha != eof $fhb;
+ close $fha;
+ close $fhb;
+ return $result;
+}
-sub compare_file() {
+sub compare_file($$$) {
my ($self, $got, $expected) = @_;
my $real_expected = $self->find_file($expected);
$ret = system('diff', '-u', $real_expected, $got);
}
else {
- $ret = system('cmp', '-s', $real_expected, $got);
+ $ret = file_cmp($real_expected, $got);
}
$ok = ($ret == 0);
}
return $ok;
}
-
sub compare_files() {
my ($self) = @_;
my $ok = 1;
- my $ls;
- open $ls, "find . -type f -print |";
+ opendir(my $ls, '.');
unless ($ls) {
# TODO: handle error
}
- my @files_got = ();
-
- while (my $line = <$ls>) {
- chomp $line;
- $line =~ s,^\./,,;
- push @files_got, $line;
- }
- close($ls);
-
+ my @files_got = grep { -f } readdir($ls);
+ closedir($ls);
+
@files_got = sort @files_got;
my @files_should = ();
sub run_program {
my ($self) = @_;
-
+
+ goto &pipein_win32 if $^O eq 'MSWin32' && $self->{test}->{pipein};
+
my ($stdin, $stdout, $stderr);
$stderr = gensym;
}
while (my $line = <$stdout>) {
- chomp $line;
+ if ($^O eq 'MSWin32') {
+ $line =~ s/[\r\n]+$//;
+ }
+ else {
+ chomp $line;
+ }
push @{$self->{stdout}}, $line;
}
my $prg = $self->{test}->{program};
$prg =~ s,.*/,,;
while (my $line = <$stderr>) {
- chomp $line;
+ if ($^O eq 'MSWin32') {
+ $line =~ s/[\r\n]+$//;
+ }
+ else {
+ chomp $line;
+ }
$line =~ s/^[^: ]*$prg: //;
if (defined($self->{test}->{'stderr-replace'})) {
$self->{exit_status} = $? >> 8;
}
+sub pipein_win32() {
+ my ($self) = @_;
+
+ my $cmd = "$self->{test}->{pipein}| ..\\$self->{test}->{program} " . join(' ', map ({ backslash_decode($_); } @{$self->{test}->{args}}));
+ my ($success, $error_message, $full_buf, $stdout_buf, $stderr_buf) = IPC::Cmd::run(command => $cmd);
+ if (!$success) {
+ ### TODO: catch errors?
+ }
+
+ my @stdout = map { s/[\r\n]+$// } @$stdout_buf;
+ $self->{stdout} = \@stdout;
+ $self->{stderr} = [];
+
+ my $prg = $self->{test}->{program};
+ $prg =~ s,.*/,,;
+ foreach my $line (@$stderr_buf) {
+ $line =~ s/[\r\n]+$//;
+
+ $line =~ s/^[^: ]*$prg: //;
+ if (defined($self->{test}->{'stderr-replace'})) {
+ $line = $self->stderr_rewrite($self->{test}->{'stderr-replace'}, $line);
+ }
+ push @{$self->{stderr}}, $line;
+ }
+
+ $self->{exit_status} = 1;
+ if ($success) {
+ $self->{exit_status} = 0;
+ }
+ elsif ($error_message =~ /exited with value ([0-9]+)$/) {
+ $self->{exit_status} = $1 + 0;
+ }
+}
sub sandbox_create {
my ($self, $tag) = @_;
my ($self) = @_;
my $ok = 1;
- unless (system('chmod', '-R', 'u+rwx', $self->{sandbox_dir}) == 0) {
- $self->warn("can't ensure that sandbox is writable: $!");
- }
- unless (system('rm', '-rf', $self->{sandbox_dir}) == 0) {
- $self->warn("can't remove sandbox: $!");
- $ok = 0;
- }
-
+ remove_tree($self->{sandbox_dir});
+
return $ok;
}
# add directories to zip
-program modify
return 0
args testdir.zip add_dir testdir/ add_dir testdir-noslash
file-new testdir.zip testdir.zip
# add buffer contents as file to zip
-program modify
return 0
args testbuffer.zip add teststring.txt "This is a test, and it seems to have been successful.\n"
file-new testbuffer.zip testbuffer.zip
# add file to zip
-program modify
return 0
args -- testfile.zip add_file testfile.txt testfile.txt 0 -1
file testfile.txt testfile.txt testfile.txt
# add already existing file to zip, making duplicate names
-program modify
return 1
args -- testfile.zip add_file testfile.txt testfile.txt 0 -1
file testfile.txt testfile.txt testfile.txt
# add file to zip twice, making duplicate names
-program modify
return 1
args -- testfile.zip add_file testfile.txt testfile.txt 0 -1 add_file testfile.txt testfile.txt 0 -1
file testfile.txt testfile.txt testfile.txt
# add stdin to zip
pipein echo This is a test, and it seems to have been successful.
-program modify
args -- teststdin.zip add_file teststring.txt /dev/stdin 0 -1
return 0
file-new teststdin.zip teststdin.zip
# add deflated file from zip to zip, but close the source before it can be read
-program modify
return 1
args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 zin_close 0
file testdeflated.zzip testdeflated.zip testdeflated.zip
# add deflated file from zip to zip
-program modify
return 0
args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1
file testdeflated.zzip testdeflated.zip testdeflated.zip
# add deflated files from zip to zip
-program modify
return 0
args -- testfile.zip add_from_zip abac-repeat.txt testdeflated.zzip 0 0 -1 add_from_zip abac-repeat2.txt testdeflated.zzip 0 0 -1
file testdeflated.zzip testdeflated.zip testdeflated.zip
# add parts of a file from zip to zip
-program modify
return 0
args -- testfile.zip add_from_zip first firstsecond.zzip 0 0 9 add_from_zip second firstsecond.zzip 0 9 -1
file firstsecond.zzip firstsecond.zip firstsecond.zip
# add parts of a file from zip to zip
-program modify
return 0
args -- testfile.zip add_from_zip first firstsecond.zzip 1 0 9 add_from_zip second firstsecond.zzip 1 9 -1
file firstsecond.zzip firstsecond.zip firstsecond.zip
# add stored file from zip to zip
-program modify
return 0
args -- testfile.zip add_from_zip abac-repeat.txt teststored.zzip 0 0 -1
file teststored.zzip teststored.zip teststored.zip
# add file, set compression method to ZIP_CM_STORE
-program modify
return 0
args -n test.zip add foo foo set_file_compression 0 store 0
file-new test.zip foo-stored.zip
# add file, set compression method to ZIP_CM_STORE
-program modify
return 0
args -mn test.zip add foo foo set_file_compression 0 store 0
file-new test.zip foo-stored.zip
--- /dev/null
+# zip_open: count entries for archive with >65k entries
+args manyfiles.zip get_num_entries 0
+return 0
+file manyfiles.zip manyfiles.zip manyfiles.zip
+stdout 70000 entries in archive
--- /dev/null
+# test AES decryption support, extract file using correct password
+return 1
+args encrypt.zzip set_password foofoofoo cat 0
+file encrypt.zzip encrypt-aes.zip encrypt-aes.zip
+stderr can't open file at index '0': Compression method not supported
--- /dev/null
+# test AES decryption support, extract file using wrong password
+return 1
+args encrypt.zzip set_password notfoonotfoo cat 0
+file encrypt.zzip encrypt-aes.zip encrypt-aes.zip
+stderr can't open file at index '0': Compression method not supported
--- /dev/null
+# test decryption support, extract file using correct password
+return 0
+args encrypt.zzip set_password foo cat 0
+file encrypt.zzip encrypt.zip encrypt.zip
+stdout foo
--- /dev/null
+# test decryption support, extract file using wrong password
+return 1
+args encrypt.zzip set_password notfoo cat 0
+file encrypt.zzip encrypt.zip encrypt.zip
+stderr can't open file at index '0': Wrong password provided
# delete entry in zip archive then add file of same name
# time is now(), so use zipcmp
-program modify
return 0
args testfile.zip delete 0 add testfile.txt test
file testfile.zip testfile.zip test2.zip
# delete last entry in zip archive
-program modify
return 1
args testfile.zzip delete 5
file testfile.zzip testfile.zip testfile.zip
# delete last entry in zip archive
-program modify
return 0
args testfile.zzip delete 0
file-del testfile.zzip testfile.zip
# delete multiple entries in zip archive, emptying it
-program modify
return 0
args testfile.zzip delete 0 delete 1 delete 2 delete 3
file-del testfile.zzip testcomment.zip
# delete some entries in zip archive
-program modify
return 0
args testfile.zip delete 1 delete 3
file testfile.zip testcomment.zip testcomment13.zip
# delete renamed entry in zip archive then rename file to same name
# file date is now(), so use zipcmp
-program modify
return 0
args testfile.zip rename 0 something add test test delete 0 rename 1 testfile.txt
file testfile.zip testfile.zip test2.zip
# test encryption support
# TODO: only checks recognition of encrypted entries for now.
-program modify
return 0
args encrypt.zzip stat 0 stat 1
file encrypt.zzip encrypt.zip encrypt.zip
# add extra field
-program modify
#args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent
args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent get_extra_by_id 0 2345 0 c get_extra_by_id 0 2345 0 l
return 0
# add extra fields
-program modify
args testfile.zip set_extra 0 2345 65535 cl extra1 set_extra 0 2345 65535 cl extra2 set_extra 0 2345 0 c extra1c set_extra 0 2345 1 l extra2l get_extra_by_id 0 2345 0 c get_extra_by_id 0 2345 1 c get_extra_by_id 0 2345 0 l get_extra_by_id 0 2345 1 l
return 0
file testfile.zip testfile.zip testfile-plus-extra.zip
# count extra fields for index
-program modify
args encrypt.zip count_extra 0 l count_extra 0 c count_extra 0 lc count_extra 1 l count_extra 1 c count_extra 1 lc
return 0
file encrypt.zip encrypt.zip encrypt.zip
# count extra fields for index
-program modify
args encrypt.zip count_extra_by_id 0 0 l count_extra_by_id 0 1 l count_extra_by_id 0 21589 l count_extra_by_id 0 30805 l count_extra_by_id 0 21844 l count_extra_by_id 0 12345 l count_extra_by_id 0 0 c count_extra_by_id 0 1 c count_extra_by_id 0 21589 c count_extra_by_id 0 30805 c count_extra_by_id 0 21844 c count_extra_by_id 0 12345 c count_extra_by_id 0 0 cl count_extra_by_id 0 1 cl count_extra_by_id 0 21589 cl count_extra_by_id 0 30805 cl count_extra_by_id 0 21844 cl count_extra_by_id 0 12345 cl
return 0
file encrypt.zip encrypt.zip encrypt.zip
# count extra fields for index
-program modify
args bigzero.zip count_extra 0 l count_extra 0 c count_extra 0 lc
return 0
file bigzero.zip bigzero.zip bigzero.zip
# delete extra field by index
-program modify
args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l delete_extra 0 2 c delete_extra 0 0 l get_extra 0 0 c get_extra 0 1 c get_extra 0 0 l get_extra 0 1 l
file encrypt.zip encrypt_plus_extra.zip encrypt.zip
return 0
# delete extra field by id and index
-program modify
#args encrypt.zip set_extra 0 2345 65535 cl extrafieldcontent
args encrypt.zip delete_extra_by_id 0 2345 0 c delete_extra_by_id 0 2345 0 l get_extra_by_id 0 2345 0 c
return 1
--- /dev/null
+# try opening simulated Android APK zipaligned files, and similar inconsistent files
+setenv LANG C
+program tryopen
+file extra_field_align_1-0.zzip extra_field_align_1-0.zip extra_field_align_1-0.zip
+file extra_field_align_1-ff.zzip extra_field_align_1-ff.zip extra_field_align_1-ff.zip
+file extra_field_align_2-0.zzip extra_field_align_2-0.zip extra_field_align_2-0.zip
+file extra_field_align_2-ff.zzip extra_field_align_2-ff.zip extra_field_align_2-ff.zip
+file extra_field_align_3-0.zzip extra_field_align_3-0.zip extra_field_align_3-0.zip
+file extra_field_align_3-ff.zzip extra_field_align_3-ff.zip extra_field_align_3-ff.zip
+file extra_field_align_4-ff.zzip extra_field_align_4-ff.zip extra_field_align_4-ff.zip
+file extra_field_align_1-ef_00.zzip extra_field_align_1-ef_00.zip extra_field_align_1-ef_00.zip
+file extra_field_align_1-ef_ff.zzip extra_field_align_1-ef_ff.zip extra_field_align_1-ef_ff.zip
+file extra_field_align_2-ef_00.zzip extra_field_align_2-ef_00.zip extra_field_align_2-ef_00.zip
+file extra_field_align_2-ef_ff.zzip extra_field_align_2-ef_ff.zip extra_field_align_2-ef_ff.zip
+file extra_field_align_3-ef_00.zzip extra_field_align_3-ef_00.zip extra_field_align_3-ef_00.zip
+file extra_field_align_3-ef_ff.zzip extra_field_align_3-ef_ff.zip extra_field_align_3-ef_ff.zip
+args -c extra_field_align_1-0.zzip extra_field_align_1-ff.zzip extra_field_align_2-0.zzip extra_field_align_2-ff.zzip extra_field_align_3-0.zzip extra_field_align_3-ff.zzip extra_field_align_4-ff.zzip extra_field_align_1-ef_00.zzip extra_field_align_1-ef_ff.zzip extra_field_align_2-ef_00.zzip extra_field_align_2-ef_ff.zzip extra_field_align_3-ef_00.zzip extra_field_align_3-ef_ff.zzip
+return 1
+stdout opening 'extra_field_align_1-0.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_1-ff.zzip' returned error 21
+stdout opening 'extra_field_align_2-0.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_2-ff.zzip' returned error 21
+stdout opening 'extra_field_align_3-0.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_3-ff.zzip' returned error 21
+stdout opening 'extra_field_align_4-ff.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_1-ef_00.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_1-ef_ff.zzip' returned error 21
+stdout opening 'extra_field_align_2-ef_00.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_2-ef_ff.zzip' returned error 21
+stdout opening 'extra_field_align_3-ef_00.zzip' succeeded, 1 entries
+stdout opening 'extra_field_align_3-ef_ff.zzip' returned error 21
+stderr 6 errors
# get extra fields for index
-program modify
args encrypt.zip get_extra 0 0 l get_extra 0 0 c get_extra 0 1 l get_extra 0 1 c get_extra 0 2 l
return 1
file encrypt.zip encrypt.zip encrypt.zip
# get extra_by_id fields for index
-program modify
args encrypt.zip get_extra_by_id 0 21589 0 l get_extra_by_id 0 30805 0 l get_extra_by_id 0 21589 0 c get_extra_by_id 0 30805 0 c get_extra_by_id 0 21544 0 c
return 1
file encrypt.zip encrypt.zip encrypt.zip
# set extra field
-program modify
args -- encrypt get_extra 0 0 c get_extra 0 1 c get_extra 0 0 l get_extra 0 1 l set_extra 0 2345 -1 l extrafieldcontent set_extra 0 2345 -1 c extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l
file encrypt encrypt.zip encrypt_plus_extra.zip
return 0
# change existing central extra field
-program modify
args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l set_extra 0 2345 0 c Extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l
file encrypt.zip encrypt_plus_extra.zip encrypt_plus_extra_modified_c.zip
return 0
# change existing local extra field
-program modify
args encrypt.zip get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l set_extra 0 2345 0 l Extrafieldcontent get_extra 0 0 c get_extra 0 1 c get_extra 0 2 c get_extra 0 0 l get_extra 0 1 l get_extra 0 2 l
file encrypt.zip encrypt_plus_extra.zip encrypt_plus_extra_modified_l.zip
return 0
# set file comment to UTF-8 for CP437 encoded filename (adds InfoZIP extra field)
-program modify
return 0
args testfile.zip set_file_comment 0 ÄÖÜßäöü
file testfile.zip test-cp437.zip test-cp437-comment-utf-8.zip
/*
fread.c -- test cases for reading from zip archives
- Copyright (C) 2004-2014 Dieter Baron and Thomas Klausner
+ Copyright (C) 2004-2016 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>
zip_file_t *zf;
enum when when_got;
zip_error_t error_got, error_ex;
+ zip_error_t *zf_error;
int err;
char b[8192];
zip_int64_t n;
if ((zf=zip_fopen(z, name, flags)) == NULL) {
when_got = WHEN_OPEN;
- zip_error_t *zf_error = zip_get_error(z);
+ zf_error = zip_get_error(z);
zip_error_set(&error_got, zip_error_code_zip(zf_error), zip_error_code_system(zf_error));
}
else {
;
if (n < 0) {
when_got = WHEN_READ;
- zip_error_t *zf_error = zip_file_get_error(zf);
+ zf_error = zip_file_get_error(zf);
zip_error_set(&error_got, zip_error_code_zip(zf_error), zip_error_code_system(zf_error));
}
err = zip_fclose(zf);
# show comments of a zip archive
-program modify
return 0
args testcomment.zip get_archive_comment get_file_comment 0 get_file_comment 1 get_file_comment 2 get_file_comment 3
file testcomment.zip testcomment.zip testcomment.zip
--- /dev/null
+/*
+ malloc.c -- override *alloc() to allow testing special cases
+ Copyright (C) 2015 Dieter Baron and Thomas Klausner
+
+ This file is part of ckmame, a program to check rom sets for MAME.
+ The authors can be contacted at <ckmame@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 name of the author 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>
+#define __USE_GNU
+#include <dlfcn.h>
+#undef __USE_GNU
+
+#include "config.h"
+
+#if defined(HAVE___PROGNAME)
+extern char *__progname;
+#endif
+
+#if defined(HAVE_GETPROGNAME)
+/* all fine */
+#else
+const char *
+getprogname(void)
+{
+#if defined(HAVE___PROGNAME)
+ return __progname;
+#else
+ return NULL;
+#endif
+}
+#endif
+
+static int inited = 0;
+static size_t count = 0;
+static size_t max_count = 0;
+static size_t min_size = 0;
+static void *(*real_malloc)(size_t size) = NULL;
+static void *(*real_calloc)(size_t number, size_t size) = NULL;
+static void *(*real_realloc)(void *ptr, size_t size) = NULL;
+
+static const char *myname = NULL;
+
+/* TODO: add sentinel -- check if particular size is malloced before doing other stuff */
+/* TODO: catch free for sentinel too */
+/* TODO: optionally, catch malloc of particular size */
+
+static void
+init(void)
+{
+ char *foo;
+ myname = getprogname();
+ if (!myname)
+ myname = "(unknown)";
+ if ((foo=getenv("MALLOC_MAX_COUNT")) != NULL)
+ max_count = strtoul(foo, NULL, 0);
+ if ((foo=getenv("MALLOC_MIN_SIZE")) != NULL)
+ min_size = strtoul(foo, NULL, 0);
+ real_calloc = dlsym(RTLD_NEXT, "calloc");
+ if (!real_calloc)
+ abort();
+ real_malloc = dlsym(RTLD_NEXT, "malloc");
+ if (!real_malloc)
+ abort();
+ real_realloc = dlsym(RTLD_NEXT, "realloc");
+ if (!real_realloc)
+ abort();
+ inited = 1;
+}
+
+void *
+calloc(size_t number, size_t size)
+{
+ void *ret;
+
+ if (!inited) {
+ init();
+ }
+
+ if (number >= min_size/size && count >= max_count) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ ret = real_calloc(number, size);
+ if (size >= min_size) {
+ count++;
+ }
+
+ return ret;
+}
+
+void *
+malloc(size_t size)
+{
+ void *ret;
+
+ if (!inited) {
+ init();
+ }
+
+ if (size >= min_size && count >= max_count) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ ret = real_malloc(size);
+ if (size >= min_size) {
+ count++;
+ }
+
+ return ret;
+}
+
+void *
+realloc(void *ptr, size_t size)
+{
+ void *ret;
+
+ if (!inited) {
+ init();
+ }
+
+ if (size >= min_size && count >= max_count) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ ret = real_realloc(ptr, size);
+ if (size >= min_size) {
+ count++;
+ }
+
+ return ret;
+}
# various tests for zip_name_locate
-program modify
args test.zip name_locate nosuchfile 0 name_locate test 0 name_locate "" 0 name_locate TeSt 0 name_locate TeSt C name_locate testdir/test2 0 name_locate tesTdir/tESt2 C name_locate testdir/test2 d name_locate tesTdir/tESt2 dC name_locate test2 0 name_locate test2 d name_locate TeST2 dC delete 0 name_locate test 0 name_locate test u add new teststring name_locate new 0 name_locate new u add "" teststring name_locate "" 0 unchange_all name_locate test 0 name_locate new 0
stderr can't find entry with name 'nosuchfile' using flags '0'
stdout name 'test' using flags '0' found at index 0
# zip_open: file opens fine even though same file name appears twice
program tryopen
-args filename_duplicate.zip
+args filename_duplicate.zzip
return 0
-file filename_duplicate.zip filename_duplicate.zip filename_duplicate.zip
-stdout opening 'filename_duplicate.zip' succeeded, 2 entries
+file filename_duplicate.zzip filename_duplicate.zip filename_duplicate.zip
+stdout opening 'filename_duplicate.zzip' succeeded, 2 entries
# zip_open: file opens fine even though same file name appears twice
program tryopen
-args -c filename_duplicate.zip
-return 0
-file filename_duplicate.zip filename_duplicate.zip filename_duplicate.zip
-stderr some error about a duplicate file name
+args -c filename_duplicate.zzip
+return 1
+file filename_duplicate.zzip filename_duplicate.zip filename_duplicate.zip
+stdout opening 'filename_duplicate.zzip' returned error 10
+stderr 1 errors
# zip_open: file opens fine even though same file name (empty file name) appears twice
program tryopen
-args filename_duplicate_empty.zip
+args filename_duplicate_empty.zzip
return 0
-file filename_duplicate_empty.zip filename_duplicate_empty.zip filename_duplicate_empty.zip
-stdout opening 'filename_duplicate_empty.zip' succeeded, 2 entries
+file filename_duplicate_empty.zzip filename_duplicate_empty.zip filename_duplicate_empty.zip
+stdout opening 'filename_duplicate_empty.zzip' succeeded, 2 entries
# zip_open: file opens fine even though same file name (empty file name) appears twice
program tryopen
-args -c filename_duplicate_empty.zip
+args -c filename_duplicate_empty.zzip
return 1
-file filename_duplicate_empty.zip filename_duplicate_empty.zip filename_duplicate_empty.zip
-stdout some error about duplicate file names
+file filename_duplicate_empty.zzip filename_duplicate_empty.zip filename_duplicate_empty.zip
+stdout opening 'filename_duplicate_empty.zzip' returned error 10
+stderr 1 errors
file incons-ef-central-size-wrong.zzip incons-ef-central-size-wrong.zip incons-ef-central-size-wrong.zip
file incons-ef-local-id-size.zzip incons-ef-local-id-size.zip incons-ef-local-id-size.zip
file incons-ef-local-id.zzip incons-ef-local-id.zip incons-ef-local-id.zip
-file incons-ef-local-incomplete1.zzip incons-ef-local-incomplete1.zip incons-ef-local-incomplete1.zip
-file incons-ef-local-incomplete2.zzip incons-ef-local-incomplete2.zip incons-ef-local-incomplete2.zip
-file incons-ef-local-incomplete3.zzip incons-ef-local-incomplete3.zip incons-ef-local-incomplete3.zip
-file incons-ef-local-incomplete4.zzip incons-ef-local-incomplete4.zip incons-ef-local-incomplete4.zip
file incons-ef-local-size.zzip incons-ef-local-size.zip incons-ef-local-size.zip
file incons-eocd-magic-bad.zzip incons-eocd-magic-bad.zip incons-eocd-magic-bad.zip
file incons-file-count-high.zzip incons-file-count-high.zip incons-file-count-high.zip
file incons-local-filename.zzip incons-local-filename.zip incons-local-filename.zip
file incons-local-magic-bad.zzip incons-local-magic-bad.zip incons-local-magic-bad.zip
file incons-local-size-larger.zzip incons-local-size-larger.zip incons-local-size-larger.zip
-args -c incons-archive-comment-longer.zzip incons-archive-comment-shorter.zzip incons-cdoffset.zzip incons-central-compression-method.zzip incons-central-compsize-larger-toolarge.zzip incons-central-compsize-larger.zzip incons-central-compsize-smaller.zzip incons-central-crc.zzip incons-central-date.zzip incons-central-file-comment-longer.zzip incons-central-file-comment-shorter.zzip incons-central-magic-bad.zzip incons-central-magic-bad2.zzip incons-central-size-larger.zzip incons-data.zzip incons-ef-central-size-wrong.zzip incons-ef-local-id-size.zzip incons-ef-local-id.zzip incons-ef-local-incomplete1.zzip incons-ef-local-incomplete2.zzip incons-ef-local-incomplete3.zzip incons-ef-local-incomplete4.zzip incons-ef-local-size.zzip incons-eocd-magic-bad.zzip incons-file-count-high.zzip incons-file-count-low.zzip incons-file-count-overflow.zzip incons-local-compression-method.zzip incons-local-compsize-larger.zzip incons-local-compsize-smaller.zzip incons-local-crc.zzip incons-local-filename-long.zzip incons-local-filename-missing.zzip incons-local-filename-short.zzip incons-local-filename.zzip incons-local-magic-bad.zzip incons-local-size-larger.zzip
+args -c incons-archive-comment-longer.zzip incons-archive-comment-shorter.zzip incons-cdoffset.zzip incons-central-compression-method.zzip incons-central-compsize-larger-toolarge.zzip incons-central-compsize-larger.zzip incons-central-compsize-smaller.zzip incons-central-crc.zzip incons-central-date.zzip incons-central-file-comment-longer.zzip incons-central-file-comment-shorter.zzip incons-central-magic-bad.zzip incons-central-magic-bad2.zzip incons-central-size-larger.zzip incons-data.zzip incons-ef-central-size-wrong.zzip incons-ef-local-id-size.zzip incons-ef-local-id.zzip incons-ef-local-size.zzip incons-eocd-magic-bad.zzip incons-file-count-high.zzip incons-file-count-low.zzip incons-file-count-overflow.zzip incons-local-compression-method.zzip incons-local-compsize-larger.zzip incons-local-compsize-smaller.zzip incons-local-crc.zzip incons-local-filename-long.zzip incons-local-filename-missing.zzip incons-local-filename-short.zzip incons-local-filename.zzip incons-local-magic-bad.zzip incons-local-size-larger.zzip
return 1
stdout opening 'incons-archive-comment-longer.zzip' returned error 21
stdout opening 'incons-archive-comment-shorter.zzip' returned error 21
stdout opening 'incons-ef-local-id-size.zzip' returned error 21
# different extra fields local vs. central is fine
stdout opening 'incons-ef-local-id.zzip' succeeded, 1 entries
-stdout opening 'incons-ef-local-incomplete1.zzip' returned error 21
-stdout opening 'incons-ef-local-incomplete2.zzip' returned error 21
-stdout opening 'incons-ef-local-incomplete3.zzip' returned error 21
-# EF consisting of 4 zero bytes is technically ok
-stdout opening 'incons-ef-local-incomplete4.zzip' succeeded, 1 entries
stdout opening 'incons-ef-local-size.zzip' returned error 21
stdout opening 'incons-eocd-magic-bad.zzip' returned error 19
stdout opening 'incons-file-count-high.zzip' returned error 21
stdout opening 'incons-local-filename.zzip' returned error 21
stdout opening 'incons-local-magic-bad.zzip' returned error 19
stdout opening 'incons-local-size-larger.zzip' returned error 21
-stderr 34 errors
+stderr 31 errors
# rename file to ASCII name in zip archive
-program modify
return 0
args testfile rename 0 testfile.txt
file testfile testfile-UTF8.zip testfile.zip
# rename file to CP437 name in zip archive (fails)
-program modify
return 0
args testfile.zip rename 0 \81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90
file testfile.zip testfile.zip testfile-cp437.zip
# rename deleted entry in zip archive (fails)
-program modify
return 1
args testfile.zip delete 1 delete 3 rename 1 othername
file testfile.zip testcomment.zip testcomment13.zip
# rename file inside zip archive, but file name already exists
-program modify
return 1
args rename.zip rename 0 file4
file rename.zip testcomment.zip testcomment.zip
# rename file inside zip archive
-program modify
return 0
args rename.zip rename 1 notfile2
file rename.zip testcomment.zip rename_ok.zip
# rename file to UTF-8 name in zip archive
-program modify
return 0
args testfile rename 0 ÄÖÜßäöü
file testfile testfile.zip testfile-UTF8.zip
# rename file to UTF-8 name in zip archive with CP437 comment (sets InfoZIP UTF-8 Name Extension)
-program modify
return 0
args testfile rename 0 ÄÖÜßäöü
file testfile test-cp437-fc.zip test-cp437-fc-utf-8-filename.zip
use NiHTest;
-my $test = NiHTest::new({ default_program => 'modify', srcdir => '@srcdir@', zipcmp => '../../src/zipcmp', zipcmp_flags => '-p' });
+my $test = NiHTest::new({ default_program => '../src/ziptool', srcdir => '@srcdir@', zipcmp => '../../src/zipcmp', zipcmp_flags => '-p' });
$test->run(@ARGV);
# change local and global comments in a zip archive
-program modify
return 0
args testcomment.zip set_archive_comment "This is the new,\r\nmultiline archive comment.\r\nAin't it nice?" set_file_comment 0 "File comment no 0" set_file_comment 1 "File comment no 1" set_file_comment 2 "File comment no 2" set_file_comment 3 "File comment no 3"
file testcomment.zip testcomment.zip testchanged.zip
# change file comments in a zip archive
-program modify
return 0
args testcomment.zip set_file_comment 0 "File comment no 0" set_file_comment 1 "File comment no 1" set_file_comment 3 "File comment no 3" set_file_comment 2 ""
file testcomment.zip testcomment.zip testchangedlocal.zip
# remove archive comment
-program modify
return 0
args testcomment.zip set_archive_comment ""
file testcomment.zip testcomment.zip testcommentremoved.zip
# start changing local and global comments, but revert before closing
-program modify
return 0
args testcomment.zip set_archive_comment "some long string, a bit longer than this at least" set_file_comment 0 "File comment no 0" set_file_comment 1 "File comment no 1" set_file_comment 3 "File comment no 3" set_file_comment 2 "" unchange_all
file testcomment.zip testcomment.zip testcomment.zip
# change method from deflated to deflated (no change)
-program modify
return 0
args test.zip set_file_compression 0 deflate 0
file test.zip testdeflated.zip testdeflated.zip
# change method from deflated to stored
-program modify
return 0
args test.zip set_file_compression 0 store 0
file test.zip testdeflated.zip teststored.zip
# change method from stored to deflated
-program modify
return 0
args test.zip set_file_compression 0 deflate 0
file test.zip teststored.zip testdeflated.zip
# change method from stored to stored (no change)
-program modify
return 0
args test.zip set_file_compression 0 store 0
file test.zip teststored.zip teststored.zip
# change method to unknown
-program modify
return 1
args test.zip set_file_compression 0 unknown 0
file test.zip teststored.zip teststored.zip
# guess CP437 file names and autoconvert them
-program modify
args test-cp437.zip stat 0 stat 1 stat 2 stat 3 stat 4 stat 5 stat 6 stat 7 stat 8 stat 9 stat 10 stat 11 stat 12 stat 13 stat 14 stat 15
return 0
file test-cp437.zip test-cp437.zip test-cp437.zip
# get raw file names them from archive
-program modify
args -r test-cp437.zip stat 0 stat 1 stat 2 stat 3 stat 4 stat 5 stat 6 stat 7 stat 8 stat 9 stat 10 stat 11 stat 12 stat 13 stat 14 stat 15
return 0
file test-cp437.zip test-cp437.zip test-cp437.zip
# strictly follow ZIP spec and expect CP437 file names, and autoconvert them
-program modify
args -s test-cp437.zip stat 0 stat 1 stat 2 stat 3 stat 4 stat 5 stat 6 stat 7 stat 8 stat 9 stat 10 stat 11 stat 12 stat 13 stat 14 stat 15
return 0
file test-cp437.zip test-cp437.zip test-cp437.zip
# zip_open: entries ordered by central directory order
-program modify
args fileorder.zzip stat 0 stat 1
return 0
file fileorder.zzip fileorder.zip fileorder.zip
# stat file in streamed zip file
-program modify
args streamed stat 0
file streamed streamed.zip streamed.zip
return 0
# stat file in streamed zip file
-program modify
args streamed stat 0
file streamed streamed-zip64.zip streamed-zip64.zip
return 0
# guess UTF-8 file names
-program modify
args test-utf8.zip stat 0
return 0
file test-utf8.zip test-utf8.zip test-utf8.zip
# print UTF-8 file names
-program modify
args -r test-utf8.zip stat 0
return 0
file test-utf8.zip test-utf8.zip test-utf8.zip
# follow strict rules and convert UTF-8 as if it was CP437, but not
# if the files are marked as having UTF-8 names
-program modify
args -s test-utf8.zip stat 0
return 0
file test-utf8.zip test-utf8.zip test-utf8.zip
# follow strict rules and convert UTF-8 as if it was CP437,
# if not marked otherwise (in this case: not marked)
-program modify
args -s test-utf8-unmarked.zip stat 0
return 0
file test-utf8-unmarked.zip test-utf8-unmarked.zip test-utf8-unmarked.zip
# stat file in zip64 zip file
-program modify
args bigzero stat 0
file bigzero bigzero.zip bigzero.zip
return 0
# replace file contents and make UTF-8 name
-program modify
return 0
args testfile replace_file_contents 0 "Some new content for the file." set_file_mtime 0 1406885162
file testfile utf-8-standardization-input.zip utf-8-standardization-output.zip
--- /dev/null
+# stat file in zip that contains archive comment to find out if it detected the right one of the two
+args zip-in-archive-comment.zip stat 0
+file zip-in-archive-comment.zip zip-in-archive-comment.zip zip-in-archive-comment.zip
+return 0
+stdout name: 'testfile.txt'
+stdout index: '0'
+stdout size: '0'
+stdout compressed size: '0'
+stdout mtime: 'Fri Jul 15 2005 16:37:14'
+stdout crc: '0'
+stdout compression method: '0'
+stdout encryption method: '0'
+stdout
# create big zip64 zip file from scratch
-program modify
args bigzero.zip add_nul bigzero 4294967296
file-new bigzero.zip bigzero.zip
return 0
# create big zip64 zip file from scratch
-program modify
args -H bigstored.zh add_nul bigzero 4294967296 set_file_compression 0 0 0 set_file_mtime 0 0 add_nul smallzero 16384 set_file_compression 1 0 0 set_file_mtime 1 0
file-new bigstored.zh bigstored.zh
return 0
ADD_EXECUTABLE(zipmerge zipmerge.c ${SRC_EXTRA_FILES})
TARGET_LINK_LIBRARIES(zipmerge zip)
INSTALL(TARGETS zipmerge RUNTIME DESTINATION bin)
+
+ADD_EXECUTABLE(ziptool ziptool.c ${SRC_EXTRA_FILES} source_hole.c)
+TARGET_LINK_LIBRARIES(ziptool zip)
+INSTALL(TARGETS ziptool RUNTIME DESTINATION bin)
+
+ADD_EXECUTABLE(hole hole.c ${SRC_EXTRA_FILES} source_hole.c)
+TARGET_LINK_LIBRARIES(hole zip)
+# do not install hole, just a test helper
-bin_PROGRAMS=zipcmp zipmerge
+bin_PROGRAMS=zipcmp zipmerge ziptool
+noinst_PROGRAMS=hole
-zipcmp_SOURCES=zipcmp.c
+hole_SOURCES= hole.c source_hole.c
+ziptool_SOURCES= source_hole.c ziptool.c
-zipcmp_CPPFLAGS=-I${top_srcdir}/lib -I../lib
-zipcmp_LDADD=${top_builddir}/lib/libzip.la
-zipmerge_CPPFLAGS=-I${top_srcdir}/lib -I../lib
-zipmerge_LDADD=${top_builddir}/lib/libzip.la
+AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib
+LDADD=${top_builddir}/lib/libzip.la
EXTRA_DIST= CMakeLists.txt getopt.c getopt.h compat.h
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@SET_MAKE@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-bin_PROGRAMS = zipcmp$(EXEEXT) zipmerge$(EXEEXT)
+bin_PROGRAMS = zipcmp$(EXEEXT) zipmerge$(EXEEXT) ziptool$(EXEEXT)
+noinst_PROGRAMS = hole$(EXEEXT)
subdir = src
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/depcomp
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/visibility.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_zipcmp_OBJECTS = zipcmp-zipcmp.$(OBJEXT)
-zipcmp_OBJECTS = $(am_zipcmp_OBJECTS)
-zipcmp_DEPENDENCIES = ${top_builddir}/lib/libzip.la
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_hole_OBJECTS = hole.$(OBJEXT) source_hole.$(OBJEXT)
+hole_OBJECTS = $(am_hole_OBJECTS)
+hole_LDADD = $(LDADD)
+hole_DEPENDENCIES = ${top_builddir}/lib/libzip.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
+zipcmp_SOURCES = zipcmp.c
+zipcmp_OBJECTS = zipcmp.$(OBJEXT)
+zipcmp_LDADD = $(LDADD)
+zipcmp_DEPENDENCIES = ${top_builddir}/lib/libzip.la
zipmerge_SOURCES = zipmerge.c
-zipmerge_OBJECTS = zipmerge-zipmerge.$(OBJEXT)
+zipmerge_OBJECTS = zipmerge.$(OBJEXT)
+zipmerge_LDADD = $(LDADD)
zipmerge_DEPENDENCIES = ${top_builddir}/lib/libzip.la
+am_ziptool_OBJECTS = source_hole.$(OBJEXT) ziptool.$(OBJEXT)
+ziptool_OBJECTS = $(am_ziptool_OBJECTS)
+ziptool_LDADD = $(LDADD)
+ziptool_DEPENDENCIES = ${top_builddir}/lib/libzip.la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = $(zipcmp_SOURCES) zipmerge.c
-DIST_SOURCES = $(zipcmp_SOURCES) zipmerge.c
+SOURCES = $(hole_SOURCES) zipcmp.c zipmerge.c $(ziptool_SOURCES)
+DIST_SOURCES = $(hole_SOURCES) zipcmp.c zipmerge.c $(ziptool_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zipcmp_SOURCES = zipcmp.c
-zipcmp_CPPFLAGS = -I${top_srcdir}/lib -I../lib
-zipcmp_LDADD = ${top_builddir}/lib/libzip.la
-zipmerge_CPPFLAGS = -I${top_srcdir}/lib -I../lib
-zipmerge_LDADD = ${top_builddir}/lib/libzip.la
+hole_SOURCES = hole.c source_hole.c
+ziptool_SOURCES = source_hole.c ziptool.c
+AM_CPPFLAGS = -I${top_srcdir}/lib -I../lib
+LDADD = ${top_builddir}/lib/libzip.la
EXTRA_DIST = CMakeLists.txt getopt.c getopt.h compat.h
all: all-am
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo " rm -f" $$list; \
rm -f $$list
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+hole$(EXEEXT): $(hole_OBJECTS) $(hole_DEPENDENCIES) $(EXTRA_hole_DEPENDENCIES)
+ @rm -f hole$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(hole_OBJECTS) $(hole_LDADD) $(LIBS)
+
zipcmp$(EXEEXT): $(zipcmp_OBJECTS) $(zipcmp_DEPENDENCIES) $(EXTRA_zipcmp_DEPENDENCIES)
@rm -f zipcmp$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(zipcmp_OBJECTS) $(zipcmp_LDADD) $(LIBS)
@rm -f zipmerge$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(zipmerge_OBJECTS) $(zipmerge_LDADD) $(LIBS)
+ziptool$(EXEEXT): $(ziptool_OBJECTS) $(ziptool_DEPENDENCIES) $(EXTRA_ziptool_DEPENDENCIES)
+ @rm -f ziptool$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(ziptool_OBJECTS) $(ziptool_LDADD) $(LIBS)
+
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zipcmp-zipcmp.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zipmerge-zipmerge.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hole.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source_hole.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zipcmp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zipmerge.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ziptool.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-zipcmp-zipcmp.o: zipcmp.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipcmp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zipcmp-zipcmp.o -MD -MP -MF $(DEPDIR)/zipcmp-zipcmp.Tpo -c -o zipcmp-zipcmp.o `test -f 'zipcmp.c' || echo '$(srcdir)/'`zipcmp.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zipcmp-zipcmp.Tpo $(DEPDIR)/zipcmp-zipcmp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='zipcmp.c' object='zipcmp-zipcmp.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipcmp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zipcmp-zipcmp.o `test -f 'zipcmp.c' || echo '$(srcdir)/'`zipcmp.c
-
-zipcmp-zipcmp.obj: zipcmp.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipcmp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zipcmp-zipcmp.obj -MD -MP -MF $(DEPDIR)/zipcmp-zipcmp.Tpo -c -o zipcmp-zipcmp.obj `if test -f 'zipcmp.c'; then $(CYGPATH_W) 'zipcmp.c'; else $(CYGPATH_W) '$(srcdir)/zipcmp.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zipcmp-zipcmp.Tpo $(DEPDIR)/zipcmp-zipcmp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='zipcmp.c' object='zipcmp-zipcmp.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipcmp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zipcmp-zipcmp.obj `if test -f 'zipcmp.c'; then $(CYGPATH_W) 'zipcmp.c'; else $(CYGPATH_W) '$(srcdir)/zipcmp.c'; fi`
-
-zipmerge-zipmerge.o: zipmerge.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipmerge_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zipmerge-zipmerge.o -MD -MP -MF $(DEPDIR)/zipmerge-zipmerge.Tpo -c -o zipmerge-zipmerge.o `test -f 'zipmerge.c' || echo '$(srcdir)/'`zipmerge.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zipmerge-zipmerge.Tpo $(DEPDIR)/zipmerge-zipmerge.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='zipmerge.c' object='zipmerge-zipmerge.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipmerge_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zipmerge-zipmerge.o `test -f 'zipmerge.c' || echo '$(srcdir)/'`zipmerge.c
-
-zipmerge-zipmerge.obj: zipmerge.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipmerge_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zipmerge-zipmerge.obj -MD -MP -MF $(DEPDIR)/zipmerge-zipmerge.Tpo -c -o zipmerge-zipmerge.obj `if test -f 'zipmerge.c'; then $(CYGPATH_W) 'zipmerge.c'; else $(CYGPATH_W) '$(srcdir)/zipmerge.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zipmerge-zipmerge.Tpo $(DEPDIR)/zipmerge-zipmerge.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='zipmerge.c' object='zipmerge-zipmerge.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zipmerge_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zipmerge-zipmerge.obj `if test -f 'zipmerge.c'; then $(CYGPATH_W) 'zipmerge.c'; else $(CYGPATH_W) '$(srcdir)/zipmerge.c'; fi`
-
mostlyclean-libtool:
-rm -f *.lo
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
- clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
- ctags ctags-am distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- 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-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
+ clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS 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-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 tags-am uninstall uninstall-am uninstall-binPROGRAMS
+.PRECIOUS: Makefile
+
# 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.
/*
- modify_hole.c -- source for handling huge files that are mostly NULs
- Copyright (C) 2014-2015 Dieter Baron and Thomas Klausner
-
+ source_hole.c -- source for handling huge files that are mostly NULs
+ Copyright (C) 2014-2016 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:
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
*/
#include <errno.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
zip_source_t *source_hole_create(const char *fname, int flags, zip_error_t *error)
{
hole_t *ud = hole_new(fname, flags, error);
-
+
if (ud == NULL) {
return NULL;
}
buffer_free(buffer_t *buffer)
{
zip_uint64_t i;
-
+
if (buffer == NULL) {
return;
}
-
+
if (buffer->fragment) {
for (i=0; i<buffer->nfragments; i++) {
free(buffer->fragment[i]);
{
buffer_t *buffer;
FILE *f;
-
+
if ((buffer = buffer_new()) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
-
+
}
-
+
if ((flags & ZIP_TRUNCATE) == 0) {
if ((f = fopen(fname, "rb")) == NULL) {
if (!(errno == ENOENT && (flags & ZIP_CREATE))) {
fclose(f);
}
}
-
+
return buffer;
}
buffer_new(void)
{
buffer_t *buffer;
-
+
if ((buffer = (buffer_t *)malloc(sizeof(*buffer))) == NULL) {
return NULL;
}
-
+
buffer->fragment = NULL;
buffer->nfragments = 0;
buffer->fragment_size = FRAGMENT_SIZE;
buffer->size = 0;
buffer->offset = 0;
-
+
return buffer;
}
buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length, zip_error_t *error)
{
zip_uint64_t n, i, fragment_offset;
-
+
length = MY_MIN(length, buffer->size - buffer->offset);
-
+
if (length == 0) {
return 0;
}
if (length > ZIP_INT64_MAX) {
return -1;
}
-
+
i = buffer->offset / buffer->fragment_size;
fragment_offset = buffer->offset % buffer->fragment_size;
n = 0;
while (n < length) {
zip_uint64_t left = MY_MIN(length - n, buffer->fragment_size - fragment_offset);
-
+
if (buffer->fragment[i]) {
memcpy(data + n, buffer->fragment[i] + fragment_offset, left);
}
else {
memset(data + n, 0, left);
}
-
+
n += left;
i++;
fragment_offset = 0;
}
-
+
buffer->offset += n;
return (zip_int64_t)n;
}
{
zip_uint8_t b[20];
zip_uint64_t i;
-
+
if (fread(b, 20, 1, f) != 1) {
zip_error_set(error, ZIP_ER_READ, errno);
return -1;
zip_error_set(error, ZIP_ER_READ, EFTYPE);
return -1;
}
-
+
buffer->fragment_size = get_u64(b+4);
buffer->size = get_u64(b+12);
zip_error_set(error, ZIP_ER_MEMORY, 0);
return -1;
}
-
+
for (i = 0; i < buffer->nfragments; i++) {
buffer->fragment[i] = NULL;
}
-
+
i = 0;
while (i < buffer->nfragments) {
if (fread(b, 4, 1, f) != 1) {
zip_error_set(error, ZIP_ER_READ, errno);
return -1;
}
-
+
if (memcmp(b, MARK_DATA, 4) == 0) {
if (buffer->fragment_size > SIZE_MAX) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return -1;
}
}
-
+
return 0;
}
if (new_offset < 0) {
return -1;
}
-
+
buffer->offset = (zip_uint64_t)new_offset;
return 0;
}
FILE *f = fopen(fname, "wb");
zip_uint64_t i;
zip_uint64_t nul_run;
-
+
if (f == NULL) {
zip_error_set(error, ZIP_ER_OPEN, errno);
return -1;
}
-
+
fwrite(MARK_BEGIN, 4, 1, f);
write_u64(buffer->fragment_size, f);
write_u64(buffer->size, f);
-
+
nul_run = 0;
for (i=0; i * buffer->fragment_size <buffer->size; i++) {
if (buffer->fragment[i] == NULL || only_nul(buffer->fragment[i], buffer->fragment_size)) {
nul_run = 0;
}
fwrite(MARK_DATA, 4, 1, f);
-
+
fwrite(buffer->fragment[i], 1, buffer->fragment_size, f);
}
}
-
+
if (nul_run > 0) {
write_nuls(nul_run, f);
}
-
+
if (fclose(f) != 0) {
zip_error_set(error, ZIP_ER_WRITE, errno);
return -1;
static zip_int64_t
buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip_error_t *error)
{
+ zip_uint8_t **fragment;
if (buffer->offset + length > buffer->nfragments * buffer->fragment_size) {
zip_uint64_t needed_fragments = (buffer->offset + length + buffer->fragment_size - 1) / buffer->fragment_size;
zip_uint64_t new_capacity = buffer->nfragments;
zip_uint64_t i;
-
+
if (new_capacity == 0) {
new_capacity = 4;
}
while (new_capacity < needed_fragments) {
new_capacity *= 2;
}
-
- zip_uint8_t **fragment = realloc(buffer->fragment, new_capacity * sizeof(*fragment));
-
+
+ fragment = realloc(buffer->fragment, new_capacity * sizeof(*fragment));
+
if (fragment == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return -1;
}
-
+
for (i = buffer->nfragments; i < new_capacity; i++) {
fragment[i] = NULL;
}
-
+
buffer->fragment = fragment;
buffer->nfragments = new_capacity;
}
if (!only_nul(data, length)) {
zip_uint64_t idx, n, fragment_offset;
-
+
idx = buffer->offset / buffer->fragment_size;
fragment_offset = buffer->offset % buffer->fragment_size;
n = 0;
-
+
while (n < length) {
zip_uint64_t left = MY_MIN(length - n, buffer->fragment_size - fragment_offset);
-
+
if (buffer->fragment[idx] == NULL) {
if ((buffer->fragment[idx] = (zip_uint8_t *)malloc(buffer->fragment_size)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
memset(buffer->fragment[idx], 0, buffer->fragment_size);
}
memcpy(buffer->fragment[idx] + fragment_offset, data + n, left);
-
+
n += left;
idx++;
fragment_offset = 0;
}
}
-
+
buffer->offset += length;
if (buffer->offset > buffer->size) {
buffer->size = buffer->offset;
}
-
+
return (zip_int64_t)length;
}
get_u64(const zip_uint8_t *b)
{
zip_uint64_t i;
-
+
i = (zip_uint64_t)b[0] << 56 | (zip_uint64_t)b[1] << 48 | (zip_uint64_t)b[2] << 40 | (zip_uint64_t)b[3] << 32 | (zip_uint64_t)b[4] << 24 | (zip_uint64_t)b[5] << 16 | (zip_uint64_t)b[6] << 8 | (zip_uint64_t)b[7];
-
+
return i;
}
only_nul(const zip_uint8_t *data, zip_uint64_t length)
{
zip_uint64_t i;
-
+
for (i=0; i< length; i++) {
if (data[i] != '\0') {
return 0;
}
}
-
+
return 1;
}
write_u64(zip_uint64_t u64, FILE *f)
{
zip_uint8_t b[8];
-
+
b[0] = (zip_uint8_t)((u64 >> 56) & 0xff);
b[1] = (zip_uint8_t)((u64 >> 48) & 0xff);
b[2] = (zip_uint8_t)((u64 >> 40) & 0xff);
b[5] = (zip_uint8_t)((u64 >> 16) & 0xff);
b[6] = (zip_uint8_t)((u64 >> 8) & 0xff);
b[7] = (zip_uint8_t)(u64 & 0xff);
-
+
return fwrite(b, 8, 1, f) == 1 ? 0 : -1;
}
hole_new(const char *fname, int flags, zip_error_t *error)
{
hole_t *ctx = (hole_t *)malloc(sizeof(*ctx));
-
+
if (ctx == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
}
-
+
if ((ctx->in = buffer_from_file(fname, flags, error)) == NULL) {
free(ctx);
return NULL;
}
-
+
zip_error_init(&ctx->error);
ctx->out = NULL;
-
+
return ctx;
}
source_hole_cb(void *ud, void *data, zip_uint64_t length, zip_source_cmd_t command)
{
hole_t *ctx = (hole_t *)ud;
-
+
switch (command) {
case ZIP_SOURCE_BEGIN_WRITE:
ctx->out = buffer_new();
return 0;
-
+
case ZIP_SOURCE_CLOSE:
return 0;
-
+
case ZIP_SOURCE_COMMIT_WRITE:
if (buffer_to_file(ctx->out, ctx->fname, &ctx->error) < 0) {
return -1;
ctx->in = ctx->out;
ctx->out = NULL;
return 0;
-
+
case ZIP_SOURCE_ERROR:
return zip_error_to_data(&ctx->error, data, length);
-
+
case ZIP_SOURCE_FREE:
hole_free(ctx);
return 0;
-
+
case ZIP_SOURCE_OPEN:
ctx->in->offset = 0;
return 0;
-
+
case ZIP_SOURCE_READ:
return buffer_read(ctx->in, data, length, &ctx->error);
ctx->out = NULL;
(void)remove(ctx->fname);
return 0;
-
+
case ZIP_SOURCE_ROLLBACK_WRITE:
buffer_free(ctx->out);
ctx->out = NULL;
return 0;
-
+
case ZIP_SOURCE_SEEK:
return buffer_seek(ctx->in, data, length, &ctx->error);
-
+
case ZIP_SOURCE_SEEK_WRITE:
return buffer_seek(ctx->out, data, length, &ctx->error);
-
+
case ZIP_SOURCE_STAT: {
zip_stat_t *st = ZIP_SOURCE_GET_ARGS(zip_stat_t, data, length, &ctx->error);
-
+
if (st == NULL) {
return -1;
}
-
+
/* TODO: return ENOENT if fname doesn't exist */
-
+
st->valid |= ZIP_STAT_SIZE;
st->size = ctx->in->size;
return 0;
}
-
+
case ZIP_SOURCE_TELL:
return (zip_int64_t)ctx->in->offset;
case ZIP_SOURCE_TELL_WRITE:
return (zip_int64_t)ctx->out->offset;
-
+
case ZIP_SOURCE_WRITE:
return buffer_write(ctx->out, data, length, &ctx->error);
-
+
case ZIP_SOURCE_SUPPORTS:
return zip_source_make_command_bitmap(ZIP_SOURCE_BEGIN_WRITE, ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_CLOSE, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_REMOVE, ZIP_SOURCE_ROLLBACK_WRITE, ZIP_SOURCE_SEEK, ZIP_SOURCE_SEEK_WRITE, ZIP_SOURCE_STAT, ZIP_SOURCE_TELL, ZIP_SOURCE_TELL_WRITE, ZIP_SOURCE_WRITE, -1);
-
+
default:
zip_error_set(&ctx->error, ZIP_ER_OPNOTSUPP, 0);
return -1;
/*
- modify.c -- test tool for modifying zip archive in multiple ways
- Copyright (C) 2012-2015 Dieter Baron and Thomas Klausner
+ ziptool.c -- tool for modifying zip archive in multiple ways
+ Copyright (C) 2012-2016 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>
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
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <inttypes.h>
+#ifdef _WIN32
+/* WIN32 needs <fcntl.h> for _O_BINARY */
+#include <fcntl.h>
+#endif
#ifndef HAVE_GETOPT
#include "getopt.h"
#endif
+extern int optopt;
#include "zip.h"
+#include "compat.h"
zip_source_t *source_hole_create(const char *, int flags, zip_error_t *);
static zip_source_t *source_nul(zip_t *za, zip_uint64_t length);
zip_t *za, *z_in[16];
-int z_in_count;
+unsigned int z_in_count;
zip_flags_t stat_flags;
static int
static int
add_from_zip(int argc, char *argv[]) {
- zip_uint64_t idx;
+ zip_uint64_t idx, start;
+ zip_int64_t len;
int err;
zip_source_t *zs;
/* add from another zip file */
idx = strtoull(argv[2], NULL, 10);
- zip_uint64_t start = strtoull(argv[3], NULL, 10);
- zip_int64_t len = strtoll(argv[4], NULL, 10);
+ start = strtoull(argv[3], NULL, 10);
+ len = strtoll(argv[4], NULL, 10);
if ((z_in[z_in_count]=zip_open(argv[1], ZIP_CHECKCONS, &err)) == NULL) {
zip_error_t error;
zip_error_init_with_code(&error, err);
add_nul(int argc, char *argv[]) {
zip_source_t *zs;
zip_uint64_t length = strtoull(argv[1], NULL, 10);
-
+
if ((zs=source_nul(za, length)) == NULL) {
fprintf(stderr, "can't create zip_source for length: %s\n", zip_strerror(za));
return -1;
}
-
+
if (zip_add(za, argv[0], zs) == -1) {
zip_source_free(zs);
fprintf(stderr, "can't add file '%s': %s\n", argv[0], zip_strerror(za));
int err;
idx = strtoull(argv[0], NULL, 10);
+#ifdef _WIN32
+ /* Need to set stdout to binary mode for Windows */
+ setmode(fileno(stdout), _O_BINARY);
+#endif
if ((zf=zip_fopen_index(za, idx, 0)) == NULL) {
fprintf(stderr, "can't open file at index '%" PRIu64 "': %s\n", idx, zip_strerror(za));
return -1;
}
if ((err = zip_fclose(zf)) != 0) {
zip_error_t error;
-
+
zip_error_init_with_code(&error, err);
fprintf(stderr, "can't close file at index '%" PRIu64 "': %s\n", idx, zip_error_strerror(&error));
return -1;
}
static int
+get_num_entries(int argc, char *argv[]) {
+ zip_int64_t count;
+ zip_flags_t flags;
+ /* get number of entries in archive */
+ flags = get_flags(argv[0]);
+ count = zip_get_num_entries(za, flags);
+ printf("%" PRId64 " entr%s in archive\n", count, count == 1 ? "y" : "ies");
+ return 0;
+}
+
+static int
name_locate(int argc, char *argv[]) {
zip_flags_t flags;
zip_int64_t idx;
fprintf(stderr, "can't find entry with name '%s' using flags '%s'\n", argv[0], argv[1]);
} else {
printf("name '%s' using flags '%s' found at index %" PRId64 "\n", argv[0], argv[1], idx);
- }
+ }
return 0;
}
}
static int
+set_file_mtime_all(int argc, char *argv[]) {
+ /* set last modification time (mtime) for all files */
+ time_t mtime;
+ zip_int64_t num_entries;
+ zip_uint64_t idx;
+ mtime = (time_t)strtoull(argv[0], NULL, 10);
+
+ if ((num_entries = zip_get_num_entries(za, 0)) < 0) {
+ fprintf(stderr, "can't get number of entries: %s\n", zip_strerror(za));
+ return -1;
+ }
+ for (idx = 0; idx < (zip_uint64_t)num_entries; idx++) {
+ if (zip_file_set_mtime(za, idx, mtime, 0) < 0) {
+ fprintf(stderr, "can't set file mtime at index '%" PRIu64 "' to `%ld': %s\n", idx, mtime, zip_strerror(za));
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+set_password(int argc, char *argv[]) {
+ /* set default password */
+ if (zip_set_default_password(za, argv[0]) < 0) {
+ fprintf(stderr, "can't set default password to `%s'", argv[0]);
+ return -1;
+ }
+ return 0;
+}
+
+static int
zstat(int argc, char *argv[]) {
zip_uint64_t idx;
char buf[100];
return;
printf("0x");
-
+
for (i=0; i<len; i++)
printf("%02x", data[i]);
- return;
+ return;
}
zip_error_t error;
zip_source_t *src = NULL;
zip_t *zs = NULL;
-
+
zip_error_init(&error);
-
+
if ((src = source_hole_create(archive, flags, &error)) == NULL
|| (zs = zip_open_from_source(src, flags, &error)) == NULL) {
zip_source_free(src);
*err = zip_error_code_zip(&error);
errno = zip_error_code_system(&error);
}
-
+
return zs;
}
source_nul_cb(void *ud, void *data, zip_uint64_t length, zip_source_cmd_t command)
{
source_nul_t *ctx = (source_nul_t *)ud;
-
+
switch (command) {
case ZIP_SOURCE_CLOSE:
return 0;
case ZIP_SOURCE_ERROR:
return zip_error_to_data(&ctx->error, data, length);
-
+
case ZIP_SOURCE_FREE:
free(ctx);
return 0;
-
+
case ZIP_SOURCE_OPEN:
ctx->offset = 0;
return 0;
-
+
case ZIP_SOURCE_READ:
if (length > ZIP_INT64_MAX) {
zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
if (length > ctx->length - ctx->offset) {
length =ctx->length - ctx->offset;
}
-
+
memset(data, 0, length);
ctx->offset += length;
return (zip_int64_t)length;
-
+
case ZIP_SOURCE_STAT: {
zip_stat_t *st = ZIP_SOURCE_GET_ARGS(zip_stat_t, data, length, &ctx->error);
-
+
if (st == NULL) {
return -1;
}
-
+
st->valid |= ZIP_STAT_SIZE;
st->size = ctx->length;
-
+
return 0;
}
-
+
case ZIP_SOURCE_SUPPORTS:
return zip_source_make_command_bitmap(ZIP_SOURCE_CLOSE, ZIP_SOURCE_ERROR, ZIP_SOURCE_FREE, ZIP_SOURCE_OPEN, ZIP_SOURCE_READ, ZIP_SOURCE_STAT, -1);
{
source_nul_t *ctx;
zip_source_t *src;
-
+
if ((ctx = (source_nul_t *)malloc(sizeof(*ctx))) == NULL) {
zip_error_set(zip_get_error(zs), ZIP_ER_MEMORY, 0);
return NULL;
}
-
+
zip_error_init(&ctx->error);
ctx->length = length;
ctx->offset = 0;
-
+
if ((src = zip_source_function(zs, source_nul_cb, ctx)) == NULL) {
free(ctx);
return NULL;
}
-
+
return src;
}
}
if (zip_source_open(src) < 0) {
if (zip_error_code_zip(zip_source_error(src)) == ZIP_ER_DELETED) {
- if (remove(archive) < 0 && errno != ENOENT) {
- fprintf(stderr, "remove failed: %s\n", strerror(errno));
+ if (unlink(archive) < 0 && errno != ENOENT) {
+ fprintf(stderr, "unlink failed: %s\n", strerror(errno));
return -1;
}
return 0;
{ "get_extra", 3, "index extra_index flags", "show extra field", get_extra },
{ "get_extra_by_id", 4, "index extra_id extra_index flags", "show extra field of type extra_id", get_extra_by_id },
{ "get_file_comment", 1, "index", "get file comment", get_file_comment },
+ { "get_num_entries", 1, "flags", "get number of entries in archive", get_num_entries },
{ "name_locate", 2, "name flags", "find entry in archive", name_locate },
{ "rename", 2, "index name", "rename entry", zrename },
{ "replace_file_contents", 2, "index data", "replace entry with data", replace_file_contents },
{ "set_archive_comment", 1, "comment", "set archive comment", set_archive_comment },
{ "set_extra", 5, "index extra_id extra_index flags value", "set extra field", set_extra },
{ "set_file_comment", 2, "index comment", "set file comment", set_file_comment },
- { "set_file_compression", 3, "index method flags", "set file compression method", set_file_compression },
+ { "set_file_compression", 3, "index method compression_flags", "set file compression method", set_file_compression },
{ "set_file_mtime", 2, "index timestamp", "set file modification time", set_file_mtime },
+ { "set_file_mtime_all", 1, "timestamp", "set file modification time for all files", set_file_mtime_all },
+ { "set_password", 1, "password", "set default password for encryption", set_password },
{ "stat", 1, "index", "print information about entry", zstat },
{ "unchange_all", 0, "", "revert all changes", unchange_all },
{ "zin_close", 1, "index", "close input zip_source (for internal tests)", zin_close }
static void
-usage(const char *progname)
+usage(const char *progname, const char *reason)
{
unsigned int i;
- fprintf(stderr, "usage: %s [-cemnt] archive command1 [args] [command2 [args] ...]\n\n"
- "Supported options are:\n"
+ FILE *out;
+ if (reason == NULL)
+ out = stdout;
+ else
+ out = stderr;
+ fprintf(out, "usage: %s [-cegHhmnrst] archive command1 [args] [command2 [args] ...]\n", progname);
+ if (reason != NULL) {
+ fprintf(out, "%s\n", reason);
+ exit(1);
+ }
+
+ fprintf(out, "\nSupported options are:\n"
"\t-c\tcheck consistency\n"
"\t-e\terror if archive already exists (only useful with -n)\n"
"\t-g\tguess file name encoding (for stat)\n"
"\t-H\twrite files with holes compactly\n"
+ "\t-h\tdisplay this usage\n"
"\t-m\tread archive into memory, and modify there; write out at end\n"
- "\t-n\tcreate archive if it doesn't exist (default)\n"
+ "\t-n\tcreate archive if it doesn't exist\n"
"\t-r\tprint raw file name encoding without translation (for stat)\n"
"\t-s\tfollow file name convention strictly (for stat)\n"
- "\t-t\tdisregard current archive contents, if any\n", progname);
- fprintf(stderr, "\nSupported commands and arguments are:\n");
+ "\t-t\tdisregard current archive contents, if any\n");
+ fprintf(out, "\nSupported commands and arguments are:\n");
for (i=0; i<sizeof(dispatch_table)/sizeof(dispatch_table_t); i++) {
- fprintf(stderr, "\t%s %s -- %s\n", dispatch_table[i].cmdline_name, dispatch_table[i].arg_names, dispatch_table[i].description);
+ fprintf(out, "\t%s %s\n\t %s\n\n", dispatch_table[i].cmdline_name, dispatch_table[i].arg_names, dispatch_table[i].description);
}
- fprintf(stderr, "\nSupported flags are:\n"
+ fprintf(out, "\nSupported flags are:\n"
"\tC\tZIP_FL_NOCASE\n"
"\tc\tZIP_FL_CENTRAL\n"
"\td\tZIP_FL_NODIR\n"
"\tl\tZIP_FL_LOCAL\n"
"\tu\tZIP_FL_UNCHANGED\n");
- fprintf(stderr, "\nThe index is zero-based.\n");
- exit(1);
+ fprintf(out, "\nSupported compression methods are:\n"
+ "\tdefault\n"
+ "\tdeflate\n"
+ "\tstore\n");
+ fprintf(out, "\nThe index is zero-based.\n");
+ exit(0);
}
int
{
const char *archive;
zip_source_t *memory_src;
- int c, arg, err, flags, i;
+ unsigned int i;
+ int c, arg, err, flags;
const char *prg;
source_type_t source_type = SOURCE_TYPE_NONE;
prg = argv[0];
if (argc < 2)
- usage(prg);
+ usage(prg, "too few arguments");
- while ((c=getopt(argc, argv, "cegHmnrst")) != -1) {
+ while ((c=getopt(argc, argv, "cegHhmnrst")) != -1) {
switch (c) {
case 'c':
flags |= ZIP_CHECKCONS;
case 'H':
source_type = SOURCE_TYPE_HOLE;
break;
+ case 'h':
+ usage(prg, NULL);
+ break;
case 'm':
source_type = SOURCE_TYPE_IN_MEMORY;
break;
break;
default:
- usage(prg);
+ {
+ char reason[128];
+ snprintf(reason, sizeof(reason), "invalid option -%c", optopt);
+ usage(prg, reason);
+ }
}
}
-
+
arg = optind;
archive = argv[arg++];
case SOURCE_TYPE_NONE:
za = zip_open(archive, flags, &err);
break;
-
+
case SOURCE_TYPE_IN_MEMORY:
za = read_to_memory(archive, flags, &err, &memory_src);
break;
-
+
case SOURCE_TYPE_HOLE: {
za = read_hole(archive, flags, &err);
break;
scriptversion=2013-07-13.22; # UTC
-# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+# Copyright (C) 2011-2014 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
# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?
+
if test $enable_hard_errors = no && test $estatus -eq 99; then
- estatus=1
+ tweaked_estatus=1
+else
+ tweaked_estatus=$estatus
fi
-case $estatus:$expect_failure in
+case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
+# Report the test outcome and exit status in the logs, so that one can
+# know whether the test passed or failed simply by looking at the '.log'
+# file, without the need of also peaking into the corresponding '.trs'
+# file (automake bug#11814).
+echo "$res $test_name (exit status: $estatus)" >>$log_file
+
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
- <string>at.nih.${PRODUCT_NAME:rfc1034identifier}</string>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1
-/* Define to 1 if you have the `MoveFileExA' function. */
-/* #undef HAVE_MOVEFILEEXA */
-
/* Define to 1 if you have the `open' function. */
#define HAVE_OPEN 1
#define PACKAGE_NAME "libzip"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libzip 1.0.1"
+#define PACKAGE_STRING "libzip 1.0.1a"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libzip"
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.0.1"
+#define PACKAGE_VERSION "1.0.1a"
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* #undef TM_IN_SYS_TIME */
/* Version number of package */
-#define VERSION "1.0.1"
+#define VERSION "1.0.1a"
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
buildPhases = (
);
dependencies = (
+ 4B2CADAC1C50D57800291DE6 /* PBXTargetDependency */,
4B01D72D15B2F5AC002D5007 /* PBXTargetDependency */,
4B01D72F15B2F5AC002D5007 /* PBXTargetDependency */,
);
buildPhases = (
);
dependencies = (
+ 4BCF6A7B1C3BDDFF00F036E9 /* PBXTargetDependency */,
4B54447F15C977AF0067BA33 /* PBXTargetDependency */,
4B54448115C977B10067BA33 /* PBXTargetDependency */,
);
4BACD65515BC303B00920691 /* PBXTargetDependency */,
4BACD65715BC303B00920691 /* PBXTargetDependency */,
4BACD65915BC303B00920691 /* PBXTargetDependency */,
- 4BACD5B215BC2DB300920691 /* PBXTargetDependency */,
4BACD66915BC303B00920691 /* PBXTargetDependency */,
);
name = "test programs";
- productName = "command line tools";
+ productName = "test programs";
+ };
+ 4BCF6A681C3BDDD500F036E9 /* examples */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 4BCF6A751C3BDDD500F036E9 /* Build configuration list for PBXAggregateTarget "examples" */;
+ buildPhases = (
+ );
+ dependencies = (
+ 4BCF6A791C3BDDF900F036E9 /* PBXTargetDependency */,
+ );
+ name = examples;
+ productName = "examples";
};
4BDC72A115B1B6EA00236D3C /* Build iOS Framework */ = {
isa = PBXAggregateTarget;
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 3D7E35431B33063F00022624 /* in-memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D7E35401B33063600022624 /* in-memory.c */; };
+ 3D7E35461B33064B00022624 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; };
+ 3D7E35481B33076C00022624 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D7E35471B33076C00022624 /* libz.dylib */; };
+ 3D7E35491B330AD500022624 /* zip_source_is_deleted.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BE402AC19D94AE400298248 /* zip_source_is_deleted.c */; };
+ 3D7E354A1B330BCD00022624 /* zip_source_is_deleted.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BE402AC19D94AE400298248 /* zip_source_is_deleted.c */; };
+ 3D9284811C309510001EABA7 /* zip_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D9284801C309510001EABA7 /* zip_hash.c */; };
+ 3D9284821C309510001EABA7 /* zip_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D9284801C309510001EABA7 /* zip_hash.c */; };
4B01D6A615B2F46B002D5007 /* zip_add_dir.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F115B1B25E00236D3C /* zip_add_dir.c */; };
4B01D6A715B2F46B002D5007 /* zip_add_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F215B1B25E00236D3C /* zip_add_entry.c */; };
4B01D6A815B2F46B002D5007 /* zip_add.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BDC71F315B1B25E00236D3C /* zip_add.c */; };
4B972052188EBE85002FAFAD /* zip_file_set_external_attributes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B97204E188EBE85002FAFAD /* zip_file_set_external_attributes.c */; };
4BACD59315BC2CFA00920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; };
4BACD59415BC2D0800920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; };
- 4BACD59515BC2D1C00920691 /* modify.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57C15BC2AEF00920691 /* modify.c */; };
+ 4BACD59515BC2D1C00920691 /* ziptool.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57C15BC2AEF00920691 /* ziptool.c */; };
4BACD5BB15BC2DC900920691 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D70815B2F4CF002D5007 /* libz.dylib */; };
4BACD5BC15BC2DC900920691 /* libzip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B01D68B15B2F3F1002D5007 /* libzip.framework */; };
4BACD5C315BC2DE000920691 /* add_from_filep.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BACD57715BC2AEF00920691 /* add_from_filep.c */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 3D7E35441B33064500022624 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4B01D68A15B2F3F1002D5007;
+ remoteInfo = libzip;
+ };
4B01D72C15B2F5AC002D5007 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
remoteGlobalIDString = 4B01D68A15B2F3F1002D5007;
remoteInfo = "libzip Mac";
};
+ 4B2CADAB1C50D57800291DE6 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4BACD58815BC2CEA00920691;
+ remoteInfo = ziptool;
+ };
4B54447E15C977AF0067BA33 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
remoteGlobalIDString = 4B01D68A15B2F3F1002D5007;
remoteInfo = "libzip Mac";
};
- 4BACD5B115BC2DB300920691 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 4BACD58815BC2CEA00920691;
- remoteInfo = modify;
- };
4BACD5B715BC2DC900920691 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
remoteGlobalIDString = 4BACD64515BC301300920691;
remoteInfo = tryopen;
};
+ 4BCF6A781C3BDDF900F036E9 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 3D7E35361B3305FB00022624;
+ remoteInfo = "in-memory";
+ };
+ 4BCF6A7A1C3BDDFF00F036E9 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4BCF6A681C3BDDD500F036E9;
+ remoteInfo = examples;
+ };
4BD6CB6119E71CD100710654 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4BDC71BF15B181DA00236D3C /* Project object */;
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
+ 3D7E35351B3305FB00022624 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
4B01D6FB15B2F4B1002D5007 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
/* Begin PBXFileReference section */
3D77B86517009AA1000A5794 /* extract-version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "extract-version.sh"; sourceTree = SOURCE_ROOT; };
+ 3D7E35371B3305FB00022624 /* in-memory */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "in-memory"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3D7E35401B33063600022624 /* in-memory.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "in-memory.c"; sourceTree = "<group>"; };
+ 3D7E35421B33063600022624 /* windows-open.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "windows-open.c"; sourceTree = "<group>"; };
+ 3D7E35471B33076C00022624 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
+ 3D9284801C309510001EABA7 /* zip_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_hash.c; sourceTree = "<group>"; };
4B01D68B15B2F3F1002D5007 /* libzip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = libzip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B01D6FD15B2F4B1002D5007 /* zipmerge */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = zipmerge; sourceTree = BUILT_PRODUCTS_DIR; };
4B01D70815B2F4CF002D5007 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
4BACD57715BC2AEF00920691 /* add_from_filep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = add_from_filep.c; path = ../regress/add_from_filep.c; sourceTree = "<group>"; };
4BACD57A15BC2AEF00920691 /* fopen_unchanged.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = fopen_unchanged.c; path = ../regress/fopen_unchanged.c; sourceTree = "<group>"; };
4BACD57B15BC2AEF00920691 /* fread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = fread.c; path = ../regress/fread.c; sourceTree = "<group>"; };
- 4BACD57C15BC2AEF00920691 /* modify.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = modify.c; path = ../regress/modify.c; sourceTree = "<group>"; };
+ 4BACD57C15BC2AEF00920691 /* ziptool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ziptool.c; sourceTree = "<group>"; };
4BACD58415BC2AEF00920691 /* tryopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tryopen.c; path = ../regress/tryopen.c; sourceTree = "<group>"; };
- 4BACD58915BC2CEA00920691 /* modify */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = modify; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4BACD58915BC2CEA00920691 /* ziptool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ziptool; sourceTree = BUILT_PRODUCTS_DIR; };
4BACD5C115BC2DC900920691 /* add_from_filep */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = add_from_filep; sourceTree = BUILT_PRODUCTS_DIR; };
4BACD5D015BC2DF200920691 /* fopen_unchanged */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fopen_unchanged; sourceTree = BUILT_PRODUCTS_DIR; };
4BACD5DF15BC2F3700920691 /* fread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fread; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 3D7E35341B3305FB00022624 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 3D7E35481B33076C00022624 /* libz.dylib in Frameworks */,
+ 3D7E35461B33064B00022624 /* libzip.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4B01D68715B2F3F1002D5007 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 3D7E353E1B33063600022624 /* examples */ = {
+ isa = PBXGroup;
+ children = (
+ 3D7E35401B33063600022624 /* in-memory.c */,
+ 3D7E35421B33063600022624 /* windows-open.c */,
+ );
+ name = examples;
+ path = ../examples;
+ sourceTree = "<group>";
+ };
4B01D72015B2F54C002D5007 /* src */ = {
isa = PBXGroup;
children = (
4B6B06E115F119AE008C2CBE /* compat.h */,
4B01D72115B2F572002D5007 /* zipcmp.c */,
4B01D72215B2F572002D5007 /* zipmerge.c */,
+ 4BD6CB5E19E71B3B00710654 /* hole.c */,
+ 4BACD57C15BC2AEF00920691 /* ziptool.c */,
+ 4BD6CB5C19E6A5D900710654 /* source_hole.c */,
);
name = src;
path = ../src;
4BACD57715BC2AEF00920691 /* add_from_filep.c */,
4BACD57A15BC2AEF00920691 /* fopen_unchanged.c */,
4BACD57B15BC2AEF00920691 /* fread.c */,
- 4BD6CB5E19E71B3B00710654 /* hole.c */,
- 4BACD57C15BC2AEF00920691 /* modify.c */,
- 4BD6CB5C19E6A5D900710654 /* source_hole.c */,
4BACD58415BC2AEF00920691 /* tryopen.c */,
4BD35E401A33362A00256CB7 /* test cases */,
);
children = (
4B28AA2815BAD4F800D0C17D /* info */,
4BDC71E415B182B200236D3C /* Supporting Files */,
+ 3D7E353E1B33063600022624 /* examples */,
4BDC71E315B182B200236D3C /* libzip */,
4B01D72015B2F54C002D5007 /* src */,
4BACD57415BC2AA100920691 /* regress */,
4B01D68B15B2F3F1002D5007 /* libzip.framework */,
4B01D6FD15B2F4B1002D5007 /* zipmerge */,
4B01D71315B2F4EB002D5007 /* zipcmp */,
- 4BACD58915BC2CEA00920691 /* modify */,
+ 4BACD58915BC2CEA00920691 /* ziptool */,
4BACD5C115BC2DC900920691 /* add_from_filep */,
4BACD5D015BC2DF200920691 /* fopen_unchanged */,
4BACD5DF15BC2F3700920691 /* fread */,
4BACD65015BC301300920691 /* tryopen */,
4BD6CB6C19E71CD100710654 /* hole */,
+ 3D7E35371B3305FB00022624 /* in-memory */,
);
name = Products;
sourceTree = "<group>";
4BDC71CA15B181DA00236D3C /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 3D7E35471B33076C00022624 /* libz.dylib */,
4B01D70815B2F4CF002D5007 /* libz.dylib */,
);
name = Frameworks;
4BDC721A15B1B25E00236D3C /* zip_get_num_entries.c */,
4BDC721B15B1B25E00236D3C /* zip_get_num_files.c */,
4BCF3019199A2F820064207B /* zip_io_util.c */,
+ 3D9284801C309510001EABA7 /* zip_hash.c */,
4BDC721C15B1B25E00236D3C /* zip_memdup.c */,
4BDC721D15B1B25E00236D3C /* zip_name_locate.c */,
4BDC721E15B1B25E00236D3C /* zip_new.c */,
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 3D7E35361B3305FB00022624 /* in-memory */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 3D7E353D1B3305FB00022624 /* Build configuration list for PBXNativeTarget "in-memory" */;
+ buildPhases = (
+ 3D7E35331B3305FB00022624 /* Sources */,
+ 3D7E35341B3305FB00022624 /* Frameworks */,
+ 3D7E35351B3305FB00022624 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 3D7E35451B33064500022624 /* PBXTargetDependency */,
+ );
+ name = "in-memory";
+ productName = "in-memory-example";
+ productReference = 3D7E35371B3305FB00022624 /* in-memory */;
+ productType = "com.apple.product-type.tool";
+ };
4B01D68A15B2F3F1002D5007 /* libzip */ = {
isa = PBXNativeTarget;
buildConfigurationList = 4B01D69E15B2F3F1002D5007 /* Build configuration list for PBXNativeTarget "libzip" */;
4B01D73815B2F643002D5007 /* PBXTargetDependency */,
);
name = zipcmp;
- productName = zipmerge;
+ productName = zipcmp;
productReference = 4B01D71315B2F4EB002D5007 /* zipcmp */;
productType = "com.apple.product-type.tool";
};
- 4BACD58815BC2CEA00920691 /* modify */ = {
+ 4BACD58815BC2CEA00920691 /* ziptool */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "modify" */;
+ buildConfigurationList = 4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "ziptool" */;
buildPhases = (
4BACD58515BC2CEA00920691 /* Sources */,
4BACD58615BC2CEA00920691 /* Frameworks */,
dependencies = (
4BACD59715BC2D3800920691 /* PBXTargetDependency */,
);
- name = modify;
- productName = modify;
- productReference = 4BACD58915BC2CEA00920691 /* modify */;
+ name = ziptool;
+ productName = ziptool;
+ productReference = 4BACD58915BC2CEA00920691 /* ziptool */;
productType = "com.apple.product-type.tool";
};
4BACD5B515BC2DC900920691 /* add_from_filep */ = {
4BACD5B615BC2DC900920691 /* PBXTargetDependency */,
);
name = add_from_filep;
- productName = modify;
+ productName = add_from_filep;
productReference = 4BACD5C115BC2DC900920691 /* add_from_filep */;
productType = "com.apple.product-type.tool";
};
4BACD5C515BC2DF200920691 /* PBXTargetDependency */,
);
name = fopen_unchanged;
- productName = modify;
+ productName = fopen_unchanged;
productReference = 4BACD5D015BC2DF200920691 /* fopen_unchanged */;
productType = "com.apple.product-type.tool";
};
4BACD5D415BC2F3700920691 /* PBXTargetDependency */,
);
name = fread;
- productName = modify;
+ productName = fread;
productReference = 4BACD5DF15BC2F3700920691 /* fread */;
productType = "com.apple.product-type.tool";
};
4BACD64615BC301300920691 /* PBXTargetDependency */,
);
name = tryopen;
- productName = modify;
+ productName = tryopen;
productReference = 4BACD65015BC301300920691 /* tryopen */;
productType = "com.apple.product-type.tool";
};
4BD6CB6019E71CD100710654 /* PBXTargetDependency */,
);
name = hole;
- productName = modify;
+ productName = hole;
productReference = 4BD6CB6C19E71CD100710654 /* hole */;
productType = "com.apple.product-type.tool";
};
4BDC71BF15B181DA00236D3C /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0630;
+ LastUpgradeCheck = 0720;
ORGANIZATIONNAME = NiH;
+ TargetAttributes = {
+ 3D7E35361B3305FB00022624 = {
+ CreatedOnToolsVersion = 6.3.2;
+ };
+ };
};
buildConfigurationList = 4BDC71C215B181DA00236D3C /* Build configuration list for PBXProject "libzip" */;
compatibilityVersion = "Xcode 3.2";
4B01D72815B2F5A2002D5007 /* command line tools */,
4B01D6FC15B2F4B1002D5007 /* zipmerge */,
4B01D70A15B2F4EB002D5007 /* zipcmp */,
+ 4BCF6A681C3BDDD500F036E9 /* examples */,
+ 3D7E35361B3305FB00022624 /* in-memory */,
4BACD5A715BC2D8200920691 /* test programs */,
4BACD5B515BC2DC900920691 /* add_from_filep */,
4BACD5C415BC2DF200920691 /* fopen_unchanged */,
4BACD5D315BC2F3700920691 /* fread */,
4BD6CB5F19E71CD100710654 /* hole */,
- 4BACD58815BC2CEA00920691 /* modify */,
+ 4BACD58815BC2CEA00920691 /* ziptool */,
4BACD64515BC301300920691 /* tryopen */,
);
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
+ 3D7E35331B3305FB00022624 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 3D7E35431B33063F00022624 /* in-memory.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4B01D68615B2F3F1002D5007 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 3D7E35491B330AD500022624 /* zip_source_is_deleted.c in Sources */,
4BCF3039199ABDDA0064207B /* zip_source_tell_write.c in Sources */,
4B01D6A615B2F46B002D5007 /* zip_add_dir.c in Sources */,
4B972052188EBE85002FAFAD /* zip_file_set_external_attributes.c in Sources */,
4B01D6C515B2F46B002D5007 /* zip_fopen_index_encrypted.c in Sources */,
4B01D6C615B2F46B002D5007 /* zip_fopen_index.c in Sources */,
4B01D6C715B2F46B002D5007 /* zip_fopen.c in Sources */,
+ 3D9284821C309510001EABA7 /* zip_hash.c in Sources */,
4B01D6C815B2F46B002D5007 /* zip_fread.c in Sources */,
4B01D6C915B2F46B002D5007 /* zip_get_archive_comment.c in Sources */,
4B01D6CA15B2F46B002D5007 /* zip_get_archive_flag.c in Sources */,
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 4BACD59515BC2D1C00920691 /* modify.c in Sources */,
+ 4BACD59515BC2D1C00920691 /* ziptool.c in Sources */,
4BD6CB5D19E6A5D900710654 /* source_hole.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 3D7E354A1B330BCD00022624 /* zip_source_is_deleted.c in Sources */,
4BCF3038199ABDDA0064207B /* zip_source_tell_write.c in Sources */,
4BDC724415B1B25E00236D3C /* zip_add_dir.c in Sources */,
4B972051188EBE85002FAFAD /* zip_file_set_external_attributes.c in Sources */,
4BDC726315B1B25E00236D3C /* zip_fopen_index_encrypted.c in Sources */,
4BDC726415B1B25E00236D3C /* zip_fopen_index.c in Sources */,
4BDC726515B1B25E00236D3C /* zip_fopen.c in Sources */,
+ 3D9284811C309510001EABA7 /* zip_hash.c in Sources */,
4BDC726615B1B25E00236D3C /* zip_fread.c in Sources */,
4BDC726715B1B25E00236D3C /* zip_get_archive_comment.c in Sources */,
4BDC726815B1B25E00236D3C /* zip_get_archive_flag.c in Sources */,
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 3D7E35451B33064500022624 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4B01D68A15B2F3F1002D5007 /* libzip */;
+ targetProxy = 3D7E35441B33064500022624 /* PBXContainerItemProxy */;
+ };
4B01D72D15B2F5AC002D5007 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4B01D6FC15B2F4B1002D5007 /* zipmerge */;
target = 4B01D68A15B2F3F1002D5007 /* libzip */;
targetProxy = 4B01D73715B2F643002D5007 /* PBXContainerItemProxy */;
};
+ 4B2CADAC1C50D57800291DE6 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4BACD58815BC2CEA00920691 /* ziptool */;
+ targetProxy = 4B2CADAB1C50D57800291DE6 /* PBXContainerItemProxy */;
+ };
4B54447F15C977AF0067BA33 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4B01D72815B2F5A2002D5007 /* command line tools */;
target = 4B01D68A15B2F3F1002D5007 /* libzip */;
targetProxy = 4BACD59615BC2D3800920691 /* PBXContainerItemProxy */;
};
- 4BACD5B215BC2DB300920691 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 4BACD58815BC2CEA00920691 /* modify */;
- targetProxy = 4BACD5B115BC2DB300920691 /* PBXContainerItemProxy */;
- };
4BACD5B615BC2DC900920691 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4B01D68A15B2F3F1002D5007 /* libzip */;
target = 4BACD64515BC301300920691 /* tryopen */;
targetProxy = 4BACD66815BC303B00920691 /* PBXContainerItemProxy */;
};
+ 4BCF6A791C3BDDF900F036E9 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 3D7E35361B3305FB00022624 /* in-memory */;
+ targetProxy = 4BCF6A781C3BDDF900F036E9 /* PBXContainerItemProxy */;
+ };
+ 4BCF6A7B1C3BDDFF00F036E9 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4BCF6A681C3BDDD500F036E9 /* examples */;
+ targetProxy = 4BCF6A7A1C3BDDFF00F036E9 /* PBXContainerItemProxy */;
+ };
4BD6CB6019E71CD100710654 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4B01D68A15B2F3F1002D5007 /* libzip */;
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
+ 3D7E353B1B3305FB00022624 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 3D7E353C1B3305FB00022624 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
4B01D69C15B2F3F1002D5007 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"",
- );
FRAMEWORK_VERSION = A;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_WARN_SIGN_COMPARE = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@rpath";
+ PRODUCT_BUNDLE_IDENTIFIER = "at.nih.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
VERSION_INFO_BUILDER = "";
VERSION_INFO_FILE = "";
WRAPPER_EXTENSION = framework;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"",
- );
FRAMEWORK_VERSION = A;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_WARN_SIGN_COMPARE = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@rpath";
+ PRODUCT_BUNDLE_IDENTIFIER = "at.nih.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
VERSION_INFO_BUILDER = "";
VERSION_INFO_FILE = "";
WRAPPER_EXTENSION = framework;
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
};
name = Release;
};
+ 4BCF6A761C3BDDD500F036E9 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COMBINE_HIDPI_IMAGES = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 4BCF6A771C3BDDD500F036E9 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COMBINE_HIDPI_IMAGES = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
4BD6CB6A19E71CD100710654 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
+ PRODUCT_BUNDLE_IDENTIFIER = "at.nih.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
+ PRODUCT_BUNDLE_IDENTIFIER = "at.nih.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 3D7E353D1B3305FB00022624 /* Build configuration list for PBXNativeTarget "in-memory" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 3D7E353B1B3305FB00022624 /* Debug */,
+ 3D7E353C1B3305FB00022624 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
4B01D69E15B2F3F1002D5007 /* Build configuration list for PBXNativeTarget "libzip" */ = {
isa = XCConfigurationList;
buildConfigurations = (
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "modify" */ = {
+ 4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "ziptool" */ = {
isa = XCConfigurationList;
buildConfigurations = (
4BACD59115BC2CEA00920691 /* Debug */,
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 4BCF6A751C3BDDD500F036E9 /* Build configuration list for PBXAggregateTarget "examples" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4BCF6A761C3BDDD500F036E9 /* Debug */,
+ 4BCF6A771C3BDDD500F036E9 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
4BD6CB6919E71CD100710654 /* Build configuration list for PBXNativeTarget "hole" */ = {
isa = XCConfigurationList;
buildConfigurations = (