├── libzip-0.7.1 ├── regress │ ├── testfile.txt │ ├── test.zip │ ├── broken.zip │ ├── encrypt.zip │ ├── testfile.zip │ ├── testbuffer.zip │ ├── testchanged.zip │ ├── testcomment.zip │ ├── testchangedlocal.zip │ ├── testcommentremoved.zip │ ├── fread.test │ ├── name_locate.test │ ├── encrypt.test │ ├── add_from_buffer.test │ ├── open.test │ ├── add_from_file.test │ ├── add_from_filep.test │ ├── set_comment_all.test │ ├── set_comment_removeglobal.test │ ├── set_comment_localonly.test │ ├── set_comment_revert.test │ ├── get_comment.test │ ├── deltest.c │ ├── Makefile.am │ ├── ziptest.c │ ├── encrypt.c │ ├── set_comment_removeglobal.c │ └── get_comment.c ├── AUTHORS ├── Makefile.am ├── src │ └── Makefile.am ├── THANKS ├── libzip-uninstalled.pc.in ├── libzip.pc.in ├── NEWS ├── README ├── lib │ ├── Makefile.am │ ├── zip_err_str.c │ ├── zip_error_get.c │ ├── zip_strerror.c │ ├── zip_file_error_get.c │ ├── zip_file_strerror.c │ ├── zip_get_num_files.c │ ├── zip_error_get_sys_type.c │ ├── zip_unchange_archive.c │ ├── zip_source_free.c │ ├── zip_rename.c │ ├── zip_stat.c │ ├── zip_fopen.c │ ├── zip_add.c │ ├── zip_unchange_all.c │ ├── zip_entry_free.c │ ├── zip_unchange_data.c │ ├── zip_memdup.c │ ├── zip_get_archive_comment.c │ ├── zip_delete.c │ ├── zip_source_function.c │ ├── zip_get_file_comment.c │ ├── zip_set_archive_comment.c │ ├── zip_source_file.c │ ├── zip_set_file_comment.c │ ├── zip_error_to_str.c │ ├── zip_fclose.c │ ├── zip_new.c │ ├── zip_free.c │ ├── zip_get_name.c │ ├── zip_set_name.c │ ├── zip_file_get_offset.c │ ├── zip_replace.c │ ├── zip_entry_new.c │ ├── zip_error.c │ ├── zip_unchange.c │ ├── zip_error_strerror.c │ ├── zip_name_locate.c │ └── make_zip_err_str.sh ├── configure.ac ├── man │ ├── zip_fclose.mdoc │ ├── zip_fread.mdoc │ ├── zip_get_num_files.mdoc │ ├── zip_fclose.man │ ├── zip_fread.man │ ├── zip_unchange_all.mdoc │ ├── zip_get_num_files.man │ ├── zip_unchange_archive.mdoc │ ├── zip_unchange_all.man │ ├── zip_unchange_archive.man │ ├── zip_delete.mdoc │ ├── Makefile.am │ ├── zip_source_free.mdoc │ ├── zip_error_get_sys_type.mdoc │ ├── zip_delete.man │ ├── zip_source_free.man │ ├── zip_error_get_sys_type.man │ ├── zip_rename.mdoc │ ├── zip_name_locate.mdoc │ ├── zip_unchange.mdoc │ ├── zip_name_locate.man │ ├── zip_rename.man │ ├── zip_unchange.man │ ├── zipcmp.mdoc │ ├── zip_error_get.mdoc │ ├── zip_get_archive_comment.mdoc │ ├── zip_file_strerror.mdoc │ ├── zip_error_get.man │ ├── zipcmp.man │ ├── zip_set_archive_comment.mdoc │ ├── zipmerge.mdoc │ └── zip_get_archive_comment.man └── TODO ├── m4 └── .gitignore ├── Makefile.am ├── tests ├── originals │ ├── mac-archive.zip │ └── windows-archive.zip ├── Makefile.am └── check-runzip.sh ├── .travis.yml ├── src └── Makefile.am ├── .gitignore ├── .clang-format ├── ChangeLog ├── configure.ac ├── README.md └── LICENSE /libzip-0.7.1/regress/testfile.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | libtool* 2 | lt* 3 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = libzip-0.7.1 src tests 3 | -------------------------------------------------------------------------------- /libzip-0.7.1/AUTHORS: -------------------------------------------------------------------------------- 1 | Dieter Baron 2 | Thomas Klausner -------------------------------------------------------------------------------- /libzip-0.7.1/regress/test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/test.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/broken.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/broken.zip -------------------------------------------------------------------------------- /tests/originals/mac-archive.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/tests/originals/mac-archive.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/encrypt.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/encrypt.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/testfile.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/testfile.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/testbuffer.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/testbuffer.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/testchanged.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/testchanged.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/testcomment.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/testcomment.zip -------------------------------------------------------------------------------- /tests/originals/windows-archive.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/tests/originals/windows-archive.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/testchangedlocal.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/testchangedlocal.zip -------------------------------------------------------------------------------- /libzip-0.7.1/regress/testcommentremoved.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vlm/zip-fix-filename-encoding/HEAD/libzip-0.7.1/regress/testcommentremoved.zip -------------------------------------------------------------------------------- /libzip-0.7.1/Makefile.am: -------------------------------------------------------------------------------- 1 | # not GPL, thus no COPYING 2 | AUTOMAKE_OPTIONS=foreign 3 | 4 | # not needed for runzip: SUBDIRS=src man regress 5 | SUBDIRS=lib 6 | 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | compiler: 4 | - gcc 5 | - clang 6 | script: autoreconf -iv && ./configure LDFLAGS=-L/usr/local/lib && make check 7 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | dist_check_SCRIPTS = check-runzip.sh 3 | 4 | TESTS = check-runzip.sh 5 | 6 | TESTS_ENVIRONMENT= RUNZIP="$(top_builddir)/src/runzip" 7 | 8 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | 3 | bin_PROGRAMS = runzip 4 | 5 | runzip_CFLAGS = -W -Wall -I$(top_srcdir)/libzip-0.7.1/lib -std=gnu99 6 | runzip_LDADD = $(top_builddir)/libzip-0.7.1/lib/libzip.la 7 | 8 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/fread.test: -------------------------------------------------------------------------------- 1 | # various tests for zip_fread 2 | # $NiH: fread.test,v 1.2 2006/04/23 00:38:44 wiz Exp $ 3 | program fread 4 | args broken.zip 5 | return 0 6 | file broken.zip broken.zip broken.zip 7 | -------------------------------------------------------------------------------- /libzip-0.7.1/src/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_PROGRAMS=zipcmp zipmerge 2 | 3 | zipcmp_CPPFLAGS=-I${top_srcdir}/lib 4 | zipcmp_LDADD=../lib/libzip.la 5 | zipmerge_CPPFLAGS=-I${top_srcdir}/lib 6 | zipmerge_LDADD=../lib/libzip.la 7 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/name_locate.test: -------------------------------------------------------------------------------- 1 | # various tests for zip_name_locate 2 | # $NiH: name_locate.test,v 1.2 2006/04/23 00:38:44 wiz Exp $ 3 | program name_locate 4 | args test.zip 5 | return 0 6 | file test.zip test.zip test.zip 7 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/encrypt.test: -------------------------------------------------------------------------------- 1 | # test encryption support 2 | # $NiH: encrypt.test,v 1.1 2006/04/24 14:04:19 dillo Exp $ 3 | program encrypt 4 | return 0 5 | args encrypt.zip 6 | file encrypt.zip encrypt.zip encrypt.zip 7 | stdout 0: 1 8 | stdout 1: 0 9 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/add_from_buffer.test: -------------------------------------------------------------------------------- 1 | # add buffer contents as file to zip 2 | # $NiH: add_from_buffer.test,v 1.2 2006/04/23 00:38:44 wiz Exp $ 3 | program add_from_buffer 4 | return 0 5 | args testbuffer.zip 6 | file-new testbuffer.zip testbuffer.zip 7 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/open.test: -------------------------------------------------------------------------------- 1 | # various tests for zip_open 2 | # $NiH: open.test,v 1.2 2006/04/23 00:38:44 wiz Exp $ 3 | program open 4 | args test.zip Makefile.am 5 | return 0 6 | file test.zip test.zip test.zip 7 | file Makefile.am Makefile.am Makefile.am 8 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/add_from_file.test: -------------------------------------------------------------------------------- 1 | # add file to zip 2 | # $NiH: add_from_file.test,v 1.2 2006/04/23 00:38:44 wiz Exp $ 3 | program add_from_file 4 | return 0 5 | args testfile.zip testfile.txt 6 | file testfile.txt testfile.txt testfile.txt 7 | file-new testfile.zip testfile.zip 8 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/add_from_filep.test: -------------------------------------------------------------------------------- 1 | # add file to zip 2 | # $NiH: add_from_filep.test,v 1.2 2006/04/23 00:38:44 wiz Exp $ 3 | program add_from_filep 4 | return 0 5 | args testfile.zip testfile.txt 6 | file testfile.txt testfile.txt testfile.txt 7 | file-new testfile.zip testfile.zip 8 | -------------------------------------------------------------------------------- /libzip-0.7.1/THANKS: -------------------------------------------------------------------------------- 1 | Thanks to Info-ZIP for info on the DOS-time/date conversion code, 2 | and some other general information gathered from their sources. 3 | 4 | Thanks to these people for suggestions, testing, and bug reports: 5 | 6 | Heiko Hund 7 | Joel Ebrahimi 8 | -------------------------------------------------------------------------------- /libzip-0.7.1/libzip-uninstalled.pc.in: -------------------------------------------------------------------------------- 1 | zipcmp=${pc_top_builddir}/${pcfiledir}/src/zipcmp 2 | 3 | Name: libzip uninstalled 4 | Description: library for handling zip archvies, uninstalled 5 | Version: @VERSION@ 6 | Libs: ${pc_top_builddir}/${pcfiledir}/lib/libzip.la @LIBS@ 7 | Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@/lib 8 | -------------------------------------------------------------------------------- /libzip-0.7.1/libzip.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | zipcmp=@prefix@/bin/zipcmp 7 | 8 | Name: libzip 9 | Description: library for handling zip archives 10 | Version: @VERSION@ 11 | Libs: -L${libdir} -lzip @LIBS@ 12 | Cflags: -I${includedir} 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Editor swaps 2 | *.swp 3 | *~ 4 | .deps 5 | *.o 6 | *.la 7 | *.lo 8 | *.log 9 | *.trs 10 | 11 | libzip-0.7.1/* 12 | 13 | config/ 14 | autom4te.cache 15 | aclocal.m4 16 | config.h.in 17 | configure 18 | config.log 19 | config.status 20 | libtool 21 | stamp-h1 22 | config.h 23 | Makefile 24 | Makefile.in 25 | 26 | runzip 27 | runzip-*.gz 28 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/set_comment_all.test: -------------------------------------------------------------------------------- 1 | # change local and global comments in a zip archive 2 | # $NiH: set_comment_all.test,v 1.1 2006/04/23 12:25:00 wiz Exp $ 3 | program set_comment_all 4 | return 0 5 | # need filename extension != zip to avoid using zipcmp, 6 | # which doesn't look at comments 7 | args testcomment.reg 8 | file testcomment.reg testcomment.zip testchanged.zip 9 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/set_comment_removeglobal.test: -------------------------------------------------------------------------------- 1 | # remove archive comment 2 | # $NiH: set_comment_removeglobal.test,v 1.1 2006/04/23 13:28:31 wiz Exp $ 3 | program set_comment_removeglobal 4 | return 0 5 | # need filename extension != zip to avoid using zipcmp, 6 | # which doesn't look at comments 7 | args testcomment.reg 8 | file testcomment.reg testcomment.zip testcommentremoved.zip 9 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/set_comment_localonly.test: -------------------------------------------------------------------------------- 1 | # change local comments in a zip archive 2 | # $NiH: set_comment_localonly.test,v 1.1 2006/04/23 12:25:00 wiz Exp $ 3 | program set_comment_localonly 4 | return 0 5 | # need filename extension != zip to avoid using zipcmp, 6 | # which doesn't look at comments 7 | args testcomment.reg 8 | file testcomment.reg testcomment.zip testchangedlocal.zip 9 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/set_comment_revert.test: -------------------------------------------------------------------------------- 1 | # start changing local and global comments, but revert before closing 2 | # $NiH: set_comment_revert.test,v 1.1 2006/04/23 13:21:19 wiz Exp $ 3 | program set_comment_revert 4 | return 0 5 | # need filename extension != zip to avoid using zipcmp, 6 | # which doesn't look at comments 7 | args testcomment.reg 8 | file testcomment.reg testcomment.zip testcomment.zip 9 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | BasedOnStyle: Google 4 | AllowShortFunctionsOnASingleLine: None 5 | AlwaysBreakAfterDefinitionReturnType: TopLevel 6 | BreakBeforeBinaryOperators: NonAssignment 7 | ForEachMacros: [ TQ_FOR ] 8 | IndentCaseLabels: false 9 | IndentWidth: 4 10 | MaxEmptyLinesToKeep: 2 11 | SpaceBeforeParens: false 12 | TabWidth: 4 13 | ... 14 | 15 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | 1.4: 2015-Dec-21 3 | * Stopped using UTF-8-MAC, because it does more damage than good. 4 | 5 | 1.3: 2015-Dec-20 6 | * Added -w switch to produce Windows-compatible archives. 7 | 8 | 1.2: 2015-Dec-20 9 | * Fix encoding detection bug. 10 | * Properly set directories permissions. 11 | * Fixed idempotence of double-conversion into UTF-8-MAC. 12 | 13 | 1.1: 2015-Dec-20 14 | * Use UTF-8-MAC on Apple Macs. 15 | 16 | -------------------------------------------------------------------------------- /tests/check-runzip.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -u 5 | 6 | RUNZIP=${RUNZIP=../src/runzip} 7 | 8 | rm -rf processed 9 | cp -r originals processed 10 | 11 | ${RUNZIP} -vv processed/*.zip 12 | 13 | # zipdetails processed/windows-archive.zip 14 | unzip -d processed/windows processed/windows-archive.zip || : 15 | 16 | # zipdetails processed/mac-archive.zip 17 | unzip -d processed/mac processed/mac-archive.zip || : 18 | 19 | ls -alR processed 20 | 21 | rm -rf processed 22 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT(runzip, 1.4, vlm@lionet.info) 2 | 3 | AC_CONFIG_SRCDIR([src/runzip.c]) 4 | AC_CONFIG_AUX_DIR(config) 5 | AM_INIT_AUTOMAKE(foreign) 6 | AC_CONFIG_MACRO_DIR([m4]) 7 | 8 | AC_CONFIG_HEADER([config.h]) 9 | AC_CONFIG_SUBDIRS([libzip-0.7.1]) 10 | 11 | AC_PROG_CC 12 | AC_PROG_INSTALL 13 | AM_PROG_LIBTOOL 14 | 15 | AC_CHECK_LIB(iconv, iconv_open) 16 | AC_CHECK_HEADERS(iconv.h, [], 17 | [AC_MSG_FAILURE([iconv.h is missing.])]) 18 | 19 | 20 | AC_CONFIG_FILES([Makefile 21 | src/Makefile 22 | tests/Makefile]) 23 | AC_OUTPUT 24 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/get_comment.test: -------------------------------------------------------------------------------- 1 | # show comments of a zip archive 2 | # $NiH: get_comment.test,v 1.1 2006/04/23 00:39:58 wiz Exp $ 3 | program get_comment 4 | return 0 5 | args testcomment.zip 6 | file testcomment.zip testcomment.zip testcomment.zip 7 | stdout Archive comment: This is the archive comment for the file. 8 | stdout 9 | stdout Long. 10 | stdout 11 | stdout Longer. 12 | stdout 13 | stdout No comment for `file1' 14 | stdout File comment for `file2': First one had no comment. 15 | stdout File comment for `file3': Third one. 16 | stdout File comment for `file4': Last. 17 | -------------------------------------------------------------------------------- /libzip-0.7.1/NEWS: -------------------------------------------------------------------------------- 1 | 0.7.1 [2006/05/18] 2 | 3 | * bugfix for zip_close 4 | 5 | 0.7 [2006/05/06] 6 | 7 | * struct zip_stat increased for future encryption support 8 | * zip_add return value changed (now returns new index of added file) 9 | * shared library major bump because of previous two 10 | * added functions for reading and writing file and archive comments. 11 | New functions: zip_get_archive_comment, zip_get_file_comment, 12 | zip_set_archive_comment, zip_set_file_comment, zip_unchange_archive 13 | 14 | 0.6.1 [2005/07/14] 15 | 16 | * various bug fixes 17 | 18 | 0.6 [2005/06/09] 19 | 20 | * first standalone release 21 | * changed license to three-clause BSD 22 | * overhauled API 23 | * added man pages 24 | * install zipcmp and zipmerge 25 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/deltest.c: -------------------------------------------------------------------------------- 1 | #include "zip.h" 2 | #include "error.h" 3 | 4 | char *prg; 5 | #define BUFSIZE 65536 6 | 7 | int 8 | main(int argc, char *argv[]) 9 | { 10 | struct zip *za; 11 | 12 | if (argc != 2) { 13 | fprintf(stderr, "%s: call with one option: zip-file. First file" 14 | " in zip-file will be deleted\n", argv[0]); 15 | return 1; 16 | } 17 | 18 | if ((za=zip_open(argv[1], ZIP_CHECKCONS))==NULL) { 19 | fprintf(stderr, "%s: can't open '%s': %s\n", argv[0], argv[1], 20 | zip_err_str[zip_err]); 21 | return 1; 22 | } 23 | 24 | if (zip_delete(za, 0)< 0) { 25 | fprintf(stderr, "%s: can't delete first file in '%s': %s", 26 | argv[0], argv[1], zip_err_str[zip_err]); 27 | return 1; 28 | } 29 | 30 | if (zip_close(za)!=0) { 31 | fprintf(stderr, "%s: can't close file '%s': %s", argv[0], argv[1], 32 | zip_err_str[zip_err]); 33 | return 1; 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /libzip-0.7.1/README: -------------------------------------------------------------------------------- 1 | This is libzip, a C library for reading, creating, and modifying zip 2 | archives. Files can be added from data buffers, files, or compressed 3 | data copied directly from other zip archives. Changes made without 4 | closing the archive can be reverted. The API is documented by man 5 | pages. 6 | 7 | For more information, take a look at the included man pages. You 8 | can start with libzip(3), which lists all others. Example source code 9 | is in the src/ subdirectory. 10 | 11 | For generic installation instructions, see file `INSTALL'. 12 | Additionally, you'll need zlib (at least version 1.1.2). It comes 13 | with most operating systems nowadays, or you can get it at 14 | http://www.gzip.org/zlib/ 15 | 16 | If you make a binary distribution, please include a pointer to the 17 | distribution site: 18 | http://www.nih.at/libzip/ 19 | ftp.nih.at /pub/nih/libzip 20 | The latest version can always be found there. 21 | 22 | Mail suggestions and bug reports to . 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # About 3 | 4 | Convert filenames inside ZIP archives from autodetected older Russian encodings 5 | (koi8-r, koi8-u, cp866, windows-1251) to UTF-8. 6 | 7 | This tool does not touch the file contents, it just renames the files inside 8 | a ZIP archive. 9 | 10 | # Build and Install 11 | 12 | test -f configure || autoreconf -iv 13 | ./configure 14 | make install 15 | 16 | [![Build Status](https://travis-ci.org/vlm/zip-fix-filename-encoding.svg?branch=master)](https://travis-ci.org/vlm/zip-fix-filename-encoding) 17 | 18 | # Usage 19 | 20 | Usage: runzip [OPTIONS] ... 21 | Where OPTIONS are: 22 | -h Display this help screen 23 | -n Dry run. Do not modify the 24 | -v Verbose output 25 | -s Set source encoding. Auto-detect, if not set 26 | -t Set target encoding. Default is UTF-8 27 | -w Make archive readable on Windows (reverse operation) 28 | NOTE: -w implies -t cp866 (Yes! MS-DOS!) 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2015 Lev Walkin 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 | SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libzip.la 2 | noinst_HEADERS = zipint.h zip.h 3 | 4 | libzip_la_LDFLAGS=-version-info 1:0 5 | libzip_la_LIBADD=@LIBOBJS@ 6 | 7 | libzip_la_SOURCES=\ 8 | zip_add.c \ 9 | zip_close.c \ 10 | zip_delete.c \ 11 | zip_dirent.c \ 12 | zip_entry_free.c \ 13 | zip_entry_new.c \ 14 | zip_err_str.c \ 15 | zip_error.c \ 16 | zip_error_get.c \ 17 | zip_error_get_sys_type.c \ 18 | zip_error_strerror.c \ 19 | zip_error_to_str.c \ 20 | zip_fclose.c \ 21 | zip_file_error_get.c \ 22 | zip_file_get_offset.c \ 23 | zip_file_strerror.c \ 24 | zip_fopen.c \ 25 | zip_fopen_index.c \ 26 | zip_fread.c \ 27 | zip_free.c \ 28 | zip_get_archive_comment.c \ 29 | zip_get_file_comment.c \ 30 | zip_get_num_files.c \ 31 | zip_get_name.c \ 32 | zip_memdup.c \ 33 | zip_name_locate.c \ 34 | zip_new.c \ 35 | zip_open.c \ 36 | zip_rename.c \ 37 | zip_replace.c \ 38 | zip_set_archive_comment.c \ 39 | zip_set_file_comment.c \ 40 | zip_source_buffer.c \ 41 | zip_source_file.c \ 42 | zip_source_filep.c \ 43 | zip_source_free.c \ 44 | zip_source_function.c \ 45 | zip_source_zip.c \ 46 | zip_set_name.c \ 47 | zip_stat.c \ 48 | zip_stat_index.c \ 49 | zip_strerror.c \ 50 | zip_unchange.c \ 51 | zip_unchange_all.c \ 52 | zip_unchange_archive.c \ 53 | zip_unchange_data.c 54 | 55 | BUILT_SOURCES=zip_err_str.c 56 | 57 | EXTRA_DIST=make_zip_err_str.sh 58 | 59 | zip_err_str.c: zip.h make_zip_err_str.sh 60 | sh $(srcdir)/make_zip_err_str.sh $(srcdir)/zip.h zip_err_str.c 61 | -------------------------------------------------------------------------------- /libzip-0.7.1/configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.57) 2 | AC_INIT([libzip],[0.7.1],[nih@giga.or.at]) 3 | AC_CONFIG_SRCDIR([lib/zip_add.c]) 4 | AC_CONFIG_HEADERS([config.h]) 5 | AM_INIT_AUTOMAKE 6 | 7 | dnl AC_CANONICAL_HOST 8 | 9 | AC_PROG_CC 10 | 11 | AC_ARG_WITH(zlib, 12 | [ --with-zlib=PREFIX specify prefix for ZLIB library],, 13 | with_zlib=yes) 14 | 15 | if test "$with_zlib" != "yes" 16 | then 17 | if test -f "$with_zlib"/zlib.h 18 | then 19 | # PREFIX is to uninstalled version in distribution directory 20 | CFLAGS="$CFLAGS -I$with_zlib" 21 | LDFLAGS="$LDFLAGS -L$with_zlib" 22 | else if test -f "$with_zlib"/include/zlib.h 23 | then 24 | # PREFIX is installation prefix 25 | CFLAGS="$CFLAGS -I$with_zlib/include" 26 | LDFLAGS="$LDFLAGS -L$with_zlib/lib" 27 | fi 28 | fi 29 | fi 30 | 31 | AC_CHECK_LIB(z, main) 32 | AC_CACHE_CHECK(new ZLIB version, id_cv_lib_zlib_ok, 33 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[extern ZEXPORT unzOpen (const char *path);]])],[id_cv_lib_zlib_ok=yes],[id_cv_lib_zlib_ok=no])) 34 | if test "$id_cv_lib_zlib_ok" = "no" 35 | then 36 | AC_MSG_ERROR([ZLIB version too old, please install at least v1.1.2]) 37 | fi 38 | 39 | AC_EXEEXT 40 | 41 | AM_PROG_LIBTOOL 42 | 43 | AC_CHECK_FUNCS([fseeko]) 44 | AC_CHECK_FUNCS([mkstemp], [], [AC_LIBOBJ(mkstemp)]) 45 | 46 | AC_CHECK_HEADERS([unistd.h]) 47 | 48 | case $host_os 49 | in 50 | *bsd*) MANFMT=mdoc;; 51 | *) MANFMT=man;; 52 | esac 53 | AC_SUBST([MANFMT]) 54 | 55 | AC_CONFIG_FILES([Makefile lib/Makefile]) 56 | AC_OUTPUT 57 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_err_str.c: -------------------------------------------------------------------------------- 1 | /* 2 | This file was generated automatically by ./make_zip_err_str.sh 3 | from ./zip.h; make changes there. 4 | 5 | NiH: make_zip_err_str.sh,v 1.8 2004/11/17 21:55:09 wiz Exp 6 | NiH: zip.h,v 1.57 2006/04/24 14:04:19 dillo Exp 7 | */ 8 | 9 | #include "zip.h" 10 | #include "zipint.h" 11 | 12 | 13 | 14 | const char * const _zip_err_str[] = { 15 | "No error", 16 | "Multi-disk zip archives not supported", 17 | "Renaming temporary file failed", 18 | "Closing zip archive failed", 19 | "Seek error", 20 | "Read error", 21 | "Write error", 22 | "CRC error", 23 | "Containing zip archive was closed", 24 | "No such file", 25 | "File already exists", 26 | "Can't open file", 27 | "Failure to create temporary file", 28 | "Zlib error", 29 | "Malloc failure", 30 | "Entry has been changed", 31 | "Compression method not supported", 32 | "Premature EOF", 33 | "Invalid argument", 34 | "Not a zip archive", 35 | "Internal error", 36 | "Zip archive inconsistent", 37 | "Can't remove file", 38 | "Entry has been deleted", 39 | }; 40 | 41 | const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]); 42 | 43 | #define N ZIP_ET_NONE 44 | #define S ZIP_ET_SYS 45 | #define Z ZIP_ET_ZLIB 46 | 47 | const int _zip_err_type[] = { 48 | N, 49 | N, 50 | S, 51 | S, 52 | S, 53 | S, 54 | S, 55 | N, 56 | N, 57 | N, 58 | N, 59 | S, 60 | S, 61 | Z, 62 | N, 63 | N, 64 | N, 65 | N, 66 | N, 67 | N, 68 | N, 69 | N, 70 | S, 71 | N, 72 | }; 73 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_PROGRAMS= \ 2 | add_from_buffer \ 3 | add_from_file \ 4 | add_from_filep \ 5 | encrypt \ 6 | fread \ 7 | get_comment \ 8 | open \ 9 | name_locate \ 10 | set_comment_all \ 11 | set_comment_localonly \ 12 | set_comment_removeglobal \ 13 | set_comment_revert 14 | 15 | EXTRA_PROGRAMS=deltest ziptest 16 | 17 | EXTRA_DIST= \ 18 | runtest \ 19 | ${TESTCASES} \ 20 | testbuffer.zip \ 21 | testchanged.zip testchangedlocal.zip \ 22 | testcomment.zip testcommentremoved.zip \ 23 | testfile.txt testfile.zip \ 24 | broken.zip test.zip encrypt.zip 25 | 26 | TESTS_ENVIRONMENT= ZIPCMP=../src/zipcmp 27 | 28 | TESTCASES= \ 29 | add_from_buffer.test \ 30 | add_from_file.test \ 31 | add_from_filep.test \ 32 | encrypt.test \ 33 | fread.test \ 34 | get_comment.test \ 35 | name_locate.test \ 36 | open.test \ 37 | set_comment_all.test \ 38 | set_comment_localonly.test \ 39 | set_comment_removeglobal.test \ 40 | set_comment_revert.test 41 | 42 | check: 43 | @failed=0; all=0; \ 44 | srcdir=$(srcdir); export srcdir; \ 45 | for tst in ${TESTCASES}; do \ 46 | t=`basename $$tst .test`; \ 47 | if ${TESTS_ENVIRONMENT} $(srcdir)/runtest $$t; then \ 48 | all=`expr $$all + 1`; \ 49 | echo "PASS: $$tst"; \ 50 | elif test $$? -ne 77; then \ 51 | all=`expr $$all + 1`; \ 52 | failed=`expr $$failed + 1`; \ 53 | echo "FAIL: $$tst"; \ 54 | fi; \ 55 | done; \ 56 | if test "$$failed" -eq 0; then \ 57 | banner="All $$all tests passed"; \ 58 | else \ 59 | banner="$$failed of $$all tests failed"; \ 60 | fi; \ 61 | dashes=`echo "$$banner" | sed s/./=/g`; \ 62 | echo "$$dashes"; \ 63 | echo "$$banner"; \ 64 | echo "$$dashes"; \ 65 | test "$$failed" -eq 0 66 | 67 | AM_CPPFLAGS=-I${top_srcdir}/lib 68 | LDADD=../lib/libzip.la 69 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_error_get.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_error_get.c,v 1.1 2004/11/18 15:06:20 wiz Exp $ 3 | 4 | zip_error_get.c -- get zip error 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | void 44 | zip_error_get(struct zip *za, int *zep, int *sep) 45 | { 46 | _zip_error_get(&za->error, zep, sep); 47 | } 48 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_strerror.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_strerror.c,v 1.1 2003/10/05 16:05:22 dillo Exp $ 3 | 4 | zip_sterror.c -- get string representation of zip error 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | const char * 44 | zip_strerror(struct zip *za) 45 | { 46 | return _zip_error_strerror(&za->error); 47 | } 48 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_file_error_get.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_file_error_get.c,v 1.1 2004/11/18 15:06:21 wiz Exp $ 3 | 4 | zip_file_error_get.c -- get zip file error 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | void 44 | zip_file_error_get(struct zip_file *zf, int *zep, int *sep) 45 | { 46 | _zip_error_get(&zf->error, zep, sep); 47 | } 48 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_file_strerror.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_file_strerror.c,v 1.1 2003/10/05 16:05:22 dillo Exp $ 3 | 4 | zip_file_sterror.c -- get string representation of zip file error 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | const char * 44 | zip_file_strerror(struct zip_file *zf) 45 | { 46 | return _zip_error_strerror(&zf->error); 47 | } 48 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_get_num_files.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_get_num_files.c,v 1.2 2003/12/27 22:53:15 wiz Exp $ 3 | 4 | zip_get_num_files.c -- get number of files in archive 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_get_num_files(struct zip *za) 45 | { 46 | if (za == NULL) 47 | return -1; 48 | 49 | return za->nentry; 50 | } 51 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_error_get_sys_type.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_error_get_sys_type.c,v 1.1 2004/12/22 15:49:18 wiz Exp $ 3 | 4 | zip_error_get_sys_type.c -- return type of system error code 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_error_get_sys_type(int ze) 45 | { 46 | if (ze < 0 || ze >= _zip_nerr_str) 47 | return 0; 48 | 49 | return _zip_err_type[ze]; 50 | } 51 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_unchange_archive.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_unchange_archive.c,v 1.1 2006/04/23 13:14:46 wiz Exp $ 3 | 4 | zip_unchange_archive.c -- undo global changes to ZIP archive 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include "zip.h" 40 | #include "zipint.h" 41 | 42 | 43 | 44 | int 45 | zip_unchange_archive(struct zip *za) 46 | { 47 | free(za->ch_comment); 48 | za->ch_comment = NULL; 49 | za->ch_comment_len = -1; 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_source_free.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_source_free.c,v 1.2 2004/12/22 16:32:00 dillo Exp $ 3 | 4 | zip_source_free.c -- free zip data source 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | void 46 | zip_source_free(struct zip_source *source) 47 | { 48 | if (source == NULL) 49 | return; 50 | 51 | (void)source->f(source->ud, NULL, 0, ZIP_SOURCE_FREE); 52 | 53 | free(source); 54 | } 55 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_rename.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_rename.c,v 1.15 2004/11/30 22:19:38 wiz Exp $ 3 | 4 | zip_rename.c -- rename file in zip archive 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_rename(struct zip *za, int idx, const char *name) 45 | { 46 | if (idx >= za->nentry || idx < 0) { 47 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 48 | return -1; 49 | } 50 | 51 | return _zip_set_name(za, idx, name); 52 | } 53 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_stat.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_stat.c,v 1.3 2004/04/16 09:40:30 dillo Exp $ 3 | 4 | zip_stat.c -- get information about file by name 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_stat(struct zip *za, const char *fname, int flags, struct zip_stat *st) 45 | { 46 | int idx; 47 | 48 | if ((idx=zip_name_locate(za, fname, flags)) < 0) 49 | return -1; 50 | 51 | return zip_stat_index(za, idx, flags, st); 52 | } 53 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_fopen.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_fopen.c,v 1.12 2005/06/09 19:57:09 dillo Exp $ 3 | 4 | zip_fopen.c -- open file in zip archive for reading 5 | Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | struct zip_file * 44 | zip_fopen(struct zip *za, const char *fname, int flags) 45 | { 46 | int idx; 47 | 48 | if ((idx=zip_name_locate(za, fname, flags)) < 0) 49 | return NULL; 50 | 51 | return zip_fopen_index(za, idx, flags); 52 | } 53 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_add.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_add.c,v 1.14 2004/11/18 15:04:04 wiz Exp $ 3 | 4 | zip_add.c -- add file via callback function 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_add(struct zip *za, const char *name, struct zip_source *source) 45 | { 46 | if (name == NULL || source == NULL) { 47 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 48 | return -1; 49 | } 50 | 51 | return _zip_replace(za, -1, name, source); 52 | } 53 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_unchange_all.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_unchange_all.c,v 1.10 2006/04/23 13:14:46 wiz Exp $ 3 | 4 | zip_unchange.c -- undo changes to all files in zip archive 5 | Copyright (C) 1999, 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include "zip.h" 40 | #include "zipint.h" 41 | 42 | 43 | 44 | int 45 | zip_unchange_all(struct zip *za) 46 | { 47 | int ret, i; 48 | 49 | ret = 0; 50 | for (i=0; inentry; i++) 51 | ret |= _zip_unchange(za, i, 1); 52 | 53 | ret |= zip_unchange_archive(za); 54 | 55 | return ret; 56 | } 57 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_entry_free.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_entry_free.c,v 1.2 2006/04/09 19:05:47 wiz Exp $ 3 | 4 | zip_entry_free.c -- free struct zip_entry 5 | Copyright (C) 1999, 2003, 2004, 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | void 46 | _zip_entry_free(struct zip_entry *ze) 47 | { 48 | free(ze->ch_filename); 49 | ze->ch_filename = NULL; 50 | free(ze->ch_comment); 51 | ze->ch_comment = NULL; 52 | ze->ch_comment_len = -1; 53 | 54 | _zip_unchange_data(ze); 55 | } 56 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_unchange_data.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_unchange_data.c,v 1.15 2004/12/22 16:32:00 dillo Exp $ 3 | 4 | zip_unchange_data.c -- undo helper function 5 | Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zipint.h" 41 | 42 | void 43 | _zip_unchange_data(struct zip_entry *ze) 44 | { 45 | if (ze->source) { 46 | (void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE); 47 | free(ze->source); 48 | ze->source = NULL; 49 | } 50 | 51 | ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_memdup.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_memdup.c,v 1.2 2006/04/24 10:34:39 dillo Exp $ 3 | 4 | zip_memdup.c -- internal zip function, "strdup" with len 5 | Copyright (C) 1999, 2003, 2004, 2005, 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include 37 | #include 38 | 39 | #include "zip.h" 40 | #include "zipint.h" 41 | 42 | 43 | 44 | void * 45 | _zip_memdup(const void *mem, size_t len, struct zip_error *error) 46 | { 47 | void *ret; 48 | 49 | ret = malloc(len); 50 | if (!ret) { 51 | _zip_error_set(error, ZIP_ER_MEMORY, 0); 52 | return NULL; 53 | } 54 | 55 | memcpy(ret, mem, len); 56 | 57 | return ret; 58 | } 59 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_get_archive_comment.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_get_archive_comment.c,v 1.4 2006/04/23 16:11:33 wiz Exp $ 3 | 4 | zip_get_archive_comment.c -- get archive comment 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | const char * 44 | zip_get_archive_comment(struct zip *za, int *lenp, int flags) 45 | { 46 | if ((flags & ZIP_FL_UNCHANGED) 47 | || (za->ch_comment_len == -1)) { 48 | if (lenp != NULL) 49 | *lenp = za->cdir->comment_len; 50 | return za->cdir->comment; 51 | } 52 | 53 | if (lenp != NULL) 54 | *lenp = za->ch_comment_len; 55 | return za->ch_comment; 56 | } 57 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_delete.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_delete.c,v 1.17 2005/06/09 19:57:09 dillo Exp $ 3 | 4 | zip_delete.c -- delete file from zip archive 5 | Copyright (C) 1999, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_delete(struct zip *za, int idx) 45 | { 46 | if (idx < 0 || idx >= za->nentry) { 47 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 48 | return -1; 49 | } 50 | 51 | /* allow duplicate file names, because the file will 52 | * be removed directly afterwards */ 53 | if (_zip_unchange(za, idx, 1) != 0) 54 | return -1; 55 | 56 | za->entry[idx].state = ZIP_ST_DELETED; 57 | 58 | return 0; 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_source_function.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_source_function.c,v 1.4 2006/02/21 09:41:00 dillo Exp $ 3 | 4 | zip_source_function.c -- create zip data source from callback function 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | struct zip_source * 46 | zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) 47 | { 48 | struct zip_source *zs; 49 | 50 | if (za == NULL) 51 | return NULL; 52 | 53 | if ((zs=(struct zip_source *)malloc(sizeof(*zs))) == NULL) { 54 | _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); 55 | return NULL; 56 | } 57 | 58 | zs->f = zcb; 59 | zs->ud = ud; 60 | 61 | return zs; 62 | } 63 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_get_file_comment.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_get_file_comment.c,v 1.2 2006/04/23 13:06:28 wiz Exp $ 3 | 4 | zip_get_file_comment.c -- get file comment 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | const char * 44 | zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags) 45 | { 46 | if (idx < 0 || idx >= za->nentry) { 47 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 48 | return NULL; 49 | } 50 | 51 | if ((flags & ZIP_FL_UNCHANGED) 52 | || (za->entry[idx].ch_comment_len == -1)) { 53 | if (lenp != NULL) 54 | *lenp = za->cdir->entry[idx].comment_len; 55 | return za->cdir->entry[idx].comment; 56 | } 57 | 58 | if (lenp != NULL) 59 | *lenp = za->entry[idx].ch_comment_len; 60 | return za->entry[idx].ch_comment; 61 | } 62 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_set_archive_comment.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_set_archive_comment.c,v 1.3 2006/04/24 10:34:39 dillo Exp $ 3 | 4 | zip_set_archive_comment.c -- set archive comment 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | int 46 | zip_set_archive_comment(struct zip *za, const char *comment, int len) 47 | { 48 | char *tmpcom; 49 | 50 | if (len < 0 || len > MAXCOMLEN 51 | || (len > 0 && comment == NULL)) { 52 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 53 | return -1; 54 | } 55 | 56 | if (len > 0) { 57 | if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) 58 | return -1; 59 | } 60 | else 61 | tmpcom = NULL; 62 | 63 | free(za->ch_comment); 64 | za->ch_comment = tmpcom; 65 | za->ch_comment_len = len; 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_fclose.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_fclose.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_fclose.mdoc -- close file in zip archive 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd October 3, 2003 35 | .Dt ZIP_FCLOSE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_fclose 39 | .Nd close file in zip archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_fclose "struct zip_file *file" 46 | .Sh DESCRIPTION 47 | The 48 | .Fn zip_fclose 49 | function closes 50 | .Ar file 51 | and frees the memory allocated for it. 52 | .Sh RETURN VALUES 53 | Upon successful completion 0 is returned. 54 | Otherwise, the error code is returned. 55 | .Sh SEE ALSO 56 | .Xr libzip 3 , 57 | .Xr zip_fopen 3 , 58 | .Xr zip_fread 3 59 | .Sh AUTHORS 60 | .An -nosplit 61 | .An Dieter Baron Aq dillo@giga.or.at 62 | and 63 | .An Thomas Klausner Aq tk@giga.or.at 64 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_fread.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_fread.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_fread.mdoc -- read from file 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd October 3, 2003 35 | .Dt ZIP_FREAD 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_fread 39 | .Nd read from file 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_fread "struct zip_file *file" "void *buf" "int nbytes" 46 | .Sh DESCRIPTION 47 | The 48 | .Fn zip_fread 49 | function reads at most 50 | .Ar nbytes 51 | bytes from 52 | .Ar file 53 | into 54 | .Ar buf . 55 | .Sh RETURN VALUES 56 | If successful, the number of bytes actually read is returned. 57 | Otherwise, \-1 is returned. 58 | .Sh SEE ALSO 59 | .Xr libzip 3 , 60 | .Xr zip_fclose 3 , 61 | .Xr zip_fopen 3 62 | .Sh AUTHORS 63 | .An -nosplit 64 | .An Dieter Baron Aq dillo@giga.or.at 65 | and 66 | .An Thomas Klausner Aq tk@giga.or.at 67 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_source_file.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_source_file.c,v 1.2 2004/11/18 16:28:13 wiz Exp $ 3 | 4 | zip_source_file.c -- create data source from file 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | 41 | #include "zip.h" 42 | #include "zipint.h" 43 | 44 | 45 | 46 | struct zip_source * 47 | zip_source_file(struct zip *za, const char *fname, off_t start, off_t len) 48 | { 49 | struct zip_source *zs; 50 | FILE *fp; 51 | 52 | if (za == NULL) 53 | return NULL; 54 | 55 | if (fname == NULL || start < 0 || len < -1) { 56 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 57 | return NULL; 58 | } 59 | 60 | if ((fp=fopen(fname, "rb")) == NULL) { 61 | _zip_error_set(&za->error, ZIP_ER_OPEN, errno); 62 | return NULL; 63 | } 64 | 65 | if ((zs=zip_source_filep(za, fp, start, len)) == NULL) { 66 | fclose(fp); 67 | return NULL; 68 | } 69 | 70 | return zs; 71 | } 72 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_set_file_comment.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_set_file_comment.c,v 1.4 2006/04/24 10:34:39 dillo Exp $ 3 | 4 | zip_set_file_comment.c -- set comment for file in archive 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | int 46 | zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) 47 | { 48 | char *tmpcom; 49 | 50 | if (idx < 0 || idx >= za->nentry 51 | || len < 0 || len > MAXCOMLEN 52 | || (len > 0 && comment == NULL)) { 53 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 54 | return -1; 55 | } 56 | 57 | if (len > 0) { 58 | if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) 59 | return -1; 60 | } 61 | else 62 | tmpcom = NULL; 63 | 64 | free(za->entry[idx].ch_comment); 65 | za->entry[idx].ch_comment = tmpcom; 66 | za->entry[idx].ch_comment_len = len; 67 | 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_get_num_files.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_get_num_files.mdoc,v 1.5 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_get_num_files.mdoc -- get number of files in archive 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd December 27, 2003 35 | .Dt ZIP_GET_NUM_FILES 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_get_num_files 39 | .Nd get number of files in archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_get_num_files "struct zip *archive" 46 | .Sh DESCRIPTION 47 | The 48 | .Fn zip_get_num_files 49 | function returns the number of files in 50 | .Ar archive . 51 | .Sh RETURN VALUES 52 | .Fn zip_get_num_files 53 | returns the number of files in the zip archive, 54 | or \-1 if 55 | .Ar archive 56 | is 57 | .Dv NULL . 58 | .Sh SEE ALSO 59 | .Xr libzip 3 60 | .Sh AUTHORS 61 | .An -nosplit 62 | .An Dieter Baron Aq dillo@giga.or.at 63 | and 64 | .An Thomas Klausner Aq tk@giga.or.at 65 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_error_to_str.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_error_to_str.c,v 1.1 2004/11/18 15:06:20 wiz Exp $ 3 | 4 | zip_error_to_str.c -- get string representation of zip error code 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "zip.h" 44 | #include "zipint.h" 45 | 46 | 47 | 48 | int 49 | zip_error_to_str(char *buf, size_t len, int ze, int se) 50 | { 51 | const char *zs, *ss; 52 | 53 | if (ze < 0 || ze >= _zip_nerr_str) 54 | return snprintf(buf, len, "Unknown error %d", ze); 55 | 56 | zs = _zip_err_str[ze]; 57 | 58 | switch (_zip_err_type[ze]) { 59 | case ZIP_ET_SYS: 60 | ss = strerror(se); 61 | break; 62 | 63 | case ZIP_ET_ZLIB: 64 | ss = zError(se); 65 | break; 66 | 67 | default: 68 | ss = NULL; 69 | } 70 | 71 | return snprintf(buf, len, "%s%s%s", 72 | zs, (ss ? ": " : ""), (ss ? ss : "")); 73 | } 74 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_fclose.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_fclose.c,v 1.14 2005/06/09 19:57:09 dillo Exp $ 3 | 4 | zip_fclose.c -- close file in zip archive 5 | Copyright (C) 1999, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | int 46 | zip_fclose(struct zip_file *zf) 47 | { 48 | int i, ret; 49 | 50 | if (zf->zstr) 51 | inflateEnd(zf->zstr); 52 | free(zf->buffer); 53 | free(zf->zstr); 54 | 55 | for (i=0; iza->nfile; i++) { 56 | if (zf->za->file[i] == zf) { 57 | zf->za->file[i] = zf->za->file[zf->za->nfile-1]; 58 | zf->za->nfile--; 59 | break; 60 | } 61 | } 62 | 63 | ret = 0; 64 | if (zf->error.zip_err) 65 | ret = zf->error.zip_err; 66 | else if ((zf->flags & ZIP_ZF_CRC) && (zf->flags & ZIP_ZF_EOF)) { 67 | /* if EOF, compare CRC */ 68 | if (zf->crc_orig != zf->crc) 69 | ret = ZIP_ER_CRC; 70 | } 71 | 72 | free(zf); 73 | return ret; 74 | } 75 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_fclose.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_fclose.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp 3 | .\" $NiH: zip_fclose.man,v 1.8 2005/06/17 12:59:05 wiz Exp $ 4 | .\" 5 | .\" zip_fclose.mdoc \-- close file in zip archive 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_FCLOSE 3 "October 3, 2003" NiH 37 | .SH "NAME" 38 | zip_fclose \- close file in zip archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_fclose "struct zip_file *file" 45 | .SH "DESCRIPTION" 46 | The 47 | .Fn zip_fclose 48 | function closes 49 | \fBfile\fR 50 | and frees the memory allocated for it. 51 | .SH "RETURN VALUES" 52 | Upon successful completion 0 is returned. 53 | Otherwise, the error code is returned. 54 | .SH "SEE ALSO" 55 | libzip(3), 56 | zip_fopen(3), 57 | zip_fread(3) 58 | .SH "AUTHORS" 59 | 60 | Dieter Baron 61 | and 62 | Thomas Klausner 63 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_new.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_new.c,v 1.12 2006/04/23 00:40:47 wiz Exp $ 3 | 4 | zip_new.c -- create and init struct zip 5 | Copyright (C) 1999, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include "zip.h" 40 | #include "zipint.h" 41 | 42 | 43 | 44 | /* _zip_new: 45 | creates a new zipfile struct, and sets the contents to zero; returns 46 | the new struct. */ 47 | 48 | struct zip * 49 | _zip_new(struct zip_error *error) 50 | { 51 | struct zip *za; 52 | 53 | za = (struct zip *)malloc(sizeof(struct zip)); 54 | if (!za) { 55 | _zip_error_set(error, ZIP_ER_MEMORY, 0); 56 | return NULL; 57 | } 58 | 59 | za->zn = NULL; 60 | za->zp = NULL; 61 | _zip_error_init(&za->error); 62 | za->cdir = NULL; 63 | za->ch_comment = NULL; 64 | za->ch_comment_len = -1; 65 | za->nentry = za->nentry_alloc = 0; 66 | za->entry = NULL; 67 | za->nfile = za->nfile_alloc = 0; 68 | za->file = NULL; 69 | 70 | return za; 71 | } 72 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_fread.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_fread.mdoc,v 1.9 2005/06/09 21:14:54 wiz Exp 3 | .\" $NiH: zip_fread.man,v 1.7 2005/06/17 12:59:05 wiz Exp $ 4 | .\" 5 | .\" zip_fread.mdoc \-- read from file 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_FREAD 3 "October 3, 2003" NiH 37 | .SH "NAME" 38 | zip_fread \- read from file 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_fread "struct zip_file *file" "void *buf" "int nbytes" 45 | .SH "DESCRIPTION" 46 | The 47 | .Fn zip_fread 48 | function reads at most 49 | \fBnbytes\fR 50 | bytes from 51 | \fBfile\fR 52 | into 53 | \fBbuf.\fR 54 | .SH "RETURN VALUES" 55 | If successful, the number of bytes actually read is returned. 56 | Otherwise, \-1 is returned. 57 | .SH "SEE ALSO" 58 | libzip(3), 59 | zip_fclose(3), 60 | zip_fopen(3) 61 | .SH "AUTHORS" 62 | 63 | Dieter Baron 64 | and 65 | Thomas Klausner 66 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_unchange_all.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_unchange_all.mdoc,v 1.11 2006/04/23 13:14:46 wiz Exp $ 2 | .\" 3 | .\" zip_unchange_all.mdoc -- undo changes to all files in zip archive 4 | .\" Copyright (C) 2003, 2005, 2006 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_UNCHANGE_ALL 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_unchange_all 39 | .Nd undo all changes in a zip archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_unchange_all "struct zip *archive" 46 | .Sh DESCRIPTION 47 | All changes to files and global information in 48 | .Ar archive 49 | are reverted. 50 | .Sh RETURN VALUES 51 | Upon successful completion 0 is returned. 52 | Otherwise, \-1 is returned and the error code in 53 | .Ar archive 54 | is set to indicate the error. 55 | .Sh SEE ALSO 56 | .Xr libzip 3 , 57 | .Xr zip_unchange 3 , 58 | .Xr zip_unchange_archive 3 59 | .Sh AUTHORS 60 | .An -nosplit 61 | .An Dieter Baron Aq dillo@giga.or.at 62 | and 63 | .An Thomas Klausner Aq tk@giga.or.at 64 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_get_num_files.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_get_num_files.mdoc,v 1.5 2005/06/09 21:14:54 wiz Exp 3 | .\" $NiH: zip_get_num_files.man,v 1.5 2005/06/17 12:59:05 wiz Exp $ 4 | .\" 5 | .\" zip_get_num_files.mdoc \-- get number of files in archive 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_GET_NUM_FILES 3 "December 27, 2003" NiH 37 | .SH "NAME" 38 | zip_get_num_files \- get number of files in archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_get_num_files "struct zip *archive" 45 | .SH "DESCRIPTION" 46 | The 47 | .Fn zip_get_num_files 48 | function returns the number of files in 49 | \fBarchive.\fR 50 | .SH "RETURN VALUES" 51 | .Fn zip_get_num_files 52 | returns the number of files in the zip archive, 53 | or \-1 if 54 | \fBarchive\fR 55 | is 56 | \fBNULL.\fR 57 | .SH "SEE ALSO" 58 | libzip(3) 59 | .SH "AUTHORS" 60 | 61 | Dieter Baron 62 | and 63 | Thomas Klausner 64 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_free.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_free.c,v 1.17 2005/06/09 19:57:10 dillo Exp $ 3 | 4 | zip_free.c -- free struct zip 5 | Copyright (C) 1999, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include "zip.h" 40 | #include "zipint.h" 41 | 42 | 43 | 44 | /* _zip_free: 45 | frees the space allocated to a zipfile struct, and closes the 46 | corresponding file. */ 47 | 48 | void 49 | _zip_free(struct zip *za) 50 | { 51 | int i; 52 | 53 | if (za == NULL) 54 | return; 55 | 56 | if (za->zn) 57 | free(za->zn); 58 | 59 | if (za->zp) 60 | fclose(za->zp); 61 | 62 | _zip_cdir_free(za->cdir); 63 | 64 | if (za->entry) { 65 | for (i=0; inentry; i++) { 66 | _zip_entry_free(za->entry+i); 67 | } 68 | free(za->entry); 69 | } 70 | 71 | for (i=0; infile; i++) { 72 | if (za->file[i]->error.zip_err == ZIP_ER_OK) { 73 | _zip_error_set(&za->file[i]->error, ZIP_ER_ZIPCLOSED, 0); 74 | za->file[i]->za = NULL; 75 | } 76 | } 77 | 78 | free(za->file); 79 | 80 | free(za); 81 | 82 | return; 83 | } 84 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_unchange_archive.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_unchange_archive.mdoc,v 1.1 2006/04/23 13:14:46 wiz Exp $ 2 | .\" 3 | .\" zip_unchange_archive.mdoc -- undo changes to all files in zip archive 4 | .\" Copyright (C) 2006 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_UNCHANGE_ARCHIVE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_unchange_archive 39 | .Nd undo global changes to zip archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_unchange_archive "struct zip *archive" 46 | .Sh DESCRIPTION 47 | Revert all global changes to the archive 48 | .Ar archive . 49 | For now, this only reverts archive comment changes. 50 | .Sh RETURN VALUES 51 | Upon successful completion 0 is returned. 52 | Otherwise, \-1 is returned and the error code in 53 | .Ar archive 54 | is set to indicate the error. 55 | .Sh SEE ALSO 56 | .Xr libzip 3 , 57 | .Xr zip_unchange 3 , 58 | .Xr zip_unchange_all 3 59 | .Sh AUTHORS 60 | .An -nosplit 61 | .An Dieter Baron Aq dillo@giga.or.at 62 | and 63 | .An Thomas Klausner Aq tk@giga.or.at 64 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_unchange_all.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_unchange_all.mdoc,v 1.11 2006/04/23 13:14:46 wiz Exp 3 | .\" $NiH: zip_unchange_all.man,v 1.10 2006/04/23 13:30:30 wiz Exp $ 4 | .\" 5 | .\" zip_unchange_all.mdoc \-- undo changes to all files in zip archive 6 | .\" Copyright (C) 2003, 2005, 2006 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_UNCHANGE_ALL 3 "April 23, 2006" NiH 37 | .SH "NAME" 38 | zip_unchange_all \- undo all changes in a zip archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_unchange_all "struct zip *archive" 45 | .SH "DESCRIPTION" 46 | All changes to files and global information in 47 | \fBarchive\fR 48 | are reverted. 49 | .SH "RETURN VALUES" 50 | Upon successful completion 0 is returned. 51 | Otherwise, \-1 is returned and the error code in 52 | \fBarchive\fR 53 | is set to indicate the error. 54 | .SH "SEE ALSO" 55 | libzip(3), 56 | zip_unchange(3), 57 | zip_unchange_archive(3) 58 | .SH "AUTHORS" 59 | 60 | Dieter Baron 61 | and 62 | Thomas Klausner 63 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/ziptest.c: -------------------------------------------------------------------------------- 1 | #include "zip.h" 2 | #include "error.h" 3 | 4 | 5 | int 6 | main(int argc, char *argv[]) 7 | { 8 | #if 0 9 | int i; 10 | #endif 11 | struct zip *za, *destza; 12 | #if 0 13 | #define BUFSIZE 65536 14 | struct zip_file *zf1, *zf2; 15 | char buf1[BUFSIZE], buf2[BUFSIZE]; 16 | #endif 17 | 18 | #if 0 19 | if (argc != 2) { 20 | fprintf(stderr, "%s: call with one option: the zip-file to destroy" 21 | "^H^H^H^H^H^H^Htest\n", argv[0]); 22 | return 1; 23 | } 24 | #endif 25 | if (argc != 3) { 26 | fprintf(stderr, "%s: call with two options: src dest\n", argv[0]); 27 | return 1; 28 | } 29 | 30 | if ((za=zip_open(argv[1], ZIP_CHECKCONS))==NULL) { 31 | fprintf(stderr, "%s: %s: can't open file: %s\n", argv[0], argv[1], 32 | zip_err_str[zip_err]); 33 | return 1; 34 | } 35 | 36 | if ((destza=zip_open(argv[2], ZIP_CREATE))==NULL) { 37 | fprintf(stderr, "%s: %s: can't open file: %s\n", argv[0], argv[2], 38 | zip_err_str[zip_err]); 39 | return 1; 40 | } 41 | 42 | #if 0 43 | for (i=0; inentry; i++) { 44 | printf("%8d %s\n", za->entry[i].uncomp_size, za->entry[i].fn); 45 | zip_add_zip(destza, za->entry[i].fn, za, i, 0, 0); 46 | } 47 | #endif 48 | 49 | if (zip_add_zip(destza, NULL, NULL, za, 0, 0, 0) == -1) 50 | fprintf(stderr, "%s: %s: can't add file to zip '%s': %s\n", argv[0], 51 | za->entry[0].fn, argv[1], zip_err_str[zip_err]); 52 | 53 | #if 0 54 | zf1= zf_open_index(za, 1); 55 | if (!zf1) { 56 | fprintf(stderr, "boese, boese\n"); 57 | exit(100); 58 | } 59 | 60 | i = zf_read(zf1, buf1, 100); 61 | if (i < 0) 62 | fprintf(stderr, "read error: %s\n", zip_err_str[zf1->flags]); 63 | else { 64 | buf1[i] = 0; 65 | printf("read %d bytes: '%s'\n", i, buf1); 66 | } 67 | zf2 = zf_open_index(za, 1); 68 | i = zf_read(zf2, buf2, 200); 69 | if (i < 0) 70 | fprintf(stderr, "read error: %s\n", zip_err_str[zf2->flags]); 71 | else { 72 | buf2[i] = 0; 73 | printf("read %d bytes: '%s'\n", i, buf2); 74 | } 75 | i = zf_read(zf1, buf1, 100); 76 | if (i < 0) 77 | fprintf(stderr, "read error: %s\n", zip_err_str[zf1->flags]); 78 | else { 79 | buf1[i] = 0; 80 | printf("read %d bytes: '%s'\n", i, buf1); 81 | } 82 | zf_close(zf1); 83 | zf_close(zf2); 84 | #endif 85 | 86 | if (zip_close(destza)!=0) { 87 | fprintf(stderr, "%s: %s: can't close file: %s\n", argv[0], argv[2], 88 | zip_err_str[zip_err]); 89 | return 1; 90 | } 91 | 92 | if (zip_close(za)!=0) { 93 | fprintf(stderr, "%s: %s: can't close file: %s\n", argv[0], argv[1], 94 | zip_err_str[zip_err]); 95 | return 1; 96 | } 97 | 98 | return 0; 99 | } 100 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_get_name.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_get_name.c,v 1.13 2005/01/20 21:00:54 dillo Exp $ 3 | 4 | zip_get_name.c -- get filename for a file in zip file 5 | Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | const char * 44 | zip_get_name(struct zip *za, int idx, int flags) 45 | { 46 | return _zip_get_name(za, idx, flags, &za->error); 47 | } 48 | 49 | 50 | 51 | const char * 52 | _zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error) 53 | { 54 | if (idx < 0 || idx >= za->nentry) { 55 | _zip_error_set(error, ZIP_ER_INVAL, 0); 56 | return NULL; 57 | } 58 | 59 | if ((flags & ZIP_FL_UNCHANGED) == 0) { 60 | if (za->entry[idx].state == ZIP_ST_DELETED) { 61 | _zip_error_set(error, ZIP_ER_DELETED, 0); 62 | return NULL; 63 | } 64 | if (za->entry[idx].ch_filename) 65 | return za->entry[idx].ch_filename; 66 | } 67 | 68 | if (za->cdir == NULL || idx >= za->cdir->nentry) { 69 | _zip_error_set(error, ZIP_ER_INVAL, 0); 70 | return NULL; 71 | } 72 | 73 | return za->cdir->entry[idx].filename; 74 | } 75 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_unchange_archive.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_unchange_archive.mdoc,v 1.1 2006/04/23 13:14:46 wiz Exp 3 | .\" $NiH: zip_unchange_archive.man,v 1.1 2006/04/23 13:30:41 wiz Exp $ 4 | .\" 5 | .\" zip_unchange_archive.mdoc \-- undo changes to all files in zip archive 6 | .\" Copyright (C) 2006 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_UNCHANGE_ARCHIVE 3 "April 23, 2006" NiH 37 | .SH "NAME" 38 | zip_unchange_archive \- undo global changes to zip archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_unchange_archive "struct zip *archive" 45 | .SH "DESCRIPTION" 46 | Revert all global changes to the archive 47 | \fBarchive.\fR 48 | For now, this only reverts archive comment changes. 49 | .SH "RETURN VALUES" 50 | Upon successful completion 0 is returned. 51 | Otherwise, \-1 is returned and the error code in 52 | \fBarchive\fR 53 | is set to indicate the error. 54 | .SH "SEE ALSO" 55 | libzip(3), 56 | zip_unchange(3), 57 | zip_unchange_all(3) 58 | .SH "AUTHORS" 59 | 60 | Dieter Baron 61 | and 62 | Thomas Klausner 63 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_set_name.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_set_name.c,v 1.16 2004/11/30 23:02:47 wiz Exp $ 3 | 4 | zip_set_name.c -- rename helper function 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | int 46 | _zip_set_name(struct zip *za, int idx, const char *name) 47 | { 48 | char *s; 49 | int i; 50 | 51 | if (idx < 0 || idx >= za->nentry || name == NULL) { 52 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 53 | return -1; 54 | } 55 | 56 | if ((i=_zip_name_locate(za, name, 0, NULL)) != -1 && i != idx) { 57 | _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); 58 | return -1; 59 | } 60 | 61 | /* no effective name change */ 62 | if (i == idx) 63 | return 0; 64 | 65 | if ((s=strdup(name)) == NULL) { 66 | _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); 67 | return -1; 68 | } 69 | 70 | if (za->entry[idx].state == ZIP_ST_UNCHANGED) 71 | za->entry[idx].state = ZIP_ST_RENAMED; 72 | 73 | free(za->entry[idx].ch_filename); 74 | za->entry[idx].ch_filename = s; 75 | 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_delete.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_delete.mdoc,v 1.11 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_delete.mdoc -- delete files from zip archive 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd October 3, 2003 35 | .Dt ZIP_DELETE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_delete 39 | .Nd delete file from zip archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_delete "struct zip *archive" "int index" 46 | .Sh DESCRIPTION 47 | The file at position 48 | .Ar index 49 | in the zip archive 50 | .Ar archive 51 | is marked as deleted. 52 | .Sh RETURN VALUES 53 | Upon successful completion 0 is returned. 54 | Otherwise, \-1 is returned and the error code in 55 | .Ar archive 56 | is set to indicate the error. 57 | .Sh ERRORS 58 | .Fn zip_delete 59 | fails if: 60 | .Bl -tag -width Er 61 | .It Bq Er ZIP_ER_INVAL 62 | .Ar index 63 | is not a valid file index in 64 | .Ar archive . 65 | .El 66 | .Sh SEE ALSO 67 | .Xr libzip 3 , 68 | .Xr zip_unchange 3 69 | .Sh AUTHORS 70 | .An -nosplit 71 | .An Dieter Baron Aq dillo@giga.or.at 72 | and 73 | .An Thomas Klausner Aq tk@giga.or.at 74 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/Makefile.am: -------------------------------------------------------------------------------- 1 | MANFMT=@MANFMT@ 2 | man1_MANS=${MAN1:.mdoc=.${MANFMT}} 3 | man3_MANS=${MAN3:.mdoc=.${MANFMT}} 4 | 5 | DISTCLEANFILES=${HTML} 6 | EXTRA_DIST=${MANDOC} ${MAN} 7 | 8 | MAN1= zipcmp.mdoc zipmerge.mdoc 9 | MAN3= libzip.mdoc \ 10 | zip_add.mdoc \ 11 | zip_close.mdoc \ 12 | zip_delete.mdoc \ 13 | zip_error_get.mdoc \ 14 | zip_error_get_sys_type.mdoc \ 15 | zip_error_to_str.mdoc \ 16 | zip_errors.mdoc \ 17 | zip_fclose.mdoc \ 18 | zip_file_strerror.mdoc \ 19 | zip_fopen.mdoc \ 20 | zip_fread.mdoc \ 21 | zip_get_archive_comment.mdoc \ 22 | zip_get_file_comment.mdoc \ 23 | zip_get_name.mdoc \ 24 | zip_get_num_files.mdoc \ 25 | zip_name_locate.mdoc \ 26 | zip_open.mdoc \ 27 | zip_rename.mdoc \ 28 | zip_set_archive_comment.mdoc \ 29 | zip_set_file_comment.mdoc \ 30 | zip_source_buffer.mdoc \ 31 | zip_source_file.mdoc \ 32 | zip_source_filep.mdoc \ 33 | zip_source_free.mdoc \ 34 | zip_source_function.mdoc \ 35 | zip_source_zip.mdoc \ 36 | zip_stat.mdoc \ 37 | zip_unchange.mdoc \ 38 | zip_unchange_all.mdoc \ 39 | zip_unchange_archive.mdoc 40 | 41 | install-data-hook: link-man3 42 | 43 | LN=ln 44 | 45 | link-man3: install-man3 uninstall-hook 46 | ${LN} ${DESTDIR}${man3dir}/zip_error_get.3 \ 47 | ${DESTDIR}${man3dir}/zip_file_error_get.3 48 | ${LN} ${DESTDIR}${man3dir}/zip_fopen.3 \ 49 | ${DESTDIR}${man3dir}/zip_fopen_index.3 50 | ${LN} ${DESTDIR}${man3dir}/zip_add.3 \ 51 | ${DESTDIR}${man3dir}/zip_replace.3 52 | ${LN} ${DESTDIR}${man3dir}/zip_stat.3 \ 53 | ${DESTDIR}${man3dir}/zip_stat_index.3 54 | ${LN} ${DESTDIR}${man3dir}/zip_file_strerror.3 \ 55 | ${DESTDIR}${man3dir}/zip_strerror.3 56 | 57 | uninstall-hook: 58 | -rm -f ${DESTDIR}${man3dir}/zip_file_error_get.3 59 | -rm -f ${DESTDIR}${man3dir}/zip_fopen_index.3 60 | -rm -f ${DESTDIR}${man3dir}/zip_replace.3 61 | -rm -f ${DESTDIR}${man3dir}/zip_stat_index.3 62 | -rm -f ${DESTDIR}${man3dir}/zip_strerror.3 63 | 64 | link-html: ${HTML} 65 | -rm -f zip_file_error_get.html zip_fopen_index.html \ 66 | zip_replace.html zip_stat_index.html \ 67 | zip_strerror.html 68 | ${LN} zip_error_get.html zip_file_error_get.html 69 | ${LN} zip_fopen.html zip_fopen_index.html 70 | ${LN} zip_add.html zip_replace.html 71 | ${LN} zip_stat.html zip_stat_index.html 72 | ${LN} zip_file_strerror.html zip_strerror.html 73 | 74 | MANDOC=${MAN1} ${MAN3} 75 | HTML=${MANDOC:.mdoc=.html} 76 | MAN=${MANDOC:.mdoc=.man} 77 | 78 | MDOC2MAN=mdoc2man 79 | SUFFIXES=.man .mdoc .html 80 | 81 | .PHONY: mkman update-errors 82 | 83 | mkman: ${MAN} 84 | mkhtml: ${HTML} link-html 85 | 86 | update-errors: 87 | sh $(srcdir)/make_zip_errors.sh $(srcdir)/../lib/zip.h zip_errors.mdoc 88 | 89 | .mdoc.man: 90 | ${MDOC2MAN} $< > $@.$$$$ && mv $@.$$$$ $@ 91 | 92 | .mdoc.html: 93 | nroff -mdoc2html $< | sed -e "s,../html[0-9]/,," > $@.$$$$ && mv $@.$$$$ $@ 94 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_source_free.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_source_free.mdoc,v 1.7 2006/04/23 14:55:32 wiz Exp $ 2 | .\" 3 | .\" zip_source_free.mdoc -- free zip data source 4 | .\" Copyright (C) 2004, 2005, 2006 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_SOURCE_FREE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_source_free 39 | .Nd free zip data source 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft void 45 | .Fn zip_source_free "struct zip_source *source" 46 | .Sh DESCRIPTION 47 | The function 48 | .Fn zip_source_free 49 | frees the zip data source 50 | .Ar source . 51 | If 52 | .Ar source 53 | is 54 | .Dv NULL , 55 | it does nothing. 56 | .Pp 57 | .Em NOTE : 58 | This function should not be called on a 59 | .Ar source 60 | after it was used successfully in a 61 | .Xr zip_add 3 62 | or 63 | .Xr zip_replace 3 64 | call. 65 | .Sh SEE ALSO 66 | .Xr libzip 3 , 67 | .Xr zip_source_buffer 3 , 68 | .Xr zip_source_file 3 , 69 | .Xr zip_source_filep 3 , 70 | .Xr zip_source_function 3 , 71 | .Xr zip_source_zip 3 72 | .Sh AUTHORS 73 | .An -nosplit 74 | .An Dieter Baron Aq dillo@giga.or.at 75 | and 76 | .An Thomas Klausner Aq tk@giga.or.at 77 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_file_get_offset.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_file_get_offset.c,v 1.4 2006/04/23 14:51:45 wiz Exp $ 3 | 4 | zip_file_get_offset.c -- get offset of file data in archive. 5 | Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include "zip.h" 46 | #include "zipint.h" 47 | 48 | 49 | 50 | /* _zip_file_get_offset(za, ze): 51 | Returns the offset of the file data for entry ze. 52 | 53 | On error, fills in za->error and returns 0. 54 | */ 55 | 56 | unsigned int 57 | _zip_file_get_offset(struct zip *za, int idx) 58 | { 59 | struct zip_dirent de; 60 | unsigned int offset; 61 | 62 | offset = za->cdir->entry[idx].offset; 63 | 64 | if (fseek(za->zp, offset, SEEK_SET) != 0) { 65 | _zip_error_set(&za->error, ZIP_ER_SEEK, errno); 66 | return 0; 67 | } 68 | 69 | if (_zip_dirent_read(&de, za->zp, NULL, 0, 1, &za->error, za->runzip) != 0) 70 | return 0; 71 | 72 | offset += LENTRYSIZE + de.filename_len + de.extrafield_len; 73 | 74 | _zip_dirent_finalize(&de); 75 | 76 | return offset; 77 | } 78 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_replace.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_replace.c,v 1.20 2006/04/09 14:52:02 wiz Exp $ 3 | 4 | zip_replace.c -- replace file via callback function 5 | Copyright (C) 1999, 2003, 2004, 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include "zip.h" 39 | #include "zipint.h" 40 | 41 | 42 | 43 | int 44 | zip_replace(struct zip *za, int idx, struct zip_source *source) 45 | { 46 | if (idx < 0 || idx >= za->nentry || source == NULL) { 47 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 48 | return -1; 49 | } 50 | 51 | if (_zip_replace(za, idx, NULL, source) == -1) 52 | return -1; 53 | 54 | return 0; 55 | } 56 | 57 | 58 | 59 | 60 | int 61 | _zip_replace(struct zip *za, int idx, const char *name, 62 | struct zip_source *source) 63 | { 64 | if (idx == -1) { 65 | if (_zip_entry_new(za) == NULL) 66 | return -1; 67 | 68 | idx = za->nentry - 1; 69 | } 70 | 71 | _zip_unchange_data(za->entry+idx); 72 | 73 | if (name && _zip_set_name(za, idx, name) != 0) 74 | return -1; 75 | 76 | za->entry[idx].state = ((za->cdir == NULL || idx >= za->cdir->nentry) 77 | ? ZIP_ST_ADDED : ZIP_ST_REPLACED); 78 | za->entry[idx].source = source; 79 | 80 | return idx; 81 | } 82 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_error_get_sys_type.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_error_get_sys_type.mdoc,v 1.5 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_error_get_sys_type.mdoc -- get type of error 4 | .\" Copyright (C) 2004, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd November 30, 2004 35 | .Dt ZIP_ERROR_SYS_TYPE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_error_get_sys_type 39 | .Nd get type of system error code 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_error_get_sys_type "int ze" 46 | .Sh DESCRIPTION 47 | The 48 | .Fn zip_error_get_sys_type 49 | function returns the type of the system error code for the libzip error 50 | .Ar ze . 51 | Possible types are: 52 | .Bl -tag -width XZIP_ET_NONEXX -offset indent -compact 53 | .It Dv ZIP_ET_NONE 54 | System error code is unused. 55 | .It Dv ZIP_ET_SYS 56 | System error code is an errno value. 57 | .It Dv ZIP_ET_ZLIB 58 | System error code is from 59 | .Xr zlib 3 . 60 | .El 61 | .Sh SEE ALSO 62 | .Xr libzip 3 , 63 | .Xr zip_error_get 3 , 64 | .Xr zip_error_to_str 3 , 65 | .Xr zip_file_error_get 3 66 | .Sh AUTHORS 67 | .An -nosplit 68 | .An Dieter Baron Aq dillo@giga.or.at 69 | and 70 | .An Thomas Klausner Aq tk@giga.or.at 71 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_delete.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_delete.mdoc,v 1.11 2005/06/09 21:14:54 wiz Exp 3 | .\" $NiH: zip_delete.man,v 1.10 2005/06/17 12:59:05 wiz Exp $ 4 | .\" 5 | .\" zip_delete.mdoc \-- delete files from zip archive 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_DELETE 3 "October 3, 2003" NiH 37 | .SH "NAME" 38 | zip_delete \- delete file from zip archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_delete "struct zip *archive" "int index" 45 | .SH "DESCRIPTION" 46 | The file at position 47 | \fBindex\fR 48 | in the zip archive 49 | \fBarchive\fR 50 | is marked as deleted. 51 | .SH "RETURN VALUES" 52 | Upon successful completion 0 is returned. 53 | Otherwise, \-1 is returned and the error code in 54 | \fBarchive\fR 55 | is set to indicate the error. 56 | .SH "ERRORS" 57 | .Fn zip_delete 58 | fails if: 59 | .RS 60 | .TP 4 61 | Bq Er ZIP_ER_INVAL 62 | \fBindex\fR 63 | is not a valid file index in 64 | \fBarchive.\fR 65 | .RE 66 | .SH "SEE ALSO" 67 | libzip(3), 68 | zip_unchange(3) 69 | .SH "AUTHORS" 70 | 71 | Dieter Baron 72 | and 73 | Thomas Klausner 74 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_source_free.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_source_free.mdoc,v 1.7 2006/04/23 14:55:32 wiz Exp 3 | .\" $NiH: zip_source_free.man,v 1.5 2006/04/23 14:55:37 wiz Exp $ 4 | .\" 5 | .\" zip_source_free.mdoc \-- free zip data source 6 | .\" Copyright (C) 2004, 2005, 2006 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_SOURCE_FREE 3 "April 23, 2006" NiH 37 | .SH "NAME" 38 | zip_source_free \- free zip data source 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft void 44 | .Fn zip_source_free "struct zip_source *source" 45 | .SH "DESCRIPTION" 46 | The function 47 | .Fn zip_source_free 48 | frees the zip data source 49 | \fBsource.\fR 50 | If 51 | \fBsource\fR 52 | is 53 | \fBNULL,\fR 54 | it does nothing. 55 | .PP 56 | .I NOTE : 57 | This function should not be called on a 58 | \fBsource\fR 59 | after it was used successfully in a 60 | zip_add(3) 61 | or 62 | zip_replace(3) 63 | call. 64 | .SH "SEE ALSO" 65 | libzip(3), 66 | zip_source_buffer(3), 67 | zip_source_file(3), 68 | zip_source_filep(3), 69 | zip_source_function(3), 70 | zip_source_zip(3) 71 | .SH "AUTHORS" 72 | 73 | Dieter Baron 74 | and 75 | Thomas Klausner 76 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_entry_new.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_entry_new.c,v 1.2 2006/04/09 19:05:47 wiz Exp $ 3 | 4 | zip_entry_new.c -- create and init struct zip_entry 5 | Copyright (C) 1999, 2003, 2004, 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | struct zip_entry * 46 | _zip_entry_new(struct zip *za) 47 | { 48 | struct zip_entry *ze; 49 | if (!za) { 50 | ze = (struct zip_entry *)malloc(sizeof(struct zip_entry)); 51 | if (!ze) { 52 | _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); 53 | return NULL; 54 | } 55 | } 56 | else { 57 | if (za->nentry >= za->nentry_alloc-1) { 58 | za->nentry_alloc += 16; 59 | za->entry = (struct zip_entry *)realloc(za->entry, 60 | sizeof(struct zip_entry) 61 | * za->nentry_alloc); 62 | if (!za->entry) { 63 | _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); 64 | return NULL; 65 | } 66 | } 67 | ze = za->entry+za->nentry; 68 | } 69 | 70 | ze->state = ZIP_ST_UNCHANGED; 71 | 72 | ze->ch_filename = NULL; 73 | ze->ch_comment = NULL; 74 | ze->ch_comment_len = -1; 75 | ze->source = NULL; 76 | 77 | if (za) 78 | za->nentry++; 79 | 80 | return ze; 81 | } 82 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_error.c,v 1.7 2005/06/09 19:57:09 dillo Exp $ 3 | 4 | zip_error.c -- struct zip_error helper functions 5 | Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | void 46 | _zip_error_copy(struct zip_error *dst, struct zip_error *src) 47 | { 48 | dst->zip_err = src->zip_err; 49 | dst->sys_err = src->sys_err; 50 | } 51 | 52 | 53 | 54 | void 55 | _zip_error_fini(struct zip_error *err) 56 | { 57 | free(err->str); 58 | err->str = NULL; 59 | } 60 | 61 | 62 | 63 | void 64 | _zip_error_get(struct zip_error *err, int *zep, int *sep) 65 | { 66 | if (zep) 67 | *zep = err->zip_err; 68 | if (sep) { 69 | if (zip_error_get_sys_type(err->zip_err) != ZIP_ET_NONE) 70 | *sep = err->sys_err; 71 | else 72 | *sep = 0; 73 | } 74 | } 75 | 76 | 77 | 78 | void 79 | _zip_error_init(struct zip_error *err) 80 | { 81 | err->zip_err = 0; 82 | err->sys_err = 0; 83 | err->str = NULL; 84 | } 85 | 86 | 87 | 88 | void 89 | _zip_error_set(struct zip_error *err, int ze, int se) 90 | { 91 | if (err) { 92 | err->zip_err = ze; 93 | err->sys_err = se; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/encrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: encrypt.c,v 1.1 2006/04/24 14:04:19 dillo Exp $ 3 | 4 | encrypt.c -- test encryption support 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "zip.h" 44 | 45 | const char *prg; 46 | 47 | int 48 | main(int argc, char *argv[]) 49 | { 50 | const char *archive; 51 | struct zip *za; 52 | char buf[100]; 53 | int err; 54 | int i; 55 | struct zip_stat st; 56 | 57 | prg = argv[0]; 58 | 59 | if (argc != 2) { 60 | fprintf(stderr, "usage: %s archive\n", prg); 61 | return 1; 62 | } 63 | 64 | archive = argv[1]; 65 | 66 | if ((za=zip_open(archive, 0, &err)) == NULL) { 67 | zip_error_to_str(buf, sizeof(buf), err, errno); 68 | fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, 69 | archive, buf); 70 | return 1; 71 | } 72 | 73 | for (i=0; i 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_ERROR_SYS_TYPE 3 "November 30, 2004" NiH 37 | .SH "NAME" 38 | zip_error_get_sys_type \- get type of system error code 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_error_get_sys_type "int ze" 45 | .SH "DESCRIPTION" 46 | The 47 | .Fn zip_error_get_sys_type 48 | function returns the type of the system error code for the libzip error 49 | \fBze.\fR 50 | Possible types are: 51 | .RS 52 | .TP 16 53 | \fBZIP_ET_NONE\fR 54 | System error code is unused. 55 | .TP 16 56 | \fBZIP_ET_SYS\fR 57 | System error code is an errno value. 58 | .TP 16 59 | \fBZIP_ET_ZLIB\fR 60 | System error code is from 61 | zlib(3). 62 | .RE 63 | .SH "SEE ALSO" 64 | libzip(3), 65 | zip_error_get(3), 66 | zip_error_to_str(3), 67 | zip_file_error_get(3) 68 | .SH "AUTHORS" 69 | 70 | Dieter Baron 71 | and 72 | Thomas Klausner 73 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_unchange.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_unchange.c,v 1.19 2006/04/23 13:21:18 wiz Exp $ 3 | 4 | zip_unchange.c -- undo changes to file in zip archive 5 | Copyright (C) 1999, 2004, 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include "zip.h" 40 | #include "zipint.h" 41 | 42 | 43 | 44 | int 45 | zip_unchange(struct zip *za, int idx) 46 | { 47 | return _zip_unchange(za, idx, 0); 48 | } 49 | 50 | 51 | 52 | int 53 | _zip_unchange(struct zip *za, int idx, int allow_duplicates) 54 | { 55 | int i; 56 | 57 | if (idx < 0 || idx >= za->nentry) { 58 | _zip_error_set(&za->error, ZIP_ER_INVAL, 0); 59 | return -1; 60 | } 61 | 62 | if (za->entry[idx].ch_filename) { 63 | if (!allow_duplicates) { 64 | i = _zip_name_locate(za, 65 | _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL), 66 | 0, NULL); 67 | if (i != -1 && i != idx) { 68 | _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); 69 | return -1; 70 | } 71 | } 72 | 73 | free(za->entry[idx].ch_filename); 74 | za->entry[idx].ch_filename = NULL; 75 | } 76 | 77 | free(za->entry[idx].ch_comment); 78 | za->entry[idx].ch_comment = NULL; 79 | za->entry[idx].ch_comment_len = -1; 80 | 81 | _zip_unchange_data(za->entry+idx); 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_rename.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_rename.mdoc,v 1.8 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_rename.mdoc -- rename file in zip archive 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd November 30, 2003 35 | .Dt ZIP_RENAME 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_rename 39 | .Nd rename file in zip archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_rename "struct zip *archive" "int index" "const char *name" 46 | .Sh DESCRIPTION 47 | The file at position 48 | .Ar index 49 | in the zip archive 50 | .Ar archive 51 | is renamed to 52 | .Ar name . 53 | .Sh RETURN VALUES 54 | Upon successful completion 0 is returned. 55 | Otherwise, \-1 is returned and the error code in 56 | .Ar archive 57 | is set to indicate the error. 58 | .Sh ERRORS 59 | .Fn zip_rename 60 | fails if: 61 | .Bl -tag -width Er 62 | .It Bq Er ZIP_ER_EXISTS 63 | There is already a file called 64 | .Ar name 65 | in the archive. 66 | .It Bq Er ZIP_ER_INVAL 67 | .Ar index 68 | is not a valid file index in 69 | .Ar archive . 70 | .El 71 | .Sh SEE ALSO 72 | .Xr libzip 3 , 73 | .Xr zip_unchange 3 74 | .Sh AUTHORS 75 | .An -nosplit 76 | .An Dieter Baron Aq dillo@giga.or.at 77 | and 78 | .An Thomas Klausner Aq tk@giga.or.at 79 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_name_locate.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_name_locate.mdoc,v 1.8 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_name_locate.mdoc -- get index of file by name 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd October 3, 2003 35 | .Dt ZIP_NAME_LOCATE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_name_locate 39 | .Nd get index of file by name 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_name_locate "struct zip *archive" "const char *fname" "int flags" 46 | .Sh DESCRIPTION 47 | The 48 | .Fn zip_name_locate 49 | function returns the index of the file named 50 | .Ar fname 51 | in 52 | .Ar archive . 53 | If 54 | .Ar archive 55 | does not contain a file with that name, \-1 is returned. 56 | The 57 | .Fa flags 58 | are specified by 59 | .Em or Ns No 'ing 60 | the following values, or 0 for none of them. 61 | .Bl -tag -offset indent -width ZIP_FL_NOCASE 62 | .It Dv ZIP_FL_NOCASE 63 | Ignore case distinctions. 64 | .It Dv ZIP_FL_NODIR 65 | Ignore directory part of file name in archive. 66 | .El 67 | .\" .Sh RETURN VALUES 68 | .Sh SEE ALSO 69 | .Xr libzip 3 , 70 | .Xr zip_get_name 3 71 | .Sh AUTHORS 72 | .An -nosplit 73 | .An Dieter Baron Aq dillo@giga.or.at 74 | and 75 | .An Thomas Klausner Aq tk@giga.or.at 76 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_unchange.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_unchange.mdoc,v 1.12 2006/04/23 13:14:46 wiz Exp $ 2 | .\" 3 | .\" zip_unchange.mdoc -- undo changes to file in zip archive 4 | .\" Copyright (C) 2003, 2005, 2006 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_UNCHANGE 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_unchange 39 | .Nd undo changes to file in zip archive 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_unchange "struct zip *archive" "int index" 46 | .Sh DESCRIPTION 47 | Changes to the file at position 48 | .Ar index 49 | are reverted. 50 | .Sh RETURN VALUES 51 | Upon successful completion 0 is returned. 52 | Otherwise, \-1 is returned and the error code in 53 | .Ar archive 54 | is set to indicate the error. 55 | .Sh ERRORS 56 | .Fn zip_unchange 57 | fails if: 58 | .Bl -tag -width Er 59 | .It Bq Er ZIP_ER_EXISTS 60 | Unchanging the name would result in a duplicate name in the archive. 61 | .It Bq Er ZIP_ER_INVAL 62 | .Ar index 63 | is not a valid file index in 64 | .Ar zip . 65 | .El 66 | .Sh SEE ALSO 67 | .Xr libzip 3 , 68 | .Xr zip_unchange_all 3 , 69 | .Xr zip_unchange_archive 3 70 | .Sh AUTHORS 71 | .An -nosplit 72 | .An Dieter Baron Aq dillo@giga.or.at 73 | and 74 | .An Thomas Klausner Aq tk@giga.or.at 75 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/set_comment_removeglobal.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: set_comment_removeglobal.c,v 1.2 2006/04/23 13:55:19 wiz Exp $ 3 | 4 | set_comment_removeglobal.c -- remove archive comment 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "zip.h" 44 | 45 | const char *prg; 46 | 47 | int 48 | main(int argc, char *argv[]) 49 | { 50 | const char *archive; 51 | struct zip *za; 52 | char buf[100]; 53 | int err; 54 | 55 | prg = argv[0]; 56 | 57 | if (argc != 2) { 58 | fprintf(stderr, "usage: %s archive\n", prg); 59 | return 1; 60 | } 61 | 62 | archive = argv[1]; 63 | 64 | if ((za=zip_open(archive, 0, &err)) == NULL) { 65 | zip_error_to_str(buf, sizeof(buf), err, errno); 66 | fprintf(stderr,"%s: can't open zip archive `%s': %s\n", prg, 67 | archive, buf); 68 | return 1; 69 | } 70 | 71 | if (zip_set_archive_comment(za, NULL, 0) < 0) { 72 | zip_error_to_str(buf, sizeof(buf), err, errno); 73 | fprintf(stderr, "%s: zip_set_archive_comment failed: %s\n", 74 | prg, buf); 75 | } 76 | 77 | if (zip_close(za) == -1) { 78 | fprintf(stderr,"%s: can't close zip archive `%s'\n", prg, archive); 79 | return 1; 80 | } 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_name_locate.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_name_locate.mdoc,v 1.8 2005/06/09 21:14:54 wiz Exp 3 | .\" $NiH: zip_name_locate.man,v 1.9 2005/06/17 12:59:06 wiz Exp $ 4 | .\" 5 | .\" zip_name_locate.mdoc \-- get index of file by name 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_NAME_LOCATE 3 "October 3, 2003" NiH 37 | .SH "NAME" 38 | zip_name_locate \- get index of file by name 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_name_locate "struct zip *archive" "const char *fname" "int flags" 45 | .SH "DESCRIPTION" 46 | The 47 | .Fn zip_name_locate 48 | function returns the index of the file named 49 | \fBfname\fR 50 | in 51 | \fBarchive.\fR 52 | If 53 | \fBarchive\fR 54 | does not contain a file with that name, \-1 is returned. 55 | The 56 | .Fa flags 57 | are specified by 58 | .I or'ing 59 | the following values, or 0 for none of them. 60 | .RS 61 | .TP 15 62 | \fBZIP_FL_NOCASE\fR 63 | Ignore case distinctions. 64 | .TP 15 65 | \fBZIP_FL_NODIR\fR 66 | Ignore directory part of file name in archive. 67 | .RE 68 | .\".SH "RETURN VALUES" 69 | .SH "SEE ALSO" 70 | libzip(3), 71 | zip_get_name(3) 72 | .SH "AUTHORS" 73 | 74 | Dieter Baron 75 | and 76 | Thomas Klausner 77 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_rename.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_rename.mdoc,v 1.8 2005/06/09 21:14:54 wiz Exp 3 | .\" $NiH: zip_rename.man,v 1.7 2005/06/17 12:59:06 wiz Exp $ 4 | .\" 5 | .\" zip_rename.mdoc \-- rename file in zip archive 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_RENAME 3 "November 30, 2003" NiH 37 | .SH "NAME" 38 | zip_rename \- rename file in zip archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_rename "struct zip *archive" "int index" "const char *name" 45 | .SH "DESCRIPTION" 46 | The file at position 47 | \fBindex\fR 48 | in the zip archive 49 | \fBarchive\fR 50 | is renamed to 51 | \fBname.\fR 52 | .SH "RETURN VALUES" 53 | Upon successful completion 0 is returned. 54 | Otherwise, \-1 is returned and the error code in 55 | \fBarchive\fR 56 | is set to indicate the error. 57 | .SH "ERRORS" 58 | .Fn zip_rename 59 | fails if: 60 | .RS 61 | .TP 4 62 | Bq Er ZIP_ER_EXISTS 63 | There is already a file called 64 | \fBname\fR 65 | in the archive. 66 | .TP 4 67 | Bq Er ZIP_ER_INVAL 68 | \fBindex\fR 69 | is not a valid file index in 70 | \fBarchive.\fR 71 | .RE 72 | .SH "SEE ALSO" 73 | libzip(3), 74 | zip_unchange(3) 75 | .SH "AUTHORS" 76 | 77 | Dieter Baron 78 | and 79 | Thomas Klausner 80 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_unchange.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_unchange.mdoc,v 1.12 2006/04/23 13:14:46 wiz Exp 3 | .\" $NiH: zip_unchange.man,v 1.10 2006/04/23 13:30:30 wiz Exp $ 4 | .\" 5 | .\" zip_unchange.mdoc \-- undo changes to file in zip archive 6 | .\" Copyright (C) 2003, 2005, 2006 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_UNCHANGE 3 "April 23, 2006" NiH 37 | .SH "NAME" 38 | zip_unchange \- undo changes to file in zip archive 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft int 44 | .Fn zip_unchange "struct zip *archive" "int index" 45 | .SH "DESCRIPTION" 46 | Changes to the file at position 47 | \fBindex\fR 48 | are reverted. 49 | .SH "RETURN VALUES" 50 | Upon successful completion 0 is returned. 51 | Otherwise, \-1 is returned and the error code in 52 | \fBarchive\fR 53 | is set to indicate the error. 54 | .SH "ERRORS" 55 | .Fn zip_unchange 56 | fails if: 57 | .RS 58 | .TP 4 59 | Bq Er ZIP_ER_EXISTS 60 | Unchanging the name would result in a duplicate name in the archive. 61 | .TP 4 62 | Bq Er ZIP_ER_INVAL 63 | \fBindex\fR 64 | is not a valid file index in 65 | \fBzip.\fR 66 | .RE 67 | .SH "SEE ALSO" 68 | libzip(3), 69 | zip_unchange_all(3), 70 | zip_unchange_archive(3) 71 | .SH "AUTHORS" 72 | 73 | Dieter Baron 74 | and 75 | Thomas Klausner 76 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zipcmp.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zipcmp.mdoc,v 1.12 2005/06/17 12:59:06 wiz Exp $ 2 | .\" 3 | .\" zipcmp.mdoc -- compare zip archives 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd October 2, 2003 35 | .Dt ZIPCMP 1 36 | .Os 37 | .Sh NAME 38 | .Nm zipcmp 39 | .Nd compare contents of zip archives 40 | .Sh SYNOPSIS 41 | .Nm 42 | .Op Fl hiqVv 43 | .Ar zip1 zip2 44 | .Sh DESCRIPTION 45 | .Nm 46 | compares the zip archives 47 | .Ar zip1 48 | and 49 | .Ar zip2 50 | and checks if they contain the same files, comparing their names, 51 | uncompressed sizes, and CRCs. 52 | File order and compressed size differences are ignored. 53 | .Pp 54 | Supported options: 55 | .Bl -tag -width MMM 56 | .It Fl h 57 | Display a short help message and exit. 58 | .It Fl i 59 | Compare names ignoring case distinctions. 60 | .It Fl q 61 | Quiet mode. 62 | Compare 63 | .Fl v . 64 | .It Fl v 65 | Verbose mode. 66 | Print details about differences to stdout. 67 | (This is the default.) 68 | .It Fl V 69 | Display version information and exit. 70 | .El 71 | .Sh EXIT STATUS 72 | .Nm 73 | exits 0 if the two zip archives contain the same files, 1 if they differ, 74 | and \*[Gt]1 if an error occurred. 75 | .Sh SEE ALSO 76 | .Xr zipmerge 1 , 77 | .Xr libzip 3 78 | .Sh AUTHORS 79 | .An -nosplit 80 | .An Dieter Baron Aq dillo@giga.or.at 81 | and 82 | .An Thomas Klausner Aq tk@giga.or.at 83 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_error_strerror.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_error_strerror.c,v 1.4 2006/02/21 09:41:00 dillo Exp $ 3 | 4 | zip_error_sterror.c -- get string representation of struct zip_error 5 | Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "zip.h" 44 | #include "zipint.h" 45 | 46 | 47 | 48 | const char * 49 | _zip_error_strerror(struct zip_error *err) 50 | { 51 | const char *zs, *ss; 52 | char buf[128], *s; 53 | 54 | _zip_error_fini(err); 55 | 56 | if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) { 57 | sprintf(buf, "Unknown error %d", err->zip_err); 58 | zs = NULL; 59 | ss = buf; 60 | } 61 | else { 62 | zs = _zip_err_str[err->zip_err]; 63 | 64 | switch (_zip_err_type[err->zip_err]) { 65 | case ZIP_ET_SYS: 66 | ss = strerror(err->sys_err); 67 | break; 68 | 69 | case ZIP_ET_ZLIB: 70 | ss = zError(err->sys_err); 71 | break; 72 | 73 | default: 74 | ss = NULL; 75 | } 76 | } 77 | 78 | if (ss == NULL) 79 | return zs; 80 | else { 81 | if ((s=(char *)malloc(strlen(ss) 82 | + (zs ? strlen(zs)+2 : 0) + 1)) == NULL) 83 | return _zip_err_str[ZIP_ER_MEMORY]; 84 | 85 | sprintf(s, "%s%s%s", 86 | (zs ? zs : ""), 87 | (zs ? ": " : ""), 88 | ss); 89 | err->str = s; 90 | 91 | return ss; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_error_get.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_error_get.mdoc,v 1.9 2006/04/23 12:45:10 wiz Exp $ 2 | .\" 3 | .\" zip_error_get.mdoc -- get error codes for archive or file 4 | .\" Copyright (C) 2004, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_ERROR_GET 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_error_get , 39 | .Nm zip_file_error_get 40 | .Nd get error codes for archive or file 41 | .Sh LIBRARY 42 | libzip (-lzip) 43 | .Sh SYNOPSIS 44 | .In zip.h 45 | .Ft void 46 | .Fn zip_error_get "struct zip *archive" "int *zep" "int *sep" 47 | .Ft void 48 | .Fn zip_file_error_get "struct zip_file *file" "int *zep" "int *sep" 49 | .Sh DESCRIPTION 50 | The 51 | .Fn zip_error_get 52 | function returns the error codes for the zip archive 53 | .Ar archive . 54 | If 55 | .Ar zep 56 | is not 57 | .Dv NULL , 58 | .Ar *zep 59 | will be filled in with the error code from libzip. 60 | Similarly, 61 | .Ar *sep 62 | will contain the corresponding system error code, if 63 | .Ar sep 64 | is not 65 | .Dv NULL ; 66 | use 67 | .Fn zip_error_get_sys_type 68 | to determine the type of system error code. 69 | .Pp 70 | The 71 | .Fn zip_file_error_get 72 | function does the same for the zip file 73 | .Ar file . 74 | .Sh SEE ALSO 75 | .Xr libzip 3 , 76 | .Xr zip_error_get_sys_type 3 , 77 | .Xr zip_error_to_str 3 78 | .Sh AUTHORS 79 | .An -nosplit 80 | .An Dieter Baron Aq dillo@giga.or.at 81 | and 82 | .An Thomas Klausner Aq tk@giga.or.at 83 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/zip_name_locate.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: zip_name_locate.c,v 1.19 2005/06/09 19:57:10 dillo Exp $ 3 | 4 | zip_name_locate.c -- get index by name 5 | Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | 40 | #include "zip.h" 41 | #include "zipint.h" 42 | 43 | 44 | 45 | int 46 | zip_name_locate(struct zip *za, const char *fname, int flags) 47 | { 48 | return _zip_name_locate(za, fname, flags, &za->error); 49 | } 50 | 51 | 52 | 53 | int 54 | _zip_name_locate(struct zip *za, const char *fname, int flags, 55 | struct zip_error *error) 56 | { 57 | int (*cmp)(const char *, const char *); 58 | const char *fn, *p; 59 | int i, n; 60 | 61 | if (fname == NULL) { 62 | _zip_error_set(error, ZIP_ER_INVAL, 0); 63 | return -1; 64 | } 65 | 66 | cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; 67 | 68 | n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; 69 | for (i=0; icdir->entry[i].filename; 72 | else 73 | fn = _zip_get_name(za, i, flags, error); 74 | 75 | /* newly added (partially filled) entry */ 76 | if (fn == NULL) 77 | continue; 78 | 79 | if (flags & ZIP_FL_NODIR) { 80 | p = strrchr(fn, '/'); 81 | if (p) 82 | fn = p+1; 83 | } 84 | 85 | if (cmp(fname, fn) == 0) 86 | return i; 87 | } 88 | 89 | _zip_error_set(error, ZIP_ER_NOENT, 0); 90 | return -1; 91 | } 92 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_get_archive_comment.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_get_archive_comment.mdoc,v 1.2 2006/04/23 13:06:29 wiz Exp $ 2 | .\" 3 | .\" zip_get_archive_comment.mdoc -- get zip archive comment 4 | .\" Copyright (C) 2006 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_GET_ARCHIVE_COMMENT 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_get_archive_comment 39 | .Nd get zip archive comment 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft const char * 45 | .Fn zip_get_archive_comment "struct zip *archive" "int *lenp" "int flags" 46 | .Sh DESCRIPTION 47 | The 48 | .Fn zip_get_archive_comment 49 | function returns the comment for the entire zip archive. 50 | This pointer should not be modified or 51 | .Xr free 3 Ap d . 52 | If 53 | .Ar lenp 54 | is not 55 | .Dv NULL , 56 | the integer to which it points will be set to the length of the 57 | comment. 58 | If 59 | .Ar flags 60 | is set to 61 | .Dv ZIP_FL_UNCHANGED , 62 | the original unchanged comment is returned. 63 | .Sh RETURN VALUES 64 | Upon successful completion, a pointer to the comment is returned, 65 | or 66 | .Dv NULL 67 | if there is no comment. 68 | .\" In case of an error, 69 | .\" .Dv NULL 70 | .\" is returned and the error code in 71 | .\" .Ar archive 72 | .\" is set to indicate the error. 73 | .Sh SEE ALSO 74 | .Xr libzip 3 , 75 | .Xr zip_get_file_comment 3 76 | .Sh AUTHORS 77 | .An -nosplit 78 | .An Dieter Baron Aq dillo@giga.or.at 79 | and 80 | .An Thomas Klausner Aq tk@giga.or.at 81 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_file_strerror.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_file_strerror.mdoc,v 1.7 2005/06/09 21:14:54 wiz Exp $ 2 | .\" 3 | .\" zip_file_strerror.mdoc -- get string representation for a zip error 4 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd December 27, 2004 35 | .Dt ZIP_FILE_STRERROR 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_file_strerror , 39 | .Nm zip_strerror 40 | .Nd get string representation for a zip error 41 | .Sh LIBRARY 42 | libzip (-lzip) 43 | .Sh SYNOPSIS 44 | .In zip.h 45 | .Ft const char * 46 | .Fn zip_file_strerror "struct zip_file *file" 47 | .Ft const char * 48 | .Fn zip_strerror "struct zip *archive" 49 | .Sh DESCRIPTION 50 | The 51 | .Fn zip_strerror 52 | function returns a string describing the last error for the zip archive 53 | .Ar archive , 54 | while the 55 | .Fn zip_file_strerror 56 | function does the same for a zip file 57 | .Ar file 58 | (one file in an archive). 59 | The returned string must not be modified or freed, and becomes invalid when 60 | .Ar archive 61 | or 62 | .Ar file , 63 | respectively, 64 | is closed or on the next call to 65 | .Fn zip_strerror 66 | or 67 | .Fn zip_file_strerror , 68 | respectively, 69 | for the same archive. 70 | .Sh RETURN VALUES 71 | .Fn zip_file_strerror 72 | and 73 | .Fn zip_strerror 74 | return a pointer to the error string. 75 | .Sh SEE ALSO 76 | .Xr libzip 3 , 77 | .Xr zip_error_to_str 3 78 | .Sh AUTHORS 79 | .An -nosplit 80 | .An Dieter Baron Aq dillo@giga.or.at 81 | and 82 | .An Thomas Klausner Aq tk@giga.or.at 83 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_error_get.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_error_get.mdoc,v 1.9 2006/04/23 12:45:10 wiz Exp 3 | .\" $NiH: zip_error_get.man,v 1.5 2006/04/23 12:50:36 wiz Exp $ 4 | .\" 5 | .\" zip_error_get.mdoc \-- get error codes for archive or file 6 | .\" Copyright (C) 2004, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_ERROR_GET 3 "April 23, 2006" NiH 37 | .SH "NAME" 38 | zip_error_get , \- .Nm zip_file_error_get 39 | get error codes for archive or file 40 | .SH "LIBRARY" 41 | libzip (-lzip) 42 | .SH "SYNOPSIS" 43 | .In zip.h 44 | .Ft void 45 | .Fn zip_error_get "struct zip *archive" "int *zep" "int *sep" 46 | .Ft void 47 | .Fn zip_file_error_get "struct zip_file *file" "int *zep" "int *sep" 48 | .SH "DESCRIPTION" 49 | The 50 | .Fn zip_error_get 51 | function returns the error codes for the zip archive 52 | \fBarchive.\fR 53 | If 54 | \fBzep\fR 55 | is not 56 | \fBNULL,\fR 57 | \fB*zep\fR 58 | will be filled in with the error code from libzip. 59 | Similarly, 60 | \fB*sep\fR 61 | will contain the corresponding system error code, if 62 | \fBsep\fR 63 | is not 64 | \fBNULL;\fR 65 | use 66 | .Fn zip_error_get_sys_type 67 | to determine the type of system error code. 68 | .PP 69 | The 70 | .Fn zip_file_error_get 71 | function does the same for the zip file 72 | \fBfile.\fR 73 | .SH "SEE ALSO" 74 | libzip(3), 75 | zip_error_get_sys_type(3), 76 | zip_error_to_str(3) 77 | .SH "AUTHORS" 78 | 79 | Dieter Baron 80 | and 81 | Thomas Klausner 82 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zipcmp.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zipcmp.mdoc,v 1.11 2005/06/09 21:13:13 wiz Exp 3 | .\" $NiH: zipcmp.man,v 1.9 2005/06/17 12:59:06 wiz Exp $ 4 | .\" 5 | .\" zipcmp.mdoc \-- compare zip archives 6 | .\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIPCMP 1 "October 2, 2003" NiH 37 | .SH "NAME" 38 | zipcmp \- compare contents of zip archives 39 | .SH "SYNOPSIS" 40 | .B zipcmp 41 | [\fB-hiqVv\fR] 42 | \fBzip1 zip2\fR 43 | .SH "DESCRIPTION" 44 | .B zipcmp 45 | compares the zip archives 46 | \fBzip1\fR 47 | and 48 | \fBzip2\fR 49 | and checks if they contain the same files, comparing their names, 50 | uncompressed sizes, and CRCs. 51 | File order and compressed size differences are ignored. 52 | .PP 53 | Supported options: 54 | .RS 55 | .TP 5 56 | \fB-h\fR 57 | Display a short help message and exit. 58 | .TP 5 59 | \fB-i\fR 60 | Compare names ignoring case distinctions. 61 | .TP 5 62 | \fB-q\fR 63 | Quiet mode. 64 | Compare 65 | \fB-v\fR. 66 | .TP 5 67 | \fB-v\fR 68 | Verbose mode. 69 | Print details about differences to stdout. 70 | (This is the default.) 71 | .TP 5 72 | \fB-V\fR 73 | Display version information and exit. 74 | .RE 75 | .SH "EXIT STATUS" 76 | .B zipcmp 77 | exits 0 if the two zip archives contain the same files, 1 if they differ, 78 | and \*[Gt]1 if an error occurred. 79 | .SH "SEE ALSO" 80 | zipmerge(1), 81 | libzip(3) 82 | .SH "AUTHORS" 83 | 84 | Dieter Baron 85 | and 86 | Thomas Klausner 87 | -------------------------------------------------------------------------------- /libzip-0.7.1/lib/make_zip_err_str.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # $NiH: make_zip_err_str.sh,v 1.8 2004/11/17 21:55:09 wiz Exp $ 4 | # 5 | # make_zip_err_str.sh: create zip_err_str.c from zip.h 6 | # Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner 7 | # 8 | # This file is part of libzip, a library to manipulate ZIP archives. 9 | # The authors can be contacted at 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in 18 | # the documentation and/or other materials provided with the 19 | # distribution. 20 | # 3. The names of the authors may not be used to endorse or promote 21 | # products derived from this software without specific prior 22 | # written permission. 23 | # 24 | # THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | if [ "$#" -ne 2 ] 38 | then 39 | echo "Usage: $0 in_file out_file" >&2 40 | echo " e.g. $0 zip.h zip_err_str.c" >&2 41 | exit 1 42 | fi 43 | 44 | if [ "$1" = "$2" ] 45 | then 46 | echo "$0: error: output file = input file" >&2 47 | exit 1 48 | fi 49 | 50 | rcsid=`echo '$NiH: make_zip_err_str.sh,v 1.8 2004/11/17 21:55:09 wiz Exp $' | tr -d '$'` 51 | inrcsid=`sed -n 's/^ \$\([^$]*[^ ]\) *\$$/\1/p' "$1"` 52 | 53 | cat <> "$2.$$" || exit 1 54 | /* 55 | This file was generated automatically by $0 56 | from $1; make changes there. 57 | 58 | $rcsid 59 | $inrcsid 60 | */ 61 | 62 | #include "zip.h" 63 | #include "zipint.h" 64 | 65 | 66 | 67 | const char * const _zip_err_str[] = { 68 | EOF 69 | 70 | sed -n '/^#define ZIP_ER_/ s/.*\/\* . \([^*]*\) \*\// "\1",/p' "$1" \ 71 | >> "$2.$$" || exit 1 72 | 73 | cat <> "$2.$$" || exit 1 74 | }; 75 | 76 | const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]); 77 | 78 | #define N ZIP_ET_NONE 79 | #define S ZIP_ET_SYS 80 | #define Z ZIP_ET_ZLIB 81 | 82 | const int _zip_err_type[] = { 83 | EOF 84 | 85 | sed -n '/^#define ZIP_ER_/ s/.*\/\* \(.\) \([^*]*\) \*\// \1,/p' "$1" \ 86 | >> "$2.$$" || exit 1 87 | 88 | echo '};' >> "$2.$$" || exit 1 89 | 90 | mv "$2.$$" "$2" || exit 1 91 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_set_archive_comment.mdoc: -------------------------------------------------------------------------------- 1 | .\" $NiH: zip_set_archive_comment.mdoc,v 1.2 2006/04/23 14:57:12 wiz Exp $ 2 | .\" 3 | .\" zip_set_archive_comment.mdoc -- set zip archive comment 4 | .\" Copyright (C) 2006 Dieter Baron and Thomas Klausner 5 | .\" 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. 7 | .\" The authors can be contacted at 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd April 23, 2006 35 | .Dt ZIP_SET_ARCHIVE_COMMENT 3 36 | .Os 37 | .Sh NAME 38 | .Nm zip_set_archive_comment 39 | .Nd set zip archive comment 40 | .Sh LIBRARY 41 | libzip (-lzip) 42 | .Sh SYNOPSIS 43 | .In zip.h 44 | .Ft int 45 | .Fn zip_set_archive_comment "struct zip *archive" \ 46 | "const char *comment" "int *lenp" 47 | .Sh DESCRIPTION 48 | The 49 | .Fn zip_set_archive_comment 50 | function sets the comment for the entire zip archive. 51 | If 52 | .Ar comment 53 | is 54 | .Dv NULL 55 | and 56 | .Ar len 57 | is 0, the archive comment will be removed. 58 | .Sh RETURN VALUES 59 | Upon successful completion 0 is returned. 60 | Otherwise, \-1 is returned and the error information in 61 | .Ar archive 62 | is set to indicate the error. 63 | .Sh ERRORS 64 | .Fn zip_set_archive_comment 65 | fails if: 66 | .Bl -tag -width Er 67 | .It Bq Er ZIP_ER_INVAL 68 | .Ar len 69 | is less than 0 or longer than the maximum comment length in a zip file 70 | (65535). 71 | .It Bq Er ZIP_ER_MEMORY 72 | Required memory could not be allocated. 73 | .El 74 | .Sh SEE ALSO 75 | .Xr libzip 3 , 76 | .Xr zip_get_archive_comment 3 , 77 | .Xr zip_get_file_comment 3 , 78 | .Xr zip_set_file_comment 3 79 | .Sh AUTHORS 80 | .An -nosplit 81 | .An Dieter Baron Aq dillo@giga.or.at 82 | and 83 | .An Thomas Klausner Aq tk@giga.or.at 84 | -------------------------------------------------------------------------------- /libzip-0.7.1/TODO: -------------------------------------------------------------------------------- 1 | * php windows fixes: 2 | . zip_close: close za->zp before rename, reopen on error 3 | * add functions to: 4 | . set compression method for new/changed entry 5 | . set last modification time for entry 6 | . read/set EAs 7 | . parse/create some EAs? 8 | . read/set ASCII file flag 9 | * do not compress if storing is smaller 10 | * zip_open: check whether file can be created and fail if not 11 | ------------------------------------------------ API ideas 12 | struct zip *zip_open_encrypted(const char *path, int flags, 13 | const char *password, int *errorp); 14 | void zip_set_default_password(struct zip *archive, const char *password); 15 | (NULL for unsetting) 16 | 17 | struct zip_file *zip_fopen_encrypted(struct zip *archive, 18 | const char *fname, int flags, 19 | const char *password); 20 | struct zip_file *zip_fopen_index_encrypted(struct zip *archive, 21 | int index, int flags, 22 | const char *password); 23 | 24 | int zip_set_encryption(struct zip *archive, int idx, int method, 25 | const char *password); 26 | void zip_set_archive_encryption(struct zip *archive, int encryption_method, 27 | const char *password); 28 | 29 | struct zip_source *zip_source_writable(struct zip *archive); 30 | zip_source_write(struct zip_source *, const void *data, size_t len); 31 | zip_source_printf(struct zip_source *, const char *fmt, ...); 32 | /* maybe 33 | zip_source_vprintf(struct zip_source *, const char *fmt, va_list ap); 34 | */ 35 | ------------------------------------------------ others 36 | * regression tests (duplicate file names, unchange, .{200}) 37 | * zip_commit 38 | * zip_replace_zip: allow rewinding 39 | * API for extracting and setting extra fields 40 | * zipcmp: add option for file content comparison 41 | * support for zip64 (large file) 42 | 43 | * append to files (for self-extracting files) 44 | * add custom compression function support 45 | * zip_replace_zip: remember compression method, recompress if different speced 46 | * close even if error... 47 | * update-zip (instead of close, reopen) 48 | * support for old compression methods????? 49 | ------------------------------------------------ regression tests 50 | * (add, replace) 51 | add to empty zip 52 | add to existing zip 53 | add w/ existing file name [E] 54 | replace ok 55 | replace w/ illegal index [E] 56 | replace w/ deleted name [E] 57 | unchange added/replaced file 58 | * (close) 59 | copy zip file 60 | open copy 61 | rename, delete, replace, add w/ new name, add w/ deleted name 62 | close 63 | zipcmp copy expected 64 | remove copy 65 | * (delete) 66 | * (error_get) 67 | * (error_get_sys_type) 68 | * (error_to_str) 69 | * (file_error_get) 70 | * (file_strerror) 71 | * (fopen_index) 72 | illegal index 73 | * (get_name) 74 | * (get_num_files) 75 | * (rename) 76 | * (replace) 77 | * (source_buffer) 78 | * (source_file) 79 | * (source_filep) 80 | * (source_free) 81 | * (source_function) 82 | * (source_zip) 83 | * (stat) 84 | * (stat_index) 85 | * (strerror) 86 | * (unchange) 87 | * (unchange_all) 88 | -------------------------------------------------------------------------------- /libzip-0.7.1/regress/get_comment.c: -------------------------------------------------------------------------------- 1 | /* 2 | $NiH: get_comment.c,v 1.4 2006/05/09 23:55:31 wiz Exp $ 3 | 4 | comment.c -- test cases for file and archive comments 5 | Copyright (C) 2006 Dieter Baron and Thomas Klausner 6 | 7 | This file is part of libzip, a library to manipulate ZIP archives. 8 | The authors can be contacted at 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 1. Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the 18 | distribution. 19 | 3. The names of the authors may not be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "zip.h" 44 | 45 | const char *prg; 46 | 47 | int 48 | main(int argc, char *argv[]) 49 | { 50 | const char *archive; 51 | struct zip *za; 52 | char buf[100]; 53 | int err; 54 | const char *com; 55 | int i, len; 56 | 57 | prg = argv[0]; 58 | 59 | if (argc != 2) { 60 | fprintf(stderr, "usage: %s archive\n", prg); 61 | return 1; 62 | } 63 | 64 | archive = argv[1]; 65 | 66 | if ((za=zip_open(archive, 0, &err)) == NULL) { 67 | zip_error_to_str(buf, sizeof(buf), err, errno); 68 | fprintf(stderr,"%s: can't open zip archive `%s': %s\n", prg, 69 | archive, buf); 70 | return 1; 71 | } 72 | 73 | if ((com=zip_get_archive_comment(za, &len, 0)) == NULL) 74 | printf("No archive comment\n"); 75 | else 76 | printf("Archive comment: %.*s\n", len, com); 77 | 78 | for (i=0; i 8 | .\" 9 | .\" Redistribution and use in source and binary forms, with or without 10 | .\" modification, are permitted provided that the following conditions 11 | .\" are met: 12 | .\" 1. Redistributions of source code must retain the above copyright 13 | .\" notice, this list of conditions and the following disclaimer. 14 | .\" 2. Redistributions in binary form must reproduce the above copyright 15 | .\" notice, this list of conditions and the following disclaimer in 16 | .\" the documentation and/or other materials provided with the 17 | .\" distribution. 18 | .\" 3. The names of the authors may not be used to endorse or promote 19 | .\" products derived from this software without specific prior 20 | .\" written permission. 21 | .\" 22 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 23 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | .\" 34 | .Dd December 22, 2004 35 | .Dt ZIPMERGE 1 36 | .Os 37 | .Sh NAME 38 | .Nm zipmerge 39 | .Nd merge zip archives 40 | .Sh SYNOPSIS 41 | .Nm 42 | .Op Fl DhIiSsV 43 | .Ar target-zip 44 | .Ar source-zip Op Ar source-zip ... 45 | .Sh DESCRIPTION 46 | .Nm 47 | merges the source zip archives 48 | .Ar source-zip 49 | into the target zip archive 50 | .Ar target-zip . 51 | By default, files in the source zip archives overwrite 52 | existing files of the same name in the target zip archive. 53 | .Pp 54 | Supported options: 55 | .Bl -tag -width MMM 56 | .It Fl D 57 | Ignore directory components in file name comparisons. 58 | .It Fl h 59 | Display a short help message and exit. 60 | .It Fl I 61 | Ignore case in file name comparisons 62 | .It Fl i 63 | Ask before overwriting files. 64 | See also 65 | .Fl s . 66 | .It Fl S 67 | Do not overwrite files that have the same size and 68 | CRC32 in both the source and target archives. 69 | .It Fl s 70 | When 71 | .Fl i 72 | is given, do not before overwriting files that have the same size 73 | and CRC32. 74 | .It Fl V 75 | Display version information and exit. 76 | .El 77 | .Sh EXIT STATUS 78 | .Nm 79 | exits 0 on success and \*[Gt]1 if an error code. 80 | .Sh SEE ALSO 81 | .Xr zipcmp 1 , 82 | .Xr libzip 3 83 | .Sh AUTHORS 84 | .An -nosplit 85 | .An Dieter Baron Aq dillo@giga.or.at 86 | and 87 | .An Thomas Klausner Aq tk@giga.or.at 88 | -------------------------------------------------------------------------------- /libzip-0.7.1/man/zip_get_archive_comment.man: -------------------------------------------------------------------------------- 1 | .\" Converted with mdoc2man 0.2 2 | .\" from NiH: zip_get_archive_comment.mdoc,v 1.2 2006/04/23 13:06:29 wiz Exp 3 | .\" $NiH: zip_get_archive_comment.man,v 1.2 2006/04/23 13:30:30 wiz Exp $ 4 | .\" 5 | .\" zip_get_archive_comment.mdoc \-- get zip archive comment 6 | .\" Copyright (C) 2006 Dieter Baron and Thomas Klausner 7 | .\" 8 | .\" This file is part of libzip, a library to manipulate ZIP archives. 9 | .\" The authors can be contacted at 10 | .\" 11 | .\" Redistribution and use in source and binary forms, with or without 12 | .\" modification, are permitted provided that the following conditions 13 | .\" are met: 14 | .\" 1. Redistributions of source code must retain the above copyright 15 | .\" notice, this list of conditions and the following disclaimer. 16 | .\" 2. Redistributions in binary form must reproduce the above copyright 17 | .\" notice, this list of conditions and the following disclaimer in 18 | .\" the documentation and/or other materials provided with the 19 | .\" distribution. 20 | .\" 3. The names of the authors may not be used to endorse or promote 21 | .\" products derived from this software without specific prior 22 | .\" written permission. 23 | .\" 24 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 25 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 28 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | .\" 36 | .TH ZIP_GET_ARCHIVE_COMMENT 3 "April 23, 2006" NiH 37 | .SH "NAME" 38 | zip_get_archive_comment \- get zip archive comment 39 | .SH "LIBRARY" 40 | libzip (-lzip) 41 | .SH "SYNOPSIS" 42 | .In zip.h 43 | .Ft const char * 44 | .Fn zip_get_archive_comment "struct zip *archive" "int *lenp" "int flags" 45 | .SH "DESCRIPTION" 46 | The 47 | .Fn zip_get_archive_comment 48 | function returns the comment for the entire zip archive. 49 | This pointer should not be modified or 50 | free(3) 51 | Ap d. 52 | If 53 | \fBlenp\fR 54 | is not 55 | \fBNULL,\fR 56 | the integer to which it points will be set to the length of the 57 | comment. 58 | If 59 | \fBflags\fR 60 | is set to 61 | \fBZIP_FL_UNCHANGED,\fR 62 | the original unchanged comment is returned. 63 | .SH "RETURN VALUES" 64 | Upon successful completion, a pointer to the comment is returned, 65 | or 66 | \fBNULL\fR 67 | if there is no comment. 68 | .\" In case of an error, 69 | .\" \fBNULL\fR 70 | .\" is returned and the error code in 71 | .\" \fBarchive\fR 72 | .\" is set to indicate the error. 73 | .SH "SEE ALSO" 74 | libzip(3), 75 | zip_get_file_comment(3) 76 | .SH "AUTHORS" 77 | 78 | Dieter Baron 79 | and 80 | Thomas Klausner 81 | --------------------------------------------------------------------------------