base works on browser and laptop

This commit is contained in:
NurgazievichR committed 2025-04-07 17:58:33 +06:00
1 parent 17d3b0ce2c
commit a4d2b732aa
1177 files changed
+221998 -42

No files matched your search

@@ -0,0 +1,528 @@
#ifndef _HAD_ZIP_H
#define _HAD_ZIP_H
/*
zip.h -- exported declarations.
Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(__has_feature)
#if !__has_feature(nullability)
#define _Nullable
#define _Nonnull
#endif
#else
#define _Nullable
#define _Nonnull
#endif
#ifdef __cplusplus
extern "C" {
#if 0
} /* fix autoindent */
#endif
#endif
#include <zipconf.h>
#ifndef ZIP_EXTERN
#ifndef ZIP_STATIC
#ifdef _WIN32
#define ZIP_EXTERN __declspec(dllimport)
#elif defined(__GNUC__) && __GNUC__ >= 4
#define ZIP_EXTERN __attribute__((visibility("default")))
#else
#define ZIP_EXTERN
#endif
#else
#define ZIP_EXTERN
#endif
#endif
#ifndef ZIP_DEPRECATED
#if defined(__GNUC__) || defined(__clang__)
#define ZIP_DEPRECATED(x) __attribute__((deprecated(x)))
#elif defined(_MSC_VER)
#define ZIP_DEPRECATED(x) __declspec(deprecated(x))
#else
#define ZIP_DEPRECATED(x)
#endif
#endif
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
/* flags for zip_open */
#define ZIP_CREATE 1
#define ZIP_EXCL 2
#define ZIP_CHECKCONS 4
#define ZIP_TRUNCATE 8
#define ZIP_RDONLY 16
/* flags for zip_name_locate, zip_fopen, zip_stat, ... */
#define ZIP_FL_NOCASE 1u /* ignore case on name lookup */
#define ZIP_FL_NODIR 2u /* ignore directory component */
#define ZIP_FL_COMPRESSED 4u /* read compressed data */
#define ZIP_FL_UNCHANGED 8u /* use original data, ignoring changes */
/* 16u was ZIP_FL_RECOMPRESS, which is deprecated */
#define ZIP_FL_ENCRYPTED 32u /* read encrypted data (implies ZIP_FL_COMPRESSED) */
#define ZIP_FL_ENC_GUESS 0u /* guess string encoding (is default) */
#define ZIP_FL_ENC_RAW 64u /* get unmodified string */
#define ZIP_FL_ENC_STRICT 128u /* follow specification strictly */
#define ZIP_FL_LOCAL 256u /* in local header */
#define ZIP_FL_CENTRAL 512u /* in central directory */
/* 1024u reserved for internal use */
#define ZIP_FL_ENC_UTF_8 2048u /* string is UTF-8 encoded */
#define ZIP_FL_ENC_CP437 4096u /* string is CP437 encoded */
#define ZIP_FL_OVERWRITE 8192u /* zip_file_add: if file with name exists, overwrite (replace) it */
/* archive global flags flags */
#define ZIP_AFL_RDONLY 2u /* read only -- cannot be cleared */
#define ZIP_AFL_IS_TORRENTZIP 4u /* current archive is torrentzipped */
#define ZIP_AFL_WANT_TORRENTZIP 8u /* write archive in torrentzip format */
#define ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE 16u /* don't remove file if archive is empty */
/* create a new extra field */
#define ZIP_EXTRA_FIELD_ALL ZIP_UINT16_MAX
#define ZIP_EXTRA_FIELD_NEW ZIP_UINT16_MAX
/* length parameter to various functions */
#define ZIP_LENGTH_TO_END 0
#define ZIP_LENGTH_UNCHECKED (-2) /* only supported by zip_source_file and its variants */
/* libzip error codes */
#define ZIP_ER_OK 0 /* N No error */
#define ZIP_ER_MULTIDISK 1 /* N Multi-disk zip archives not supported */
#define ZIP_ER_RENAME 2 /* S Renaming temporary file failed */
#define ZIP_ER_CLOSE 3 /* S Closing zip archive failed */
#define ZIP_ER_SEEK 4 /* S Seek error */
#define ZIP_ER_READ 5 /* S Read error */
#define ZIP_ER_WRITE 6 /* S Write error */
#define ZIP_ER_CRC 7 /* N CRC error */
#define ZIP_ER_ZIPCLOSED 8 /* N Containing zip archive was closed */
#define ZIP_ER_NOENT 9 /* N No such file */
#define ZIP_ER_EXISTS 10 /* N File already exists */
#define ZIP_ER_OPEN 11 /* S Can't open file */
#define ZIP_ER_TMPOPEN 12 /* S Failure to create temporary file */
#define ZIP_ER_ZLIB 13 /* Z Zlib error */
#define ZIP_ER_MEMORY 14 /* N Malloc failure */
#define ZIP_ER_CHANGED 15 /* N Entry has been changed */
#define ZIP_ER_COMPNOTSUPP 16 /* N Compression method not supported */
#define ZIP_ER_EOF 17 /* N Premature end of file */
#define ZIP_ER_INVAL 18 /* N Invalid argument */
#define ZIP_ER_NOZIP 19 /* N Not a zip archive */
#define ZIP_ER_INTERNAL 20 /* N Internal error */
#define ZIP_ER_INCONS 21 /* L Zip archive inconsistent */
#define ZIP_ER_REMOVE 22 /* S Can't remove file */
#define ZIP_ER_DELETED 23 /* N Entry has been deleted */
#define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */
#define ZIP_ER_RDONLY 25 /* N Read-only archive */
#define ZIP_ER_NOPASSWD 26 /* N No password provided */
#define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */
#define ZIP_ER_OPNOTSUPP 28 /* N Operation not supported */
#define ZIP_ER_INUSE 29 /* N Resource still in use */
#define ZIP_ER_TELL 30 /* S Tell error */
#define ZIP_ER_COMPRESSED_DATA 31 /* N Compressed data invalid */
#define ZIP_ER_CANCELLED 32 /* N Operation cancelled */
#define ZIP_ER_DATA_LENGTH 33 /* N Unexpected length of data */
#define ZIP_ER_NOT_ALLOWED 34 /* N Not allowed in torrentzip */
#define ZIP_ER_TRUNCATED_ZIP 35 /* N Possibly truncated or corrupted zip archive */
/* type of system error value */
#define ZIP_ET_NONE 0 /* sys_err unused */
#define ZIP_ET_SYS 1 /* sys_err is errno */
#define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */
#define ZIP_ET_LIBZIP 3 /* sys_err is libzip error code */
/* compression methods */
#define ZIP_CM_DEFAULT -1 /* better of deflate or store */
#define ZIP_CM_STORE 0 /* stored (uncompressed) */
#define ZIP_CM_SHRINK 1 /* shrunk */
#define ZIP_CM_REDUCE_1 2 /* reduced with factor 1 */
#define ZIP_CM_REDUCE_2 3 /* reduced with factor 2 */
#define ZIP_CM_REDUCE_3 4 /* reduced with factor 3 */
#define ZIP_CM_REDUCE_4 5 /* reduced with factor 4 */
#define ZIP_CM_IMPLODE 6 /* imploded */
/* 7 - Reserved for Tokenizing compression algorithm */
#define ZIP_CM_DEFLATE 8 /* deflated */
#define ZIP_CM_DEFLATE64 9 /* deflate64 */
#define ZIP_CM_PKWARE_IMPLODE 10 /* PKWARE imploding */
/* 11 - Reserved by PKWARE */
#define ZIP_CM_BZIP2 12 /* compressed using BZIP2 algorithm */
/* 13 - Reserved by PKWARE */
#define ZIP_CM_LZMA 14 /* LZMA (EFS) */
/* 15-17 - Reserved by PKWARE */
#define ZIP_CM_TERSE 18 /* compressed using IBM TERSE (new) */
#define ZIP_CM_LZ77 19 /* IBM LZ77 z Architecture (PFS) */
/* 20 - old value for Zstandard */
#define ZIP_CM_LZMA2 33
#define ZIP_CM_ZSTD 93 /* Zstandard compressed data */
#define ZIP_CM_XZ 95 /* XZ compressed data */
#define ZIP_CM_JPEG 96 /* Compressed Jpeg data */
#define ZIP_CM_WAVPACK 97 /* WavPack compressed data */
#define ZIP_CM_PPMD 98 /* PPMd version I, Rev 1 */
/* encryption methods */
#define ZIP_EM_NONE 0 /* not encrypted */
#define ZIP_EM_TRAD_PKWARE 1 /* traditional PKWARE encryption */
#if 0 /* Strong Encryption Header not parsed yet */
#define ZIP_EM_DES 0x6601 /* strong encryption: DES */
#define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */
#define ZIP_EM_3DES_168 0x6603
#define ZIP_EM_3DES_112 0x6609
#define ZIP_EM_PKZIP_AES_128 0x660e
#define ZIP_EM_PKZIP_AES_192 0x660f
#define ZIP_EM_PKZIP_AES_256 0x6610
#define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */
#define ZIP_EM_RC4 0x6801
#endif
#define ZIP_EM_AES_128 0x0101 /* Winzip AES encryption */
#define ZIP_EM_AES_192 0x0102
#define ZIP_EM_AES_256 0x0103
#define ZIP_EM_UNKNOWN 0xffff /* unknown algorithm */
#define ZIP_OPSYS_DOS 0x00u
#define ZIP_OPSYS_AMIGA 0x01u
#define ZIP_OPSYS_OPENVMS 0x02u
#define ZIP_OPSYS_UNIX 0x03u
#define ZIP_OPSYS_VM_CMS 0x04u
#define ZIP_OPSYS_ATARI_ST 0x05u
#define ZIP_OPSYS_OS_2 0x06u
#define ZIP_OPSYS_MACINTOSH 0x07u
#define ZIP_OPSYS_Z_SYSTEM 0x08u
#define ZIP_OPSYS_CPM 0x09u
#define ZIP_OPSYS_WINDOWS_NTFS 0x0au
#define ZIP_OPSYS_MVS 0x0bu
#define ZIP_OPSYS_VSE 0x0cu
#define ZIP_OPSYS_ACORN_RISC 0x0du
#define ZIP_OPSYS_VFAT 0x0eu
#define ZIP_OPSYS_ALTERNATE_MVS 0x0fu
#define ZIP_OPSYS_BEOS 0x10u
#define ZIP_OPSYS_TANDEM 0x11u
#define ZIP_OPSYS_OS_400 0x12u
#define ZIP_OPSYS_OS_X 0x13u
#define ZIP_OPSYS_DEFAULT ZIP_OPSYS_UNIX
enum zip_source_cmd {
ZIP_SOURCE_OPEN, /* prepare for reading */
ZIP_SOURCE_READ, /* read data */
ZIP_SOURCE_CLOSE, /* reading is done */
ZIP_SOURCE_STAT, /* get meta information */
ZIP_SOURCE_ERROR, /* get error information */
ZIP_SOURCE_FREE, /* cleanup and free resources */
ZIP_SOURCE_SEEK, /* set position for reading */
ZIP_SOURCE_TELL, /* get read position */
ZIP_SOURCE_BEGIN_WRITE, /* prepare for writing */
ZIP_SOURCE_COMMIT_WRITE, /* writing is done */
ZIP_SOURCE_ROLLBACK_WRITE, /* discard written changes */
ZIP_SOURCE_WRITE, /* write data */
ZIP_SOURCE_SEEK_WRITE, /* set position for writing */
ZIP_SOURCE_TELL_WRITE, /* get write position */
ZIP_SOURCE_SUPPORTS, /* check whether source supports command */
ZIP_SOURCE_REMOVE, /* remove file */
ZIP_SOURCE_RESERVED_1, /* previously used internally */
ZIP_SOURCE_BEGIN_WRITE_CLONING, /* like ZIP_SOURCE_BEGIN_WRITE, but keep part of original file */
ZIP_SOURCE_ACCEPT_EMPTY, /* whether empty files are valid archives */
ZIP_SOURCE_GET_FILE_ATTRIBUTES, /* get additional file attributes */
ZIP_SOURCE_SUPPORTS_REOPEN, /* allow reading from changed entry */
ZIP_SOURCE_GET_DOS_TIME /* get last modification time in DOS format */
};
typedef enum zip_source_cmd zip_source_cmd_t;
#define ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd) (((zip_int64_t)1) << (cmd))
#define ZIP_SOURCE_CHECK_SUPPORTED(supported, cmd) (((supported) & ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd)) != 0)
/* clang-format off */
#define ZIP_SOURCE_SUPPORTS_READABLE (ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_OPEN) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_READ) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_CLOSE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_STAT) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ERROR) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_FREE))
#define ZIP_SOURCE_SUPPORTS_SEEKABLE (ZIP_SOURCE_SUPPORTS_READABLE \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SUPPORTS))
#define ZIP_SOURCE_SUPPORTS_WRITABLE (ZIP_SOURCE_SUPPORTS_SEEKABLE \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_BEGIN_WRITE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_COMMIT_WRITE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_ROLLBACK_WRITE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_WRITE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK_WRITE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL_WRITE) \
| ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_REMOVE))
/* clang-format on */
/* for use by sources */
struct zip_source_args_seek {
zip_int64_t offset;
int whence;
};
typedef struct zip_source_args_seek zip_source_args_seek_t;
#define ZIP_SOURCE_GET_ARGS(type, data, len, error) ((len) < sizeof(type) ? zip_error_set((error), ZIP_ER_INVAL, 0), (type *)NULL : (type *)(data))
/* error information */
/* use zip_error_*() to access */
struct zip_error {
int zip_err; /* libzip error code (ZIP_ER_*) */
int sys_err; /* copy of errno (E*) or zlib error code */
char *_Nullable str; /* string representation or NULL */
};
#define ZIP_STAT_NAME 0x0001u
#define ZIP_STAT_INDEX 0x0002u
#define ZIP_STAT_SIZE 0x0004u
#define ZIP_STAT_COMP_SIZE 0x0008u
#define ZIP_STAT_MTIME 0x0010u
#define ZIP_STAT_CRC 0x0020u
#define ZIP_STAT_COMP_METHOD 0x0040u
#define ZIP_STAT_ENCRYPTION_METHOD 0x0080u
#define ZIP_STAT_FLAGS 0x0100u
struct zip_stat {
zip_uint64_t valid; /* which fields have valid values */
const char *_Nullable name; /* name of the file */
zip_uint64_t index; /* index within archive */
zip_uint64_t size; /* size of file (uncompressed) */
zip_uint64_t comp_size; /* size of file (compressed) */
time_t mtime; /* modification time */
zip_uint32_t crc; /* crc of file data */
zip_uint16_t comp_method; /* compression method used */
zip_uint16_t encryption_method; /* encryption method used */
zip_uint32_t flags; /* reserved for future use */
};
struct zip_buffer_fragment {
zip_uint8_t *_Nonnull data;
zip_uint64_t length;
};
struct zip_file_attributes {
zip_uint64_t valid; /* which fields have valid values */
zip_uint8_t version; /* version of this struct, currently 1 */
zip_uint8_t host_system; /* host system on which file was created */
zip_uint8_t ascii; /* flag whether file is ASCII text */
zip_uint8_t version_needed; /* minimum version needed to extract file */
zip_uint32_t external_file_attributes; /* external file attributes (host-system specific) */
zip_uint16_t general_purpose_bit_flags; /* general purpose big flags, only some bits are honored */
zip_uint16_t general_purpose_bit_mask; /* which bits in general_purpose_bit_flags are valid */
};
#define ZIP_FILE_ATTRIBUTES_HOST_SYSTEM 0x0001u
#define ZIP_FILE_ATTRIBUTES_ASCII 0x0002u
#define ZIP_FILE_ATTRIBUTES_VERSION_NEEDED 0x0004u
#define ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES 0x0008u
#define ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS 0x0010u
struct zip;
struct zip_file;
struct zip_source;
typedef struct zip zip_t;
typedef struct zip_error zip_error_t;
typedef struct zip_file zip_file_t;
typedef struct zip_file_attributes zip_file_attributes_t;
typedef struct zip_source zip_source_t;
typedef struct zip_stat zip_stat_t;
typedef struct zip_buffer_fragment zip_buffer_fragment_t;
typedef zip_uint32_t zip_flags_t;
typedef zip_int64_t (*zip_source_callback)(void *_Nullable, void *_Nullable, zip_uint64_t, zip_source_cmd_t);
typedef zip_int64_t (*zip_source_layered_callback)(zip_source_t *_Nonnull, void *_Nullable, void *_Nullable, zip_uint64_t, enum zip_source_cmd);
typedef void (*zip_progress_callback)(zip_t *_Nonnull, double, void *_Nullable);
typedef int (*zip_cancel_callback)(zip_t *_Nonnull, void *_Nullable);
#ifndef ZIP_DISABLE_DEPRECATED
#define ZIP_FL_RECOMPRESS 16u /* force recompression of data */
typedef void (*zip_progress_callback_t)(double);
ZIP_DEPRECATED("use 'zip_register_progress_callback_with_state' instead") ZIP_EXTERN void zip_register_progress_callback(zip_t *_Nonnull, zip_progress_callback_t _Nullable);
ZIP_DEPRECATED("use 'zip_file_add' instead") ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull);
ZIP_DEPRECATED("use 'zip_dir_add' instead") ZIP_EXTERN zip_int64_t zip_add_dir(zip_t *_Nonnull, const char *_Nonnull);
ZIP_DEPRECATED("use 'zip_file_get_comment' instead") ZIP_EXTERN const char *_Nullable zip_get_file_comment(zip_t *_Nonnull, zip_uint64_t, int *_Nullable, int);
ZIP_DEPRECATED("use 'zip_get_num_entries' instead") ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull);
ZIP_DEPRECATED("use 'zip_file_rename' instead") ZIP_EXTERN int zip_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull);
ZIP_DEPRECATED("use 'zip_file_replace' instead") ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull);
ZIP_DEPRECATED("use 'zip_file_set_comment' instead") ZIP_EXTERN int zip_set_file_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, int);
ZIP_DEPRECATED("use 'zip_error_init_with_code' and 'zip_error_system_type' instead") ZIP_EXTERN int zip_error_get_sys_type(int);
ZIP_DEPRECATED("use 'zip_get_error' instead") ZIP_EXTERN void zip_error_get(zip_t *_Nonnull, int *_Nullable, int *_Nullable);
ZIP_DEPRECATED("use 'zip_error_strerror' instead") ZIP_EXTERN int zip_error_to_str(char *_Nonnull, zip_uint64_t, int, int);
ZIP_DEPRECATED("use 'zip_file_get_error' instead") ZIP_EXTERN void zip_file_error_get(zip_file_t *_Nonnull, int *_Nullable, int *_Nullable);
ZIP_DEPRECATED("use 'zip_source_zip_file' instead") ZIP_EXTERN zip_source_t *_Nullable zip_source_zip(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t);
ZIP_DEPRECATED("use 'zip_source_zip_file_create' instead") ZIP_EXTERN zip_source_t *_Nullable zip_source_zip_create(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
#endif
ZIP_EXTERN int zip_close(zip_t *_Nonnull);
ZIP_EXTERN int zip_delete(zip_t *_Nonnull, zip_uint64_t);
ZIP_EXTERN zip_int64_t zip_dir_add(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t);
ZIP_EXTERN void zip_discard(zip_t *_Nonnull);
ZIP_EXTERN zip_error_t *_Nonnull zip_get_error(zip_t *_Nonnull);
ZIP_EXTERN void zip_error_clear(zip_t *_Nonnull);
ZIP_EXTERN int zip_error_code_zip(const zip_error_t *_Nonnull);
ZIP_EXTERN int zip_error_code_system(const zip_error_t *_Nonnull);
ZIP_EXTERN void zip_error_fini(zip_error_t *_Nonnull);
ZIP_EXTERN void zip_error_init(zip_error_t *_Nonnull);
ZIP_EXTERN void zip_error_init_with_code(zip_error_t *_Nonnull, int);
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int);
ZIP_EXTERN void zip_error_set_from_source(zip_error_t *_Nonnull, zip_source_t *_Nullable);
ZIP_EXTERN const char *_Nonnull zip_error_strerror(zip_error_t *_Nonnull);
ZIP_EXTERN int zip_error_system_type(const zip_error_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_error_to_data(const zip_error_t *_Nonnull, void *_Nonnull, zip_uint64_t);
ZIP_EXTERN int zip_fclose(zip_file_t *_Nonnull);
ZIP_EXTERN zip_t *_Nullable zip_fdopen(int, int, int *_Nullable);
ZIP_EXTERN zip_int64_t zip_file_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull, zip_flags_t);
ZIP_EXTERN void zip_file_attributes_init(zip_file_attributes_t *_Nonnull);
ZIP_EXTERN void zip_file_error_clear(zip_file_t *_Nonnull);
ZIP_EXTERN int zip_file_extra_field_delete(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_flags_t);
ZIP_EXTERN int zip_file_extra_field_delete_by_id(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_flags_t);
ZIP_EXTERN int zip_file_extra_field_set(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, const zip_uint8_t *_Nullable, zip_uint16_t, zip_flags_t);
ZIP_EXTERN zip_int16_t zip_file_extra_fields_count(zip_t *_Nonnull, zip_uint64_t, zip_flags_t);
ZIP_EXTERN zip_int16_t zip_file_extra_fields_count_by_id(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_flags_t);
ZIP_EXTERN const zip_uint8_t *_Nullable zip_file_extra_field_get(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t *_Nullable, zip_uint16_t *_Nullable, zip_flags_t);
ZIP_EXTERN const zip_uint8_t *_Nullable zip_file_extra_field_get_by_id(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_uint16_t *_Nullable, zip_flags_t);
ZIP_EXTERN const char *_Nullable zip_file_get_comment(zip_t *_Nonnull, zip_uint64_t, zip_uint32_t *_Nullable, zip_flags_t);
ZIP_EXTERN zip_error_t *_Nonnull zip_file_get_error(zip_file_t *_Nonnull);
ZIP_EXTERN int zip_file_get_external_attributes(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint8_t *_Nullable, zip_uint32_t *_Nullable);
ZIP_EXTERN int zip_file_is_seekable(zip_file_t *_Nonnull);
ZIP_EXTERN int zip_file_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull, zip_flags_t);
ZIP_EXTERN int zip_file_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull, zip_flags_t);
ZIP_EXTERN int zip_file_set_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, zip_uint16_t, zip_flags_t);
ZIP_EXTERN int zip_file_set_dostime(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, zip_uint16_t, zip_flags_t);
ZIP_EXTERN int zip_file_set_encryption(zip_t *_Nonnull, zip_uint64_t, zip_uint16_t, const char *_Nullable);
ZIP_EXTERN int zip_file_set_external_attributes(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint8_t, zip_uint32_t);
ZIP_EXTERN int zip_file_set_mtime(zip_t *_Nonnull, zip_uint64_t, time_t, zip_flags_t);
ZIP_EXTERN const char *_Nonnull zip_file_strerror(zip_file_t *_Nonnull);
ZIP_EXTERN zip_file_t *_Nullable zip_fopen(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t);
ZIP_EXTERN zip_file_t *_Nullable zip_fopen_encrypted(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t, const char *_Nullable);
ZIP_EXTERN zip_file_t *_Nullable zip_fopen_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t);
ZIP_EXTERN zip_file_t *_Nullable zip_fopen_index_encrypted(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, const char *_Nullable);
ZIP_EXTERN zip_int64_t zip_fread(zip_file_t *_Nonnull, void *_Nonnull, zip_uint64_t);
ZIP_EXTERN zip_int8_t zip_fseek(zip_file_t *_Nonnull, zip_int64_t, int);
ZIP_EXTERN zip_int64_t zip_ftell(zip_file_t *_Nonnull);
ZIP_EXTERN const char *_Nullable zip_get_archive_comment(zip_t *_Nonnull, int *_Nullable, zip_flags_t);
ZIP_EXTERN int zip_get_archive_flag(zip_t *_Nonnull, zip_flags_t, zip_flags_t);
ZIP_EXTERN const char *_Nullable zip_get_name(zip_t *_Nonnull, zip_uint64_t, zip_flags_t);
ZIP_EXTERN zip_int64_t zip_get_num_entries(zip_t *_Nonnull, zip_flags_t);
ZIP_EXTERN const char *_Nonnull zip_libzip_version(void);
ZIP_EXTERN zip_int64_t zip_name_locate(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t);
ZIP_EXTERN zip_t *_Nullable zip_open(const char *_Nonnull, int, int *_Nullable);
ZIP_EXTERN zip_t *_Nullable zip_open_from_source(zip_source_t *_Nonnull, int, zip_error_t *_Nullable);
ZIP_EXTERN int zip_register_progress_callback_with_state(zip_t *_Nonnull, double, zip_progress_callback _Nullable, void (*_Nullable)(void *_Nullable), void *_Nullable);
ZIP_EXTERN int zip_register_cancel_callback_with_state(zip_t *_Nonnull, zip_cancel_callback _Nullable, void (*_Nullable)(void *_Nullable), void *_Nullable);
ZIP_EXTERN int zip_set_archive_comment(zip_t *_Nonnull, const char *_Nullable, zip_uint16_t);
ZIP_EXTERN int zip_set_archive_flag(zip_t *_Nonnull, zip_flags_t, int);
ZIP_EXTERN int zip_set_default_password(zip_t *_Nonnull, const char *_Nullable);
ZIP_EXTERN int zip_set_file_compression(zip_t *_Nonnull, zip_uint64_t, zip_int32_t, zip_uint32_t);
ZIP_EXTERN int zip_source_begin_write(zip_source_t *_Nonnull);
ZIP_EXTERN int zip_source_begin_write_cloning(zip_source_t *_Nonnull, zip_uint64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer(zip_t *_Nonnull, const void *_Nullable, zip_uint64_t, int);
ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer_create(const void *_Nullable, zip_uint64_t, int, zip_error_t *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer_fragment(zip_t *_Nonnull, const zip_buffer_fragment_t *_Nonnull, zip_uint64_t, int);
ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer_fragment_create(const zip_buffer_fragment_t *_Nullable, zip_uint64_t, int, zip_error_t *_Nullable);
ZIP_EXTERN int zip_source_close(zip_source_t *_Nonnull);
ZIP_EXTERN int zip_source_commit_write(zip_source_t *_Nonnull);
ZIP_EXTERN zip_error_t *_Nonnull zip_source_error(zip_source_t *_Nonnull);
ZIP_EXTERN zip_source_t *_Nullable zip_source_file(zip_t *_Nonnull, const char *_Nonnull, zip_uint64_t, zip_int64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_file_create(const char *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_filep(zip_t *_Nonnull, FILE *_Nonnull, zip_uint64_t, zip_int64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_filep_create(FILE *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
ZIP_EXTERN void zip_source_free(zip_source_t *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_function(zip_t *_Nonnull, zip_source_callback _Nonnull, void *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_function_create(zip_source_callback _Nonnull, void *_Nullable, zip_error_t *_Nullable);
ZIP_EXTERN int zip_source_get_file_attributes(zip_source_t *_Nonnull, zip_file_attributes_t *_Nonnull);
ZIP_EXTERN int zip_source_is_deleted(zip_source_t *_Nonnull);
ZIP_EXTERN int zip_source_is_seekable(zip_source_t *_Nonnull);
ZIP_EXTERN void zip_source_keep(zip_source_t *_Nonnull);
ZIP_EXTERN zip_source_t *_Nullable zip_source_layered(zip_t *_Nullable, zip_source_t *_Nonnull, zip_source_layered_callback _Nonnull, void *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_layered_create(zip_source_t *_Nonnull, zip_source_layered_callback _Nonnull, void *_Nullable, zip_error_t *_Nullable);
ZIP_EXTERN zip_int64_t zip_source_make_command_bitmap(zip_source_cmd_t, ...);
ZIP_EXTERN int zip_source_open(zip_source_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_source_pass_to_lower_layer(zip_source_t *_Nonnull, void *_Nullable, zip_uint64_t, zip_source_cmd_t);
ZIP_EXTERN zip_int64_t zip_source_read(zip_source_t *_Nonnull, void *_Nonnull, zip_uint64_t);
ZIP_EXTERN void zip_source_rollback_write(zip_source_t *_Nonnull);
ZIP_EXTERN int zip_source_seek(zip_source_t *_Nonnull, zip_int64_t, int);
ZIP_EXTERN zip_int64_t zip_source_seek_compute_offset(zip_uint64_t, zip_uint64_t, void *_Nonnull, zip_uint64_t, zip_error_t *_Nullable);
ZIP_EXTERN int zip_source_seek_write(zip_source_t *_Nonnull, zip_int64_t, int);
ZIP_EXTERN int zip_source_stat(zip_source_t *_Nonnull, zip_stat_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_source_tell(zip_source_t *_Nonnull);
ZIP_EXTERN zip_int64_t zip_source_tell_write(zip_source_t *_Nonnull);
#ifdef _WIN32
ZIP_EXTERN zip_source_t *_Nullable zip_source_win32a(zip_t *_Nonnull, const char *_Nonnull, zip_uint64_t, zip_int64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_win32a_create(const char *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_win32handle(zip_t *_Nonnull, void *_Nonnull, zip_uint64_t, zip_int64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_win32handle_create(void *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_win32w(zip_t *_Nonnull, const wchar_t *_Nonnull, zip_uint64_t, zip_int64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_win32w_create(const wchar_t *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
#endif
ZIP_EXTERN zip_source_t *_Nullable zip_source_window_create(zip_source_t *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable);
ZIP_EXTERN zip_int64_t zip_source_write(zip_source_t *_Nonnull, const void *_Nullable, zip_uint64_t);
ZIP_EXTERN zip_source_t *_Nullable zip_source_zip_file(zip_t *_Nonnull, zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, const char *_Nullable);
ZIP_EXTERN zip_source_t *_Nullable zip_source_zip_file_create(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_uint64_t, zip_int64_t, const char *_Nullable, zip_error_t *_Nullable);
ZIP_EXTERN int zip_stat(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t, zip_stat_t *_Nonnull);
ZIP_EXTERN int zip_stat_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_stat_t *_Nonnull);
ZIP_EXTERN void zip_stat_init(zip_stat_t *_Nonnull);
ZIP_EXTERN const char *_Nonnull zip_strerror(zip_t *_Nonnull);
ZIP_EXTERN int zip_unchange(zip_t *_Nonnull, zip_uint64_t);
ZIP_EXTERN int zip_unchange_all(zip_t *_Nonnull);
ZIP_EXTERN int zip_unchange_archive(zip_t *_Nonnull);
ZIP_EXTERN int zip_compression_method_supported(zip_int32_t method, int compress);
ZIP_EXTERN int zip_encryption_method_supported(zip_uint16_t method, int encode);
#ifdef __cplusplus
}
#endif
#endif /* _HAD_ZIP_H */
@@ -0,0 +1,48 @@
#ifndef _HAD_ZIPCONF_H
#define _HAD_ZIPCONF_H
/*
zipconf.h -- platform specific include file
This file was generated automatically by CMake
based on ../cmake-zipconf.h.in.
*/
#define LIBZIP_VERSION "1.11.3"
#define LIBZIP_VERSION_MAJOR 1
#define LIBZIP_VERSION_MINOR 11
#define LIBZIP_VERSION_MICRO 3
/* #undef ZIP_STATIC */
#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t zip_int8_t;
typedef uint8_t zip_uint8_t;
typedef int16_t zip_int16_t;
typedef uint16_t zip_uint16_t;
typedef int32_t zip_int32_t;
typedef uint32_t zip_uint32_t;
typedef int64_t zip_int64_t;
typedef uint64_t zip_uint64_t;
#define ZIP_INT8_MIN (-ZIP_INT8_MAX-1)
#define ZIP_INT8_MAX 0x7f
#define ZIP_UINT8_MAX 0xff
#define ZIP_INT16_MIN (-ZIP_INT16_MAX-1)
#define ZIP_INT16_MAX 0x7fff
#define ZIP_UINT16_MAX 0xffff
#define ZIP_INT32_MIN (-ZIP_INT32_MAX-1L)
#define ZIP_INT32_MAX 0x7fffffffL
#define ZIP_UINT32_MAX 0xffffffffLU
#define ZIP_INT64_MIN (-ZIP_INT64_MAX-1LL)
#define ZIP_INT64_MAX 0x7fffffffffffffffLL
#define ZIP_UINT64_MAX 0xffffffffffffffffULL
#endif /* zipconf.h */
@@ -0,0 +1,43 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "1.11.3")
if (PACKAGE_FIND_VERSION_RANGE)
# Package version must be in the requested version range
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
else()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4")
math(EXPR installedBits "4 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
@@ -0,0 +1,69 @@
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was libzip-config.cmake.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
####################################################################################
# We need to supply transitive dependencies if this config is for a static library
set(IS_SHARED ON)
if (NOT IS_SHARED)
include(CMakeFindDependencyMacro)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/modules")
set(ENABLE_BZIP2 FALSE)
set(ENABLE_LZMA FALSE)
set(ENABLE_ZSTD FALSE)
set(ENABLE_GNUTLS FALSE)
set(ENABLE_MBEDTLS FALSE)
set(ENABLE_OPENSSL FALSE)
find_dependency(ZLIB 1.1.2)
if(ENABLE_BZIP2)
find_dependency(BZip2)
endif()
if(ENABLE_LZMA)
find_dependency(LibLZMA 5.2)
endif()
if(ENABLE_ZSTD)
find_dependency(zstd 1.3.6)
endif()
if(ENABLE_GNUTLS)
find_dependency(Nettle 3.0)
find_dependency(GnuTLS)
endif()
if(ENABLE_MBEDTLS)
find_dependency(MbedTLS 1.0)
endif()
if(ENABLE_OPENSSL)
find_dependency(OpenSSL)
endif()
endif()
# Provide all our library targets to users.
include("${CMAKE_CURRENT_LIST_DIR}/libzip-targets.cmake")
check_required_components(libzip)
@@ -0,0 +1,46 @@
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "libzip::zip" for configuration ""
set_property(TARGET libzip::zip APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(libzip::zip PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_NOCONFIG "C"
IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/libzip.a"
)
list(APPEND _cmake_import_check_targets libzip::zip )
list(APPEND _cmake_import_check_files_for_libzip::zip "${_IMPORT_PREFIX}/lib/libzip.a" )
# Import target "libzip::zipcmp" for configuration ""
set_property(TARGET libzip::zipcmp APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(libzip::zipcmp PROPERTIES
IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/zipcmp.js"
)
list(APPEND _cmake_import_check_targets libzip::zipcmp )
list(APPEND _cmake_import_check_files_for_libzip::zipcmp "${_IMPORT_PREFIX}/bin/zipcmp.js" )
# Import target "libzip::zipmerge" for configuration ""
set_property(TARGET libzip::zipmerge APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(libzip::zipmerge PROPERTIES
IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/zipmerge.js"
)
list(APPEND _cmake_import_check_targets libzip::zipmerge )
list(APPEND _cmake_import_check_files_for_libzip::zipmerge "${_IMPORT_PREFIX}/bin/zipmerge.js" )
# Import target "libzip::ziptool" for configuration ""
set_property(TARGET libzip::ziptool APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(libzip::ziptool PROPERTIES
IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/ziptool.js"
)
list(APPEND _cmake_import_check_targets libzip::ziptool )
list(APPEND _cmake_import_check_files_for_libzip::ziptool "${_IMPORT_PREFIX}/bin/ziptool.js" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
@@ -0,0 +1,116 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
message(FATAL_ERROR "CMake >= 2.8.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8.3")
message(FATAL_ERROR "CMake >= 2.8.3 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.26)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_cmake_targets_defined "")
set(_cmake_targets_not_defined "")
set(_cmake_expected_targets "")
foreach(_cmake_expected_target IN ITEMS libzip::zip libzip::zipcmp libzip::zipmerge libzip::ziptool)
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
if(TARGET "${_cmake_expected_target}")
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
else()
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
endif()
endforeach()
unset(_cmake_expected_target)
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)
unset(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT _cmake_targets_defined STREQUAL "")
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
endif()
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
# Create imported target libzip::zip
add_library(libzip::zip STATIC IMPORTED)
set_target_properties(libzip::zip PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ZLIB::ZLIB>"
)
# Create imported target libzip::zipcmp
add_executable(libzip::zipcmp IMPORTED)
# Create imported target libzip::zipmerge
add_executable(libzip::zipmerge IMPORTED)
# Create imported target libzip::ziptool
add_executable(libzip::ziptool IMPORTED)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
endif()
# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/libzip-targets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
include("${_cmake_config_file}")
endforeach()
unset(_cmake_config_file)
unset(_cmake_config_files)
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
\"${_cmake_file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_cmake_file)
unset("_cmake_import_check_files_for_${_cmake_target}")
endforeach()
unset(_cmake_target)
unset(_cmake_import_check_targets)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
@@ -0,0 +1,141 @@
# Copyright (C) 2020 Dieter Baron and Thomas Klausner
#
# The authors can be contacted at <info@libzip.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#[=======================================================================[.rst:
FindMbedTLS
-------
Finds the Mbed TLS library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``MbedTLS::MbedTLS``
The Mbed TLS library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``MbedTLS_FOUND``
True if the system has the Mbed TLS library.
``MbedTLS_VERSION``
The version of the Mbed TLS library which was found.
``MbedTLS_INCLUDE_DIRS``
Include directories needed to use Mbed TLS.
``MbedTLS_LIBRARIES``
Libraries needed to link to Mbed TLS.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``MbedTLS_INCLUDE_DIR``
The directory containing ``mbedtls/aes.h``.
``MbedTLS_LIBRARY``
The path to the Mbed TLS library.
#]=======================================================================]
# I'm not aware of a pkg-config file for mbedtls as of 2020/07/08.
#find_package(PkgConfig)
#pkg_check_modules(PC_MbedTLS QUIET mbedtls)
find_path(MbedTLS_INCLUDE_DIR
NAMES mbedtls/aes.h
# PATHS ${PC_MbedTLS_INCLUDE_DIRS}
)
find_library(MbedTLS_LIBRARY
NAMES mbedcrypto
# PATHS ${PC_MbedTLS_LIBRARY_DIRS}
)
# Extract version information from the header file
if(MbedTLS_INCLUDE_DIR)
# for major version 3
if(EXISTS ${MbedTLS_INCLUDE_DIR}/mbedtls/build_info.h)
file(STRINGS ${MbedTLS_INCLUDE_DIR}/mbedtls/build_info.h _ver_line
REGEX "^#define MBEDTLS_VERSION_STRING *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
MbedTLS_VERSION "${_ver_line}")
unset(_ver_line)
# for major version 2
elseif(EXISTS ${MbedTLS_INCLUDE_DIR}/mbedtls/version.h)
file(STRINGS ${MbedTLS_INCLUDE_DIR}/mbedtls/version.h _ver_line
REGEX "^#define MBEDTLS_VERSION_STRING *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
MbedTLS_VERSION "${_ver_line}")
unset(_ver_line)
else()
if(PC_MbedTLS_VERSION)
set(MbedTLS_VERSION ${PC_MbedTLS_VERSION})
else()
# version unknown
set(MbedTLS_VERSION "0.0")
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MbedTLS
FOUND_VAR MbedTLS_FOUND
REQUIRED_VARS
MbedTLS_LIBRARY
MbedTLS_INCLUDE_DIR
VERSION_VAR MbedTLS_VERSION
)
if(MbedTLS_FOUND)
set(MbedTLS_LIBRARIES ${MbedTLS_LIBRARY})
set(MbedTLS_INCLUDE_DIRS ${MbedTLS_INCLUDE_DIR})
# set(MbedTLS_DEFINITIONS ${PC_MbedTLS_CFLAGS_OTHER})
endif()
if(MbedTLS_FOUND AND NOT TARGET MbedTLS::MbedTLS)
add_library(MbedTLS::MbedTLS UNKNOWN IMPORTED)
set_target_properties(MbedTLS::MbedTLS PROPERTIES
IMPORTED_LOCATION "${MbedTLS_LIBRARY}"
# INTERFACE_COMPILE_OPTIONS "${PC_MbedTLS_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${MbedTLS_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
MbedTLS_INCLUDE_DIR
MbedTLS_LIBRARY
)
@@ -0,0 +1,141 @@
# Copyright (C) 2020 Dieter Baron and Thomas Klausner
#
# The authors can be contacted at <info@libzip.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#[=======================================================================[.rst:
FindNettle
-------
Finds the Nettle library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``Nettle::Nettle``
The Nettle library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``Nettle_FOUND``
True if the system has the Nettle library.
``Nettle_VERSION``
The version of the Nettle library which was found.
``Nettle_INCLUDE_DIRS``
Include directories needed to use Nettle.
``Nettle_LIBRARIES``
Libraries needed to link to Nettle.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``Nettle_INCLUDE_DIR``
The directory containing ``nettle/aes.h``.
``Nettle_LIBRARY``
The path to the Nettle library.
#]=======================================================================]
find_package(PkgConfig)
pkg_check_modules(PC_Nettle QUIET nettle)
find_path(Nettle_INCLUDE_DIR
NAMES nettle/aes.h nettle/md5.h nettle/pbkdf2.h nettle/ripemd160.h nettle/sha.h
PATHS ${PC_Nettle_INCLUDE_DIRS}
)
find_library(Nettle_LIBRARY
NAMES nettle
PATHS ${PC_Nettle_LIBRARY_DIRS}
)
# Extract version information from the header file
if(Nettle_INCLUDE_DIR)
# This file only exists in nettle>=3.0
if(EXISTS ${Nettle_INCLUDE_DIR}/nettle/version.h)
file(STRINGS ${Nettle_INCLUDE_DIR}/nettle/version.h _ver_major_line
REGEX "^#define NETTLE_VERSION_MAJOR *[0-9]+"
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+"
Nettle_MAJOR_VERSION "${_ver_major_line}")
file(STRINGS ${Nettle_INCLUDE_DIR}/nettle/version.h _ver_minor_line
REGEX "^#define NETTLE_VERSION_MINOR *[0-9]+"
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+"
Nettle_MINOR_VERSION "${_ver_minor_line}")
set(Nettle_VERSION "${Nettle_MAJOR_VERSION}.${Nettle_MINOR_VERSION}")
unset(_ver_major_line)
unset(_ver_minor_line)
else()
if(PC_Nettle_VERSION)
set(Nettle_VERSION ${PC_Nettle_VERSION})
else()
set(Nettle_VERSION "1.0")
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Nettle
FOUND_VAR Nettle_FOUND
REQUIRED_VARS
Nettle_LIBRARY
Nettle_INCLUDE_DIR
VERSION_VAR Nettle_VERSION
)
if(Nettle_FOUND)
set(Nettle_LIBRARIES ${Nettle_LIBRARY})
set(Nettle_INCLUDE_DIRS ${Nettle_INCLUDE_DIR})
set(Nettle_DEFINITIONS ${PC_Nettle_CFLAGS_OTHER})
endif()
if(Nettle_FOUND AND NOT TARGET Nettle::Nettle)
add_library(Nettle::Nettle UNKNOWN IMPORTED)
set_target_properties(Nettle::Nettle PROPERTIES
IMPORTED_LOCATION "${Nettle_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_Nettle_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${Nettle_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
Nettle_INCLUDE_DIR
Nettle_LIBRARY
)
# compatibility variables
set(Nettle_VERSION_STRING ${Nettle_VERSION})
@@ -0,0 +1,186 @@
# Copyright (C) 2020 Dieter Baron and Thomas Klausner
#
# The authors can be contacted at <info@libzip.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#[=======================================================================[.rst:
Findzstd
-------
Finds the Zstandard (zstd) library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``zstd::libzstd_shared``
The shared Zstandard library
``zstd::libzstd_static``
The shared Zstandard library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``zstd_FOUND``
True if the system has the Zstandard library.
``zstd_VERSION``
The version of the Zstandard library which was found.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``zstd_INCLUDE_DIR``
The directory containing ``zstd.h``.
``zstd_STATIC_LIBRARY``
The path to the Zstandard static library.
``zstd_SHARED_LIBRARY``
The path to the Zstandard shared library.
``zstd_DLL``
The path to the Zstandard DLL.
#]=======================================================================]
find_package(PkgConfig)
pkg_check_modules(PC_zstd QUIET libzstd)
find_path(zstd_INCLUDE_DIR
NAMES zstd.h
HINTS ${PC_zstd_INCLUDE_DIRS}
)
find_file(zstd_DLL
NAMES libzstd.dll zstd.dll
PATH_SUFFIXES bin
HINTS ${PC_zstd_PREFIX}
)
# On Windows, we manually define the library names to avoid mistaking the
# implib for the static library
if(zstd_DLL)
set(_zstd_win_static_name zstd-static)
set(_zstd_win_shared_name zstd)
else()
# vcpkg removes the -static suffix in static builds
set(_zstd_win_static_name zstd zstd_static)
set(_zstd_win_shared_name)
endif()
set(_previous_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".dylib" ".dll.a" ".lib")
find_library(zstd_SHARED_LIBRARY
NAMES zstd ${_zstd_win_shared_name}
HINTS ${PC_zstd_LIBDIR}
)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".lib")
find_library(zstd_STATIC_LIBRARY
NAMES zstd ${_zstd_win_static_name}
HINTS ${PC_zstd_LIBDIR}
)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_previous_suffixes})
# Set zstd_LIBRARY to the shared library or fall back to the static library
if(zstd_SHARED_LIBRARY)
set(_zstd_LIBRARY ${zstd_SHARED_LIBRARY})
else()
set(_zstd_LIBRARY ${zstd_STATIC_LIBRARY})
endif()
# Extract version information from the header file
if(zstd_INCLUDE_DIR)
file(STRINGS ${zstd_INCLUDE_DIR}/zstd.h _ver_major_line
REGEX "^#define ZSTD_VERSION_MAJOR *[0-9]+"
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+"
zstd_MAJOR_VERSION "${_ver_major_line}")
file(STRINGS ${zstd_INCLUDE_DIR}/zstd.h _ver_minor_line
REGEX "^#define ZSTD_VERSION_MINOR *[0-9]+"
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+"
zstd_MINOR_VERSION "${_ver_minor_line}")
file(STRINGS ${zstd_INCLUDE_DIR}/zstd.h _ver_release_line
REGEX "^#define ZSTD_VERSION_RELEASE *[0-9]+"
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+"
zstd_RELEASE_VERSION "${_ver_release_line}")
set(Zstd_VERSION "${zstd_MAJOR_VERSION}.${zstd_MINOR_VERSION}.${zstd_RELEASE_VERSION}")
unset(_ver_major_line)
unset(_ver_minor_line)
unset(_ver_release_line)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(zstd
FOUND_VAR zstd_FOUND
REQUIRED_VARS
_zstd_LIBRARY
zstd_INCLUDE_DIR
VERSION_VAR zstd_VERSION
)
if(zstd_FOUND AND zstd_SHARED_LIBRARY AND NOT TARGET zstd::libzstd_shared)
add_library(zstd::libzstd_shared SHARED IMPORTED)
if(WIN32)
set_target_properties(zstd::libzstd_shared PROPERTIES
IMPORTED_LOCATION "${zstd_DLL}"
IMPORTED_IMPLIB "${zstd_SHARED_LIBRARY}"
)
else()
set_target_properties(zstd::libzstd_shared PROPERTIES
IMPORTED_LOCATION "${zstd_SHARED_LIBRARY}"
)
endif()
set_target_properties(zstd::libzstd_shared PROPERTIES
INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
)
endif()
if(zstd_FOUND AND zstd_STATIC_LIBRARY AND NOT TARGET zstd::libzstd_static)
add_library(zstd::libzstd_static STATIC IMPORTED)
set_target_properties(zstd::libzstd_static PROPERTIES
IMPORTED_LOCATION "${zstd_STATIC_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
zstd_INCLUDE_DIR
zstd_DLL
zstd_SHARED_LIBRARY
zstd_STATIC_LIBRARY
)
Binary file not shown.
@@ -0,0 +1,14 @@
prefix=/home/romazan/Рабочий стол/cproject/thirdparty/libzip-1.11.3/build-emcmake/install
exec_prefix=${prefix}
bindir=${prefix}/bin
libdir=${prefix}/lib
includedir=${prefix}/include
zipcmp=${bindir}/zipcmp
Name: libzip
Description: library for handling zip archives
Version: 1.11.3
Libs: -L${libdir} -lzip
Libs.private: -lz
Cflags: -I${includedir}
@@ -0,0 +1,99 @@
.\" zipcmp.mdoc -- compare zip archives
.\" Copyright (C) 2003-2024 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 15, 2024
.Dt ZIPCMP 1
.Os
.Sh NAME
.Nm zipcmp
.Nd compare contents of zip archives
.Sh SYNOPSIS
.Nm
.Op Fl ChipqsTtVv
.Ar archive1 archive2
.Sh DESCRIPTION
.Nm
compares the zip archives or directories
.Ar archive1
and
.Ar archive2
and checks if they contain the same files, comparing their names,
uncompressed sizes, and CRCs.
File order and compressed size differences are ignored.
.Pp
Supported options:
.Bl -tag -width MMM
.It Fl C
Check consistency of archives.
Results in an error if archive is inconsistent or not valid
according to the zip specification.
.It Fl h
Display a short help message and exit.
.It Fl i
Compare names ignoring case distinctions.
.It Fl p
Enable paranoid checks.
Compares extra fields, comments, and other meta data.
(Automatically disabled if one of the archives is a directory.)
These checks are skipped for files where the data differs.
.It Fl q
Quiet mode.
Compare
.Fl v .
.It Fl s
Print a summary of how many files where added and removed.
.It Fl T
Additionally compare the time stamps of the entries.
.It Fl t
Test zip files by comparing the contents to their checksums.
.It Fl V
Display version information and exit.
.It Fl v
Verbose mode.
Print details about differences to stdout.
(This is the default.)
.El
.Sh EXIT STATUS
.Nm
exits 0 if the two archives contain the same files, 1 if they differ,
and >1 if an error occurred.
.Sh SEE ALSO
.Xr zipmerge 1 ,
.Xr ziptool 1 ,
.Xr libzip 3
.Sh HISTORY
.Nm
was added in libzip 0.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,105 @@
.\" zipmerge.mdoc -- merge zip archives
.\" Copyright (C) 2004-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 7, 2023
.Dt ZIPMERGE 1
.Os
.Sh NAME
.Nm zipmerge
.Nd merge zip archives
.Sh SYNOPSIS
.Nm
.Op Fl DhIiSsV
.Ar target-zip
.Ar source-zip Op Ar source-zip ...
.Sh DESCRIPTION
.Nm
copies files from the source zip archives
.Ar source-zip
to the target zip archive
.Ar target-zip .
By default, files in the source zip archives overwrite
existing files of the same name in the target zip archive.
By default, compressed files in the source archive are
copied directly without recompression, uncompressed files
are compressed using the default compression algorithm.
.Pp
Supported options:
.Bl -tag -width MMM
.It Fl D
Ignore directory components in file name comparisons.
This option is slow for archives with many files.
.It Fl h
Display a short help message and exit.
.It Fl I
Ignore case in file name comparisons
This option is slow for archives with many files.
.It Fl i
Ask before overwriting files.
See also
.Fl s .
.It Fl k
Do not compress files that were uncompressed in
.Ar source-zip ,
otherwise they are compressed with the default compression method.
.It Fl S
Do not overwrite files that have the same name, size, and
CRC32 in both the source and target archives.
.It Fl s
When
.Fl i
is given, do not ask before overwriting files that have the same name, size,
and CRC32.
.It Fl V
Display version information and exit.
.El
.Sh EXIT STATUS
.Nm
exits 0 on success and >1 if an error occurred.
.Sh SEE ALSO
.Xr zipcmp 1 ,
.Xr ziptool 1 ,
.Xr libzip 3
.Sh HISTORY
.Nm
was added in libzip 0.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
.Nm
uses one open file descriptor per zip archive.
If you need to merge a lot of zip archives, check your shell's
file descriptor ulimit and either increase it or run
.Nm
multiple times with e.g. 1000 source zip archives each time.
@@ -0,0 +1,364 @@
.\" ziptool.mdoc -- modify zip archives in multiple ways
.\" Copyright (C) 2016-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 23, 2023
.Dt ZIPTOOL 1
.Os
.Sh NAME
.Nm ziptool
.Nd modify zip archives
.Sh SYNOPSIS
.Nm
.Op Fl ceghnrst
.Op Fl l Ar length
.Op Fl o Ar offset
.Ar zip-archive
.Cm command Op Ar command-args ...
.Op Cm command Oo Ar command-args ... Oc ...
.Sh DESCRIPTION
.Nm
modifies the zip archive
.Ar zip-archive
according to the
.Ar commands
given.
.Pp
Supported options:
.Bl -tag -width MoMoffsetMM
.It Fl c
Check zip archive consistency when opening it.
.It Fl e
Error if archive already exists (only useful with
.Fl n ) .
.It Fl g
Guess file name encoding (for
.Cm stat
command).
.It Fl h
Display help.
.It Fl l Ar length
Only read
.Ar length
bytes of archive.
See also
.Fl o .
.It Fl n
Create archive if it doesn't exist.
See also
.Fl e .
.It Fl o Ar offset
Start reading input archive from
.Ar offset .
See also
.Fl l .
.It Fl r
Print raw file name encoding without translation (for
.Cm stat
command).
.It Fl s
Follow file name convention strictly (for
.Cm stat
command).
.It Fl t
Disregard current file contents, if any.
.Em Note :
use this with care, it deletes all existing file contents when
you modify the archive.
.El
.Ss Commands
For all commands below, the index is zero-based.
In other words, the first entry in the zip archive has index 0.
.Pp
Supported commands and arguments are:
.Bl -tag -width 10n
.It Cm add Ar name content
Add file called
.Ar name
using the string
.Ar content
from the command line as data.
.It Cm add_dir Ar name
Add directory
.Ar name .
.It Cm add_file Ar name file_to_add offset len
Add file
.Ar name
to archive, using
.Ar len
bytes from the file
.Ar file_to_add
as input data, starting at
.Ar offset .
.It Cm add_from_zip Ar name archivename index offset len
Add file called
.Ar name
to archive using data from another zip archive
.Ar archivename
using the entry with index
.Ar index
and reading
.Ar len
bytes from
.Ar offset .
.It Cm cat Ar index
Output file contents for entry
.Ar index
to stdout.
.It Cm count_extra Ar index flags
Print the number of extra fields for archive entry
.Ar index
using
.Ar flags .
.It Cm count_extra_by_id Ar index extra_id flags
Print number of extra fields of type
.Ar extra_id
for archive entry
.Ar index
using
.Ar flags .
.It Cm delete Ar index
Remove entry at
.Ar index
from zip archive.
.It Cm delete_extra Ar index extra_idx flags
Remove extra field number
.Ar extra_idx
from archive entry
.Ar index
using
.Ar flags .
.It Cm delete_extra_by_id Ar index extra_id extra_index flags
Remove extra field number
.Ar extra_index
of type
.Ar extra_id
from archive entry
.Ar index
using
.Ar flags .
.It Cm get_archive_comment
Print archive comment.
.It Cm get_archive_flag Ar flag
Print state of archive flag
.Ar flag .
.It Cm get_extra Ar index extra_index flags
Print extra field
.Ar extra_index
for archive entry
.Ar index
using
.Ar flags .
.It Cm get_extra_by_id Ar index extra_id extra_index flags
Print extra field
.Ar extra_index
of type
.Ar extra_id
for archive entry
.Ar index
using
.Ar flags .
.It Cm get_file_comment Ar index
Get file comment for archive entry
.Ar index .
.It Cm get_num_entries Ar flags
Print number of entries in archive using
.Ar flags .
.It Cm name_locate Ar name flags
Find entry in archive with the filename
.Ar name
using
.Ar flags
and print its index.
.It Cm rename Ar index name
Rename archive entry
.Ar index
to
.Ar name .
.It Cm replace_file_contents Ar index data
Replace file contents for archive entry
.Ar index
with the string
.Ar data .
.It Cm set_archive_comment Ar comment
Set archive comment to
.Ar comment .
.It Cm get_archive_flag Ar flag Ar value
Set archive flag
.Ar flag
to
.Ar value .
.It Cm set_extra Ar index extra_id extra_index flags value
Set extra field number
.Ar extra_index
of type
.Ar extra_id
for archive entry
.Ar index
using
.Ar flags
to
.Ar value .
.It Cm set_file_comment Ar index comment
Set file comment for archive entry
.Ar index
to string
.Ar comment .
.It Cm set_file_compression Ar index method compression_flags
Set file compression method for archive entry
.Ar index
to
.Ar method
using
.Ar compression_flags .
.Em Note :
Currently,
.Ar compression_flags
are ignored.
.It Cm set_file_encryption Ar index method password
Set file encryption method for archive entry
.Ar index
to
.Ar method
with password
.Ar password .
.It Cm set_file_mtime Ar index timestamp
Set file modification time for archive entry
.Ar index
to UNIX mtime
.Ar timestamp .
.It Cm set_file_mtime_all Ar timestamp
Set file modification time for all archive entries to UNIX mtime
.Ar timestamp .
.It Cm set_password Ar password
Set default password for encryption/decryption to
.Ar password .
.It Cm stat Ar index
Print information about archive entry
.Ar index .
.El
.Ss Flags
Some commands take flag arguments.
Each character in the argument sets the corresponding flag.
Use 0 or the empty string for no flags.
.Pp
Supported flags are:
.Bl -tag -width MMM -compact -offset indent
.It Ar 4
.Dv ZIP_FL_ENC_CP437
.It Ar 8
.Dv ZIP_FL_ENC_UTF_8
.It Ar C
.Dv ZIP_FL_NOCASE
.It Ar c
.Dv ZIP_FL_CENTRAL
.It Ar d
.Dv ZIP_FL_NODIR
.It Ar l
.Dv ZIP_FL_LOCAL
.It Ar r
.Dv ZIP_FL_ENC_RAW
.It Ar s
.Dv ZIP_FL_ENC_STRICT
.It Ar u
.Dv ZIP_FL_UNCHANGED
.El
.Ss Archive flags
.Cm get_archive_flag
and
.Cm set_archive_flag
work on the following flags:
.Bl -bullet -compact -offset indent
.It
.Dv create-or-keep-empty-file-for-archive
.It
.Dv is-torrentzip
.It
.Dv rdonly
.It
.Dv want-torrentzip
.El
.Ss Compression Methods
Some commands take compression method arguments.
Supported methods are:
.Bl -bullet -compact -offset indent
.It
.Dv default
.It
.Dv deflate
.It
.Dv store
.El
.Ss Encryption Methods
Some commands take encryption method arguments.
Supported methods are:
.Bl -bullet -compact -offset indent
.It
.Dv none
.It
.Dv AES-128
.It
.Dv AES-192
.It
.Dv AES-256
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
Add a file called
.Pa teststring.txt
to the zip archive
.Pa testbuffer.zip
with data
.Dq This is a test.\en
where
.Dq \en
is replaced with a newline character:
.Bd -literal -offset indent
ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
.Ed
.Pp
Delete the first file from the zip archive
.Pa testfile.zip :
.Bd -literal -offset indent
ziptool testfile.zip delete 0
.Ed
.Sh SEE ALSO
.Xr zipcmp 1 ,
.Xr zipmerge 1 ,
.Xr libzip 3
.Sh HISTORY
.Nm
was added in libzip 1.1.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,79 @@
.\" ZIP_SOURCE_GET_ARGS -- validate and cast arguments to source callback
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_GET_ARGS 3
.Os
.Sh NAME
.Nm ZIP_SOURCE_GET_ARGS
.Nd validate and cast arguments to source callback
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft type *
.Fn ZIP_SOURCE_GET_ARGS "type" "void *data" "zip_uint64_t len" "zip_error_t *error"
.Sh DESCRIPTION
The
.Fn ZIP_SOURCE_GET_ARGS
macro casts
.Ar data
to a pointer to
.Ar type .
.Sh RETURN VALUES
On success,
.Fn ZIP_SOURCE_GET_ARGS
returns
.Ar data .
In case of error, it returns
.Dv NULL
and sets
.Ar error .
.Sh ERRORS
.Fn ZIP_SOURCE_GET_ARGS
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar len
is less than the size of
.Ar type
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source_function 3
.Sh HISTORY
.Fn ZIP_SOURCE_GET_ARGS
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,299 @@
.\" libzip.mdoc -- general overview of available functions
.\" Copyright (C) 2005-2024 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 21, 2024
.Dt LIBZIP 3
.Os
.Sh NAME
.Nm libzip
.Nd library for manipulating zip archives
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Sh DESCRIPTION
.Nm
is a library for reading, creating, and modifying zip archives.
.Pp
The main design criteria for
.Nm
were:
.Bl -bullet -compact
.It
Do not create corrupt files, even in case of errors.
.It
Do not delete data.
.It
Be efficient.
.El
.Pp
For this reason, when modifying zip archives,
.Nm
writes to a temporary file and replaces the original
zip archive atomically.
.Pp
Below there are two sections listing functions: one for how to read
from zip archives and one for how to create/modify them.
.Sh GENERAL NOTES
Unless explicitly documented, functions should not be passed
.Dv NULL
pointers as arguments.
.Sh FILE NAMES
.Ss Encoding
Names of files in the host file system are expected in UTF-8 encoding.
On Windows, variants for ASCII and UTF-16 are also available.
.Pp
Names of files inside archives are by default expected in UTF-8 encoding.
Other encodings can be requested by using the flags
.Dv ZIP_FL_ENC_CP437
and
.Dv ZIP_FL_ENC_RAW .
.Pp
For details see the relevant man pages.
.Ss Directory Separator
The zip format requires the use of forward slash
.Pq Sq /
as directory separator.
Since backslash
.Pq Sq \e
can be part of a valid file name on Unix systems,
.Nm
does not automatically convert them, even on Windows.
It is the responsibility of the programmer to ensure that all
directory separators are passed as forward slashes to
.Nm .
.Sh THREAD SAFETY
In general, different zip archives opened by
.Nm
are independent of each other and can be used by parallel-running
threads without locking.
If you want to use an archive from multiple threads, you have to
synchronize access to it yourself.
If you use an archive as a source for
.Xr zip_file_add 3
or
.Xr zip_file_replace 3 ,
access to the target archive must be synchronized with access to the
source archive as well.
.Sh READING ZIP ARCHIVES
.Ss Open Archive
.Bl -bullet -compact
.It
.Xr zip_open 3
.It
.Xr zip_fdopen 3
.El
.Ss Find Files
.Bl -bullet -compact
.It
.Xr zip_name_locate 3
.El
.Ss Read Files
.Bl -bullet -compact
.It
.Xr zip_fopen 3
.It
.Xr zip_fopen_encrypted 3
.It
.Xr zip_fopen_index 3
.It
.Xr zip_fopen_index_encrypted 3
.It
.Xr zip_fread 3
.It
.Xr zip_file_is_seekable 3
.It
.Xr zip_fseek 3
(uncompressed files only)
.It
.Xr zip_ftell 3
.It
.Xr zip_fclose 3
.El
.Ss Close Archive
.Bl -bullet -compact
.It
.Xr zip_close 3
.El
.Ss Miscellaneous
.Bl -bullet -compact
.It
.Xr zip_stat 3
.It
.Xr zip_compression_method_supported 3
.It
.Xr zip_encryption_method_supported 3
.It
.Xr zip_file_get_comment 3
.It
.Xr zip_file_get_external_attributes 3
.It
.Xr zip_get_archive_comment 3
.It
.Xr zip_get_archive_flag 3
.It
.Xr zip_get_name 3
.It
.Xr zip_get_num_entries 3
.It
.Xr zip_set_default_password 3
.It
.Xr zip_source_pass_to_lower_layer 3
.El
.Sh CREATING/MODIFYING ZIP ARCHIVES
.Ss Create/Open Archive
.Bl -bullet -compact
.It
.Xr zip_open 3
.El
.Ss Add/Change Files and Directories
.Bl -bullet -compact
.It
.Xr zip_dir_add 3
.It
.Xr zip_file_add 3
.It
.Xr zip_file_replace 3
.It
.Xr zip_file_set_comment 3
.It
.Xr zip_file_set_dostime 3
.It
.Xr zip_file_set_external_attributes 3
.It
.Xr zip_file_set_encryption 3
.It
.Xr zip_file_set_mtime 3
.It
.Xr zip_set_file_compression 3
.It
.Xr zip_source_buffer 3
.It
.Xr zip_source_file 3
.It
.Xr zip_source_filep 3
.It
.Xr zip_source_free 3
.It
.Xr zip_source_function 3
.It
.Xr zip_source_layered 3
.It
.Xr zip_source_zip 3
.El
.Ss Rename Files
.Bl -bullet -compact
.It
.Xr zip_rename 3
.El
.Ss Delete Files
.Bl -bullet -compact
.It
.Xr zip_delete 3
.El
.Ss Revert Changes
.Bl -bullet -compact
.It
.Xr zip_unchange 3
.It
.Xr zip_unchange_all 3
.It
.Xr zip_unchange_archive 3
.El
.Ss Read/Modify Extra Fields
.Bl -bullet -compact
.It
.Xr zip_file_extra_field_delete 3
.It
.Xr zip_file_extra_field_delete_by_id 3
.It
.Xr zip_file_extra_field_get 3
.It
.Xr zip_file_extra_field_get_by_id 3
.It
.Xr zip_file_extra_field_set 3
.It
.Xr zip_file_extra_fields_count 3
.It
.Xr zip_file_extra_fields_count_by_id 3
.El
.Ss Close Archive (Writing)
.Bl -bullet -compact
.It
.Xr zip_close 3
.It
.Xr zip_discard 3
.El
.Ss Miscellaneous (Writing)
.Bl -bullet -compact
.It
.Xr zip_file_attributes_init 3
.It
.Xr zip_libzip_version 3
.It
.Xr zip_register_cancel_callback_with_state 3
.It
.Xr zip_register_progress_callback_with_state 3
.It
.Xr zip_set_archive_comment 3
.It
.Xr zip_set_archive_flag 3
.It
.Xr zip_source 3
.El
.Sh ERROR HANDLING
.Bl -bullet -compact
.It
.Xr zip_error_strerror 3
.It
.Xr zip_strerror 3
.It
.Xr zip_file_strerror 3
.It
.Xr zip_file_get_error 3
.It
.Xr zip_get_error 3
.It
.Xr zip_error_init_with_code 3
.It
.Xr zip_error_set 3
.It
.Xr zip_error_set_from_source 3
.It
.Xr zip_error_system_type 3
.It
.Xr zip_errors 3
.El
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,96 @@
.\" zip_add.mdoc -- add files to zip archive
.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ADD 3
.Os
.Sh NAME
.Nm zip_add ,
.Nm zip_replace
.Nd add file to zip archive or replace file in zip archive (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_add "zip_t *archive" "const char *name" "zip_source_t *source"
.Ft int
.Fn zip_replace "zip_t *archive" "zip_uint64_t index" "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_add
is the obsolete version of
.Xr zip_file_add 3 .
It is the same as calling
.Xr zip_file_add 3
with an empty
.Ar flags
argument.
Similarly, the
.Fn zip_replace
function is the obsolete version of
.Xr zip_file_replace 3 .
It is the same as calling
.Xr zip_file_replace 3
with an empty
.Ar flags
argument.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3
.Sh HISTORY
.Fn zip_add
was added in libzip 0.6.
In libzip 0.10 the return type was changed from
.Vt int
to
.Vt zip_int64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_add
instead.
.Pp
.Fn zip_replace
was added in libzip 0.6.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_replace
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,69 @@
.\" zip_add_dir.mdoc -- add directory to zip archive
.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ADD_DIR 3
.Os
.Sh NAME
.Nm zip_add_dir
.Nd add directory to zip archive (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_add_dir "zip_t *archive" "const char *name"
.Sh DESCRIPTION
The function
.Fn zip_add_dir
is the obsolete version of
.Xr zip_dir_add 3 .
It is the same as calling
.Xr zip_dir_add 3
with an empty flags argument.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_dir_add 3
.Sh HISTORY
.Fn zip_add_dir
was added in libzip 0.8.
In libzip 0.10 the return type was changed from
.Vt int
to
.Vt zip_int64_t .
It was deprecated in libzip 0.11, use
.Fn zip_dir_add
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,136 @@
.\" zip_close.mdoc -- close zip archive
.\" Copyright (C) 2003-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 23, 2023
.Dt ZIP_CLOSE 3
.Os
.Sh NAME
.Nm zip_close
.Nd close zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_close "zip_t *archive"
.Sh DESCRIPTION
The
.Fn zip_close
function writes any changes made to
.Ar archive
to disk.
If
.Ar archive
contains no files, the file is completely removed (no empty archive is
written), unless the archive flag
.Dv ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE
is set.
If successful,
.Ar archive
is freed.
Otherwise
.Ar archive
is left unchanged and must still be freed.
.Pp
To close and free a zip archive without saving changes, use
.Xr zip_discard 3 .
.Pp
Progress updates for GUIs can be implemented using
.Xr zip_register_progress_callback_with_state 3 .
Cancelling the write of an archive during
.Nm
can be implemented using
.Xr zip_register_cancel_callback_with_state 3 .
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_close
will fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_EOF
Unexpected end-of-file found while reading from a file.
.It Bq Er ZIP_ER_INTERNAL
The callback function of an added or replaced file returned an
error but failed to report which.
.It Bq Er ZIP_ER_INVAL
The
.Ar path
argument is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOZIP
File is not a zip archive.
.It Bq Er ZIP_ER_READ
A file read failed.
.It Bq Er ZIP_ER_RENAME
A temporary file could not be renamed to its final name.
.It Bq Er ZIP_ER_SEEK
A file seek failed.
.It Bq Er ZIP_ER_TMPOPEN
A temporary file could not be created.
.It Bq Er ZIP_ER_WRITE
A file write failed.
.It Bq Er ZIP_ER_ZLIB
An error occurred while (de)compressing a stream with
.Xr zlib 3 .
.El
Additionally, any errors returned by the callback function
for added or replaced files will be passed back.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_discard 3 ,
.Xr zip_fdopen 3 ,
.Xr zip_get_error 3 ,
.Xr zip_open 3 ,
.Xr zip_register_cancel_callback_with_state 3 ,
.Xr zip_register_progress_callback_with_state 3 ,
.Xr zip_set_archive_flag 3 ,
.Xr zip_strerror 3
.Sh HISTORY
.Fn zip_close
was added in libzip 0.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
Please note that all indices,
.Xr zip_stat 3
information and other data about the archive is invalid after
.Nm .
When you open the same file again, it will be a completely new
.Vt zip_t
structure.
@@ -0,0 +1,65 @@
.\" zip_compression_method_supported.mdoc -- return if compression method is supported
.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 2, 2020
.Dt ZIP_COMPRESSION_METHOD_SUPPORTED 3
.Os
.Sh NAME
.Nm zip_compression_method_supported
.Nd return if a compression method is supported
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_compression_method_supported "zip_int32_t method" "int compress"
.Sh DESCRIPTION
The
.Fn zip_compression_method_supported
returns if the compression method
.Ar method
is supported for compression (if
.Ar compress
is zero) or decompression (otherwise).
.Sh RETURN VALUES
Returns 1 if the method is supported, 0 otherwise.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_encryption_method_supported 3 ,
.Xr zip_set_file_compression 3
.Sh HISTORY
.Fn zip_compression_method_supported
was added in libzip 1.7.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,80 @@
.\" zip_delete.mdoc -- delete files from zip archive
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_DELETE 3
.Os
.Sh NAME
.Nm zip_delete
.Nd delete file from zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_delete "zip_t *archive" "zip_uint64_t index"
.Sh DESCRIPTION
The file at position
.Ar index
in the zip archive
.Ar archive
is marked as deleted.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_delete
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_unchange 3
.Sh HISTORY
.Fn zip_delete
was added in libzip 0.6.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,109 @@
.\" zip_dir_add.mdoc -- add directory to zip archive
.\" Copyright (C) 2006-2020 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 20, 2020
.Dt ZIP_DIR_ADD 3
.Os
.Sh NAME
.Nm zip_dir_add
.Nd add directory to zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_dir_add "zip_t *archive" "const char *name" "zip_flags_t flags"
.Sh DESCRIPTION
The function
.Fn zip_dir_add
adds a directory to a zip archive.
The argument
.Ar archive
specifies the zip archive to which the directory should be added.
.Ar name
is the directory's name in the zip archive.
.Pp
This function adds an entry to the archive.
It does not check whether a directory with that name exists in the
file system, nor does it add its contents if it does.
The
.Ar flags
argument can be any of:
.Bl -tag -width XZIPXFLXENCXSTRICTXX
.It Dv ZIP_FL_ENC_GUESS
Guess encoding of
.Ar name
(default).
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_UTF_8
Interpret
.Ar name
as UTF-8.
.It Dv ZIP_FL_ENC_CP437
Interpret
.Ar name
as code page 437 (CP-437).
.El
.Sh RETURN VALUES
Upon successful completion, the index of the new entry in the archive
is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_dir_add
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_EXISTS
There is already an entry called
.Ar name
in the archive.
.It Bq Er ZIP_ER_INVAL
.Ar archive
or
.Ar name
are
.Dv NULL ,
or invalid UTF-8 encoded file names.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3
.Sh HISTORY
.Fn zip_dir_add
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,61 @@
.\" zip_discard.mdoc -- close zip archive and discard changes
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_DISCARD 3
.Os
.Sh NAME
.Nm zip_discard
.Nd close zip archive and discard changes
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_discard "zip_t *archive"
.Sh DESCRIPTION
The
.Fn zip_discard
function closes
.Ar archive
and frees the memory allocated for it.
Any changes to the archive are not written to disk and discarded.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3
.Sh HISTORY
.Fn zip_discard
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,65 @@
.\" zip_encryption_method_supported.mdoc -- return if encryption method is supported
.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 2, 2020
.Dt ZIP_ENCRYPTION_METHOD_SUPPORTED 3
.Os
.Sh NAME
.Nm zip_encryption_method_supported
.Nd return if an encryption method is supported
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_encryption_method_supported "zip_int16_t method" "int encrypt"
.Sh DESCRIPTION
The
.Fn zip_encryption_method_supported
returns if the encryption method
.Ar method
is supported for encryption (if
.Ar encrypt
is zero) or decryption (otherwise).
.Sh RETURN VALUES
Returns 1 if the method is supported, 0 otherwise.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_compression_method_supported 3 ,
.Xr zip_file_set_encryption 3
.Sh HISTORY
.Fn zip_encryption_method_supported
was added in libzip 1.7.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,69 @@
.\" zip_error_clear.mdoc -- clear error state for archive or file
.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_CLEAR 3
.Os
.Sh NAME
.Nm zip_error_clear ,
.Nm zip_file_error_clear
.Nd clear error state for archive or file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_clear "zip_t *archive"
.Ft void
.Fn zip_file_error_clear "zip_file_t *file"
.Sh DESCRIPTION
The
.Fn zip_error_clear
function clears the error state for the zip archive
.Ar archive .
.Pp
The
.Fn zip_file_error_clear
function does the same for the zip file
.Ar file .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_get_error 3
.Sh HISTORY
.Fn zip_error_clear
and
.Fn zip_file_error_clear
were added in libzip 0.8.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,63 @@
.\" zip_error_code_system.mdoc -- get system error part of zip_error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_CODE_SYSTEM 3
.Os
.Sh NAME
.Nm zip_error_code_system
.Nd get operating system error part of zip_error
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_error_code_system "const zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_error_code_system
function returns the system specific part of the error from the
zip_error error
.Ar ze .
For finding out what system reported the error, use
.Xr zip_error_system_type 3 .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_zip 3 ,
.Xr zip_error_system_type 3
.Sh HISTORY
.Fn zip_error_code_system
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,60 @@
.\" zip_error_code_zip.mdoc -- get libzip error part of zip_error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_CODE_ZIP 3
.Os
.Sh NAME
.Nm zip_error_code_zip
.Nd get libzip error part of zip_error
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_error_code_zip "const zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_error_code_zip
function returns the libzip specific part of the error from the
zip_error error
.Ar ze .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_system 3
.Sh HISTORY
.Fn zip_error_code_zip
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,60 @@
.\" zip_error_fini.mdoc -- clean up zip_error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_FINI 3
.Os
.Sh NAME
.Nm zip_error_fini
.Nd clean up zip_error structure
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_fini "zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_error_fini
function cleans up and frees internally allocated memory of the
zip_error pointed to by
.Ar ze .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_init 3
.Sh HISTORY
.Fn zip_error_fini
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,117 @@
.\" zip_error_get.mdoc -- get error codes for archive or file
.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_GET 3
.Os
.Sh NAME
.Nm zip_error_get ,
.Nm zip_file_error_get
.Nd get error codes for archive or file (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_get "zip_t *archive" "int *zep" "int *sep"
.Ft void
.Fn zip_file_error_get "zip_file_t *file" "int *zep" "int *sep"
.Sh DESCRIPTION
The functions
.Fn zip_error_get
and
.Fn zip_file_error_get
are deprecated.
Use
.Xr zip_error_code_system 3 ,
.Xr zip_error_code_zip 3 ,
.Xr zip_file_get_error 3 ,
and
.Xr zip_get_error 3
instead.
.Pp
For
.Fn zip_error_get ,
replace
.Bd -literal -offset indent
int ze, se;
zip_error_get(za, &ze, &se);
.Ed
with
.Bd -literal -offset indent
int ze, se;
zip_error_t *error = zip_get_error(za);
ze = zip_error_code_zip(error);
se = zip_error_code_system(error);
.Ed
For
.Fn zip_file_error_get ,
replace
.Bd -literal -offset indent
int ze, se;
zip_file_error_get(zf, &ze, &se);
.Ed
with
.Bd -literal -offset indent
int ze, se;
zip_error_t *error = zip_file_get_error(zf);
ze = zip_error_code_zip(error);
se = zip_error_code_system(error);
.Ed
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_system 3 ,
.Xr zip_error_code_zip 3 ,
.Xr zip_file_get_error 3 ,
.Xr zip_get_error 3
.Sh HISTORY
.Fn zip_error_get
was added in libzip 0.6.
It was deprecated in libzip 1.0, use
.Fn zip_get_error ,
.Fn zip_error_code_zip ,
/
.Fn zip_error_code_system
instead.
.Pp
.Fn zip_file_error_get
was added in libzip 0.6.
It was deprecated in libzip 1.0, use
.Fn zip_file_get_error ,
.Fn zip_error_code_zip ,
/
.Fn zip_error_code_system
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,77 @@
.\" zip_error_get_sys_type.mdoc -- get type of error
.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_GET_SYS_TYPE 3
.Os
.Sh NAME
.Nm zip_error_get_sys_type
.Nd get type of system error code (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_error_get_sys_type "int ze"
.Sh DESCRIPTION
The function
.Fn zip_error_get_sys_type
is deprecated; use
.Xr zip_error_init_with_code 3
and
.Xr zip_error_system_type 3
instead.
.Pp
Replace
.Bd -literal -offset indent
int i = zip_error_get_sys_type(ze);
.Ed
with
.Bd -literal -offset indent
zip_error_t error;
zip_error_init_with_code(&error, ze);
int i = zip_error_system_type(&error);
.Ed
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_init_with_code 3 ,
.Xr zip_error_system_type 3
.Sh HISTORY
.Fn zip_error_get_sys_type
was added in libzip 0.6.
It was deprecated in libzip 1.0, use
.Fn zip_error_system_type
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,76 @@
.\" zip_error_init.mdoc -- initialize zip_error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_INIT 3
.Os
.Sh NAME
.Nm zip_error_init ,
.Nm zip_error_init_with_code
.Nd initialize zip_error structure
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_init "zip_error_t *error"
.Ft void
.Fn zip_error_init_with_code "zip_error_t *error" "int ze"
.Sh DESCRIPTION
The
.Fn zip_error_init
function initializes the zip_error pointed to by
.Ar error .
.Ar *error
must be allocated before calling
.Fn zip_error_init .
.Pp
The
.Fn zip_error_init_with_code
function does the same, but additionally sets the zip error code to
.Ar ze
and sets the system error code to the current
.Xr errno 3
value, if appropriate.
.\" TODO: describe when you would need to call this at all
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_fini 3
.Sh HISTORY
.Fn zip_error_init
and
.Fn zip_error_init_with_code
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,76 @@
.\" zip_error_init.mdoc -- initialize zip_error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_INIT 3
.Os
.Sh NAME
.Nm zip_error_init ,
.Nm zip_error_init_with_code
.Nd initialize zip_error structure
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_init "zip_error_t *error"
.Ft void
.Fn zip_error_init_with_code "zip_error_t *error" "int ze"
.Sh DESCRIPTION
The
.Fn zip_error_init
function initializes the zip_error pointed to by
.Ar error .
.Ar *error
must be allocated before calling
.Fn zip_error_init .
.Pp
The
.Fn zip_error_init_with_code
function does the same, but additionally sets the zip error code to
.Ar ze
and sets the system error code to the current
.Xr errno 3
value, if appropriate.
.\" TODO: describe when you would need to call this at all
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_fini 3
.Sh HISTORY
.Fn zip_error_init
and
.Fn zip_error_init_with_code
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,70 @@
.\" zip_error_set.mdoc -- set zip_error
.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 5, 2022
.Dt ZIP_ERROR_SET 3
.Os
.Sh NAME
.Nm zip_error_set
.Nd fill in zip_error structure
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_set "zip_error_t *ze" "int le" "int se"
.Sh DESCRIPTION
The
.Fn zip_error_set
function sets the zip_error pointed to by
.Ar ze
to the libzip error code
.Ar le
and the system error code
.Ar se .
.Pp
.Ar ze
must be allocated and initialized with
.Xr zip_error_init 3
before calling
.Fn zip_error_set .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_init 3 ,
.Xr zip_error_set_from_source 3
.Sh HISTORY
.Fn zip_error_set
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,69 @@
.\" zip_error_set_from_source.mdoc -- set zip_error from source
.\" Copyright (C) 2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 5, 2022
.Dt ZIP_ERROR_SET_FROM_SOURCE 3
.Os
.Sh NAME
.Nm zip_error_set_from_source
.Nd fill in zip_error structure from source
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_set_from_source "zip_error_t *ze" "zip_source_t *src"
.Sh DESCRIPTION
The
.Fn zip_error_set_from_source
function sets the zip_error pointed to by
.Ar ze
to the error reported by
.Ar src
as returned by
.Xr zip_error_source 3 .
.Ar ze
must be allocated and initialized with
.Xr zip_error_init 3
before calling
.Fn zip_error_set_from_source .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_init 3 ,
.Xr zip_error_set 3
.Sh HISTORY
.Fn zip_error_set_from_source
was added in libzip 1.10.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,67 @@
.\" zip_error_strerror.mdoc -- create human-readable version of zip_error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_STRERROR 3
.Os
.Sh NAME
.Nm zip_error_strerror
.Nd create human-readable string for zip_error
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_error_strerror "zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_error_strerror
function returns an error message string corresponding to
.Ar ze
like
.Xr strerror 3 .
This string will stay valid until the next call to
.Fn zip_error_strerror
or until
.Xr zip_error_fini 3
is called.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr strerror 3 ,
.Xr zip_error_fini 3
.Sh HISTORY
.Fn zip_error_strerror
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,77 @@
.\" zip_error_system_type.mdoc -- return system type for error
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_SYSTEM_TYPE 3
.Os
.Sh NAME
.Nm zip_error_system_type
.Nd return type of system error
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_error_system_type "const zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_error_system_type
function returns the type of the system specific part for the zip_error
.Ar ze .
Currently, the following system types are defined:
.Bl -tag -width ZIP_ET_NONE
.It Dv ZIP_ET_NONE
System specific part of
.Ar ze
is unused.
.It Dv ZIP_ET_SYS
System specific part of
.Ar ze
is an
.Xr errno 2 .
.It Dv ZIP_ET_ZLIB
System specific part of
.Ar ze
is a
.Xr zlib 3
error.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_system 3
.Sh HISTORY
.Fn zip_error_system_type
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,69 @@
.\" zip_error_to_data.mdoc -- create error data for ZIP_SOURCE_ERROR
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_TO_DATA 3
.Os
.Sh NAME
.Nm zip_error_to_data
.Nd convert zip_error to return value suitable for ZIP_SOURCE_ERROR
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_error_to_data "const zip_error_t *ze" "void *data" "zip_uint64_t len"
.Sh DESCRIPTION
.Fn zip_error_to_data
function converts the zip_error
.Ar ze
into data suitable as return value for
.Dv ZIP_SOURCE_ERROR .
The data is written into the buffer
.Ar data
of size
.Ar len .
If the buffer is not large enough to hold 2 ints, an error is
returned.
.Sh RETURN VALUES
.Fn zip_error_to_data
returns 2*(sizeof int) on success, and \-1 on error.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source_function 3
.Sh HISTORY
.Fn zip_error_to_data
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,88 @@
.\" zip_error_to_str.mdoc -- get string representation of zip error code
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_TO_STR 3
.Os
.Sh NAME
.Nm zip_error_to_str
.Nd get string representation of zip error (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_error_to_str "char *buf" "zip_uint64_t len" "int ze" "int se"
.Sh DESCRIPTION
The function
.Fn zip_error_to_str
is deprecated; use
.Xr zip_error_init_with_code 3
and
.Xr zip_error_strerror 3
instead.
.Pp
Replace
.Bd -literal -offset indent
char buf[BUFSIZE];
zip_error_to_str(buf, sizeof(buf), ze, se);
printf("%s", buf);
.Ed
with
.Bd -literal -offset indent
zip_error_t error;
zip_error_init_with_code(&error, ze);
printf("%s", zip_error_strerror(&error));
zip_error_fini(&error);
.Ed
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_init_with_code 3 ,
.Xr zip_error_strerror 3
.Sh HISTORY
.Fn zip_error_to_str
was added in libzip 0.6.
In libzip 0.10 the type of
.Ar len
was changed from
.Vt size_t
to
.Vt zip_uint64_t .
It was deprecated in libzip 1.0, use
.Fn zip_error_init_with_code
and
.Fn zip_error_strerror
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,125 @@
.\" zip_errors.mdoc -- list of all libzip error codes
.\" Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" This file was generated automatically by ./make_zip_errors.sh
.\" from ../lib/zip.h; make changes there.
.\"
.Dd March 15, 2024
.Dt ZIP_ERRORS 3
.Os
.Sh NAME
.Nm zip_errors
.Nd list of all libzip error codes
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Sh DESCRIPTION
The following error codes are used by libzip:
.Bl -tag -width XZIPXERXCOMPNOTSUPPXX
.It Bq Er ZIP_ER_CANCELLED
Operation cancelled.
.It Bq Er ZIP_ER_CHANGED
Entry has been changed.
.It Bq Er ZIP_ER_CLOSE
Closing zip archive failed.
.It Bq Er ZIP_ER_COMPNOTSUPP
Compression method not supported.
.It Bq Er ZIP_ER_COMPRESSED_DATA
Compressed data invalid.
.It Bq Er ZIP_ER_CRC
CRC error.
.It Bq Er ZIP_ER_DATA_LENGTH
Unexpected length of data.
.It Bq Er ZIP_ER_DELETED
Entry has been deleted.
.It Bq Er ZIP_ER_ENCRNOTSUPP
Encryption method not supported.
.It Bq Er ZIP_ER_EOF
Premature end of file.
.It Bq Er ZIP_ER_EXISTS
File already exists.
.It Bq Er ZIP_ER_INCONS
Zip archive inconsistent.
.It Bq Er ZIP_ER_INTERNAL
Internal error.
.It Bq Er ZIP_ER_INUSE
Resource still in use.
.It Bq Er ZIP_ER_INVAL
Invalid argument.
.It Bq Er ZIP_ER_MEMORY
Malloc failure.
.It Bq Er ZIP_ER_MULTIDISK
Multi-disk zip archives not supported.
.It Bq Er ZIP_ER_NOENT
No such file.
.It Bq Er ZIP_ER_NOPASSWD
No password provided.
.It Bq Er ZIP_ER_NOT_ALLOWED
Not allowed in torrentzip.
.It Bq Er ZIP_ER_NOZIP
Not a zip archive.
.It Bq Er ZIP_ER_OK
No error.
.It Bq Er ZIP_ER_OPEN
Can't open file.
.It Bq Er ZIP_ER_OPNOTSUPP
Operation not supported.
.It Bq Er ZIP_ER_RDONLY
Read-only archive.
.It Bq Er ZIP_ER_READ
Read error.
.It Bq Er ZIP_ER_REMOVE
Can't remove file.
.It Bq Er ZIP_ER_RENAME
Renaming temporary file failed.
.It Bq Er ZIP_ER_SEEK
Seek error.
.It Bq Er ZIP_ER_TELL
Tell error.
.It Bq Er ZIP_ER_TMPOPEN
Failure to create temporary file.
.It Bq Er ZIP_ER_TRUNCATED_ZIP
Possibly truncated or corrupted zip archive.
.It Bq Er ZIP_ER_WRITE
Write error.
.It Bq Er ZIP_ER_WRONGPASSWD
Wrong password provided.
.It Bq Er ZIP_ER_ZIPCLOSED
Containing zip archive was closed.
.It Bq Er ZIP_ER_ZLIB
Zlib error.
.El
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,65 @@
.\" zip_fclose.mdoc -- close file in zip archive
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FCLOSE 3
.Os
.Sh NAME
.Nm zip_fclose
.Nd close file in zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_fclose "zip_file_t *file"
.Sh DESCRIPTION
The
.Fn zip_fclose
function closes
.Ar file
and frees the memory allocated for it.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, the error code is returned.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fread 3 ,
.Xr zip_fseek 3
.Sh HISTORY
.Fn zip_fclose
was added in libzip 0.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,149 @@
.\" zip_fdopen.mdoc -- open zip archive using existing file descriptor
.\" Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 23, 2022
.Dt ZIP_FDOPEN 3
.Os
.Sh NAME
.Nm zip_fdopen
.Nd open zip archive using open file descriptor
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_t *
.Fn zip_fdopen "int fd" "int flags" "int *errorp"
.Sh DESCRIPTION
The zip archive specified by the open file descriptor
.Ar fd
is opened and a pointer to a
.Ft struct zip ,
used to manipulate the archive, is returned.
In contrast to
.Xr zip_open 3 ,
using
.Nm zip_fdopen
the archive can only be opened in read-only mode.
The
.Ar fd
argument may not be used any longer after calling
.Nm zip_fdopen .
The
.Fa flags
are specified by
.Em or Ns No 'ing
the following values, or 0 for none of them.
.Bl -tag -offset indent -width ZIP_CHECKCONS
.It Dv ZIP_CHECKCONS
Perform additional stricter consistency checks on the archive, and
error if they fail.
.El
.Pp
If an error occurs and
.Ar errorp
is
.No non- Ns Dv NULL ,
it will be set to the corresponding error code.
.Sh RETURN VALUES
Upon successful completion
.Fn zip_fdopen
returns a
.Ft struct zip
pointer, and
.Ar fd
should not be used any longer, nor passed to
.Xr close 2 .
Otherwise,
.Dv NULL
is returned and
.Ar *errorp
is set to indicate the error.
In the error case,
.Ar fd
remains unchanged.
.Sh ERRORS
The file specified by
.Ar fd
is prepared for use by
.Xr libzip 3
unless:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INCONS
Inconsistencies were found in the file specified by
.Ar path .
This error is often caused by specifying
.Dv ZIP_CHECKCONS
but can also happen without it.
.It Bq Er ZIP_ER_INVAL
The
.Ar flags
argument is invalid.
Not all
.Xr zip_open 3
flags are allowed for
.Nm zip_fdopen ,
see
.Sx DESCRIPTION .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOZIP
The file specified by
.Ar fd
is not a zip archive.
.It Bq Er ZIP_ER_OPEN
The file specified by
.Ar fd
could not be prepared for use by
.Xr libzip 3 .
.It Bq Er ZIP_ER_OPNOTSUPP
This functionality has been disabled at compile time.
.It Bq Er ZIP_ER_READ
A read error occurred; see
.Va errno
for details.
.It Bq Er ZIP_ER_SEEK
The file specified by
.Ar fd
does not allow seeks.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3 ,
.Xr zip_error_strerror 3 ,
.Xr zip_open 3
.Sh HISTORY
.Fn zip_fdopen
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,175 @@
.\" zip_file_add.mdoc -- add files to zip archive
.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 18, 2024
.Dt ZIP_FILE_ADD 3
.Os
.Sh NAME
.Nm zip_file_add ,
.Nm zip_file_replace
.Nd add file to zip archive or replace file in zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_file_add "zip_t *archive" "const char *name" "zip_source_t *source" "zip_flags_t flags"
.Ft int
.Fn zip_file_replace "zip_t *archive" "zip_uint64_t index" "zip_source_t *source" "zip_flags_t flags"
.Sh DESCRIPTION
The function
.Fn zip_file_add
adds a file to a zip archive, while
.Fn zip_file_replace
replaces an existing file in a zip archive.
The argument
.Ar archive
specifies the zip archive to which the file should be added.
.Ar name
is the file's name in the zip archive (for
.Fn zip_file_add ) ,
while
.Ar index
specifies which file should be replaced (for
.Fn zip_file_replace ) .
The
.Ar flags
argument can be any combination of
.Dv ZIP_FL_OVERWRITE
with one of
.Dv ZIP_FL_ENC_* :
.Bl -tag -width XZIPXFLXENCXSTRICTXX
.It Dv ZIP_FL_OVERWRITE
Overwrite any existing file of the same name.
For
.Nm zip_file_add
only.
.It Dv ZIP_FL_ENC_GUESS
Guess encoding of
.Ar name
(default).
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_UTF_8
Interpret
.Ar name
as UTF-8.
.It Dv ZIP_FL_ENC_CP437
Interpret
.Ar name
as code page 437 (CP-437).
.El
The data is obtained from the
.Ar source
argument, see
.Xr zip_source 3 .
.Pp
.Em NOTE :
.Xr zip_source_free 3
should not be called on a
.Ar source
after it was used successfully in a
.Nm zip_file_add
or
.Nm zip_file_replace
call.
.Pp
Please also note that when using
.Nm zip_replace ,
the target file's extra field information will be deleted since this
usually is dependent on the file contents.
If you want to keep them, query them beforehand with
.Xr zip_file_extra_field_get 3
and restore them after
.Nm zip_replace
with
.Xr zip_file_extra_field_set 3 .
.Sh RETURN VALUES
Upon successful completion,
.Fn zip_file_add
returns the index of the new file in the archive, and
.Fn zip_file_replace
returns 0.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh EXAMPLES
.Bd -literal -offset indent
zip_source_t *s;
const char buf[]="teststring";
if ((s=zip_source_buffer(archive, buf, sizeof(buf), 0)) == NULL ||
zip_file_add(archive, name, s, ZIP_FL_ENC_UTF_8) < 0) {
zip_source_free(s);
printf("error adding file: %s\en", zip_strerror(archive));
}
.Ed
.Sh ERRORS
.Fn zip_file_add
and
.Fn zip_file_replace
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_EXISTS
There is already a file called
.Ar name
in the archive.
(Only applies to
.Fn zip_file_add ,
and only if
.Dv ZIP_FL_OVERWRITE
is not provided).
.It Bq Er ZIP_ER_INVAL
.Ar source
or
.Ar name
are
.Dv NULL ,
or
.Ar index
is invalid.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_RDONLY
Archive was opened in read-only mode.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_file_add
and
.Fn zip_file_replace
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,61 @@
.\" zip_file_attributes_init.mdoc -- initialize attributes structure
.\" Copyright (C) 2020 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 17, 2020
.Dt ZIP_FILE_ATTRIBUTES_INIT 3
.Os
.Sh NAME
.Nm zip_file_attributes_init
.Nd initialize zip file attributes structure
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_file_attributes_init "zip_file_attributes_t *attributes"
.Sh DESCRIPTION
The
.Fn zip_file_attributes_init
initializes a
.Vt zip_file_attributes_t
structure with default values.
It must be called before modifying such a structure for the first time.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source_function 3
.Sh HISTORY
.Fn zip_file_attributes_init
was added in libzip 1.7.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,69 @@
.\" zip_error_clear.mdoc -- clear error state for archive or file
.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_CLEAR 3
.Os
.Sh NAME
.Nm zip_error_clear ,
.Nm zip_file_error_clear
.Nd clear error state for archive or file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_clear "zip_t *archive"
.Ft void
.Fn zip_file_error_clear "zip_file_t *file"
.Sh DESCRIPTION
The
.Fn zip_error_clear
function clears the error state for the zip archive
.Ar archive .
.Pp
The
.Fn zip_file_error_clear
function does the same for the zip file
.Ar file .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_get_error 3
.Sh HISTORY
.Fn zip_error_clear
and
.Fn zip_file_error_clear
were added in libzip 0.8.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,117 @@
.\" zip_error_get.mdoc -- get error codes for archive or file
.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ERROR_GET 3
.Os
.Sh NAME
.Nm zip_error_get ,
.Nm zip_file_error_get
.Nd get error codes for archive or file (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_error_get "zip_t *archive" "int *zep" "int *sep"
.Ft void
.Fn zip_file_error_get "zip_file_t *file" "int *zep" "int *sep"
.Sh DESCRIPTION
The functions
.Fn zip_error_get
and
.Fn zip_file_error_get
are deprecated.
Use
.Xr zip_error_code_system 3 ,
.Xr zip_error_code_zip 3 ,
.Xr zip_file_get_error 3 ,
and
.Xr zip_get_error 3
instead.
.Pp
For
.Fn zip_error_get ,
replace
.Bd -literal -offset indent
int ze, se;
zip_error_get(za, &ze, &se);
.Ed
with
.Bd -literal -offset indent
int ze, se;
zip_error_t *error = zip_get_error(za);
ze = zip_error_code_zip(error);
se = zip_error_code_system(error);
.Ed
For
.Fn zip_file_error_get ,
replace
.Bd -literal -offset indent
int ze, se;
zip_file_error_get(zf, &ze, &se);
.Ed
with
.Bd -literal -offset indent
int ze, se;
zip_error_t *error = zip_file_get_error(zf);
ze = zip_error_code_zip(error);
se = zip_error_code_system(error);
.Ed
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_system 3 ,
.Xr zip_error_code_zip 3 ,
.Xr zip_file_get_error 3 ,
.Xr zip_get_error 3
.Sh HISTORY
.Fn zip_error_get
was added in libzip 0.6.
It was deprecated in libzip 1.0, use
.Fn zip_get_error ,
.Fn zip_error_code_zip ,
/
.Fn zip_error_code_system
instead.
.Pp
.Fn zip_file_error_get
was added in libzip 0.6.
It was deprecated in libzip 1.0, use
.Fn zip_file_get_error ,
.Fn zip_error_code_zip ,
/
.Fn zip_error_code_system
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,130 @@
.\" zip_file_extra_field_delete.mdoc -- delete extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELD_DELETE 3
.Os
.Sh NAME
.Nm zip_file_extra_field_delete ,
.Nm zip_file_extra_field_delete_by_id
.Nd delete extra field for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_extra_field_delete "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_flags_t flags"
.Ft int
.Fn zip_file_extra_field_delete_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_field_delete
function deletes the extra field with index
.Ar extra_field_index
for the file at position
.Ar index
in the zip archive.
.Pp
If
.Ar extra_field_index
is
.Dv ZIP_EXTRA_FIELD_ALL ,
then all extra fields will be deleted.
.Pp
The following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_CENTRALXX -offset indent
.It Dv ZIP_FL_CENTRAL
Delete extra fields from the archive's central directory.
.It Dv ZIP_FL_LOCAL
Delete extra fields from the local file headers.
.El
.Pp
The
.Fn zip_file_extra_field_delete_by_id
function deletes the extra field with ID (two-byte signature)
.Ar extra_field_id
and index
.Ar extra_field_index
(in other words, the
.Ar extra_field_index Ns No 'th
extra field with ID
.Ar extra_field_id )
The other arguments are the same as for
.Fn zip_file_extra_field_delete
.Dv ( ZIP_EXTRA_FIELD_ALL
will delete all extra fields of the specified ID).
.Pp
Please note that due to the library design, the index of an extra
field may be different between central directory and local file
headers.
For this reason, it is not allowed to specify both
.Dv ZIP_FL_CENTRAL
and
.Dv ZIP_FL_LOCAL
in
.Ar flags ,
except when deleting all extra fields (i.e.,
.Ar extra_field_index
being
.Dv ZIP_EXTRA_FIELD_ALL ) .
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_field_delete
and
.Fn zip_file_extra_field_delete_by_id
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_get 3 ,
.Xr zip_file_extra_field_set 3 ,
.Xr zip_file_extra_fields_count 3
.Sh HISTORY
.Fn zip_file_extra_field_delete
and
.Fn zip_file_extra_field_delete_by_id
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,130 @@
.\" zip_file_extra_field_delete.mdoc -- delete extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELD_DELETE 3
.Os
.Sh NAME
.Nm zip_file_extra_field_delete ,
.Nm zip_file_extra_field_delete_by_id
.Nd delete extra field for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_extra_field_delete "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_flags_t flags"
.Ft int
.Fn zip_file_extra_field_delete_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_field_delete
function deletes the extra field with index
.Ar extra_field_index
for the file at position
.Ar index
in the zip archive.
.Pp
If
.Ar extra_field_index
is
.Dv ZIP_EXTRA_FIELD_ALL ,
then all extra fields will be deleted.
.Pp
The following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_CENTRALXX -offset indent
.It Dv ZIP_FL_CENTRAL
Delete extra fields from the archive's central directory.
.It Dv ZIP_FL_LOCAL
Delete extra fields from the local file headers.
.El
.Pp
The
.Fn zip_file_extra_field_delete_by_id
function deletes the extra field with ID (two-byte signature)
.Ar extra_field_id
and index
.Ar extra_field_index
(in other words, the
.Ar extra_field_index Ns No 'th
extra field with ID
.Ar extra_field_id )
The other arguments are the same as for
.Fn zip_file_extra_field_delete
.Dv ( ZIP_EXTRA_FIELD_ALL
will delete all extra fields of the specified ID).
.Pp
Please note that due to the library design, the index of an extra
field may be different between central directory and local file
headers.
For this reason, it is not allowed to specify both
.Dv ZIP_FL_CENTRAL
and
.Dv ZIP_FL_LOCAL
in
.Ar flags ,
except when deleting all extra fields (i.e.,
.Ar extra_field_index
being
.Dv ZIP_EXTRA_FIELD_ALL ) .
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_field_delete
and
.Fn zip_file_extra_field_delete_by_id
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_get 3 ,
.Xr zip_file_extra_field_set 3 ,
.Xr zip_file_extra_fields_count 3
.Sh HISTORY
.Fn zip_file_extra_field_delete
and
.Fn zip_file_extra_field_delete_by_id
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,157 @@
.\" zip_file_extra_field_get.mdoc -- get extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELD_GET 3
.Os
.Sh NAME
.Nm zip_file_extra_field_get ,
.Nm zip_file_extra_field_get_by_id
.Nd get extra field for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const zip_uint8_t *
.Fn zip_file_extra_field_get "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_uint16_t *idp" "zip_uint16_t *lenp" "zip_flags_t flags"
.Ft const zip_uint8_t *
.Fn zip_file_extra_field_get_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_uint16_t *lenp" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_field_get
function returns the extra field with index
.Ar extra_field_index
for the file at position
.Ar index
in the zip archive.
This pointer should not be modified or
.Xr free 3 Ap d ,
and becomes invalid when
.Ar archive
is closed.
If
.Ar idp
is not
.Dv NULL ,
the integer to which it points will be set to the ID (two-byte
signature) of the selected extra field.
If
.Ar lenp
is not
.Dv NULL ,
the integer to which it points will be set to the length of the
extra field.
Generally speaking,
.Ar lenp
and
.Ar idp
should be passed since only the extra field data is returned (i.e.,
neither the ID nor the length, if the
.Ar idp
and
.Ar lenp
arguments are not provided).
.Pp
The following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_UNCHANGEDXX -offset indent
.It Dv ZIP_FL_CENTRAL
Return extra fields from the archive's central directory.
.It Dv ZIP_FL_LOCAL
Return extra fields from the local file headers.
.It Dv ZIP_FL_UNCHANGED
Return the original unchanged extra fields, ignoring any changes made.
.El
.Pp
The
.Fn zip_file_extra_field_get_by_id
function returns the extra field with ID (two-byte signature)
.Ar extra_field_id
and index
.Ar extra_field_index
(in other words, the
.Ar extra_field_index Ns No 'th
extra field with ID
.Ar extra_field_id )
The other arguments are the same as for
.Fn zip_file_extra_field_get .
.Sh RETURN VALUES
Upon successful completion, a pointer to an extra field is returned,
or
.Dv NULL
if there is no extra field with that
.Ar extra_field_index
for the file with index
.Ar index .
In case of an error,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_field_get
and
.Fn zip_file_extra_field_get_by_id
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive ,
or
.Ar extra_field_index
is not a valid extra file index (for ID
.Ar extra_field_id ) .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_delete 3 ,
.Xr zip_file_extra_field_set 3 ,
.Xr zip_file_extra_fields_count 3
.Sh HISTORY
.Fn zip_file_extra_field_get
and
.Fn zip_file_extra_field_get_by_id
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
Please note that the extra field IDs 0x0001 (ZIP64 extension),
0x6375 (Infozip UTF-8 comment), and
0x7075 (Infozip UTF-8 file name) can not be read using
.Fn zip_file_extra_field_get
since they are used by
.Xr libzip 3
internally.
@@ -0,0 +1,157 @@
.\" zip_file_extra_field_get.mdoc -- get extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELD_GET 3
.Os
.Sh NAME
.Nm zip_file_extra_field_get ,
.Nm zip_file_extra_field_get_by_id
.Nd get extra field for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const zip_uint8_t *
.Fn zip_file_extra_field_get "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_uint16_t *idp" "zip_uint16_t *lenp" "zip_flags_t flags"
.Ft const zip_uint8_t *
.Fn zip_file_extra_field_get_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_uint16_t *lenp" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_field_get
function returns the extra field with index
.Ar extra_field_index
for the file at position
.Ar index
in the zip archive.
This pointer should not be modified or
.Xr free 3 Ap d ,
and becomes invalid when
.Ar archive
is closed.
If
.Ar idp
is not
.Dv NULL ,
the integer to which it points will be set to the ID (two-byte
signature) of the selected extra field.
If
.Ar lenp
is not
.Dv NULL ,
the integer to which it points will be set to the length of the
extra field.
Generally speaking,
.Ar lenp
and
.Ar idp
should be passed since only the extra field data is returned (i.e.,
neither the ID nor the length, if the
.Ar idp
and
.Ar lenp
arguments are not provided).
.Pp
The following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_UNCHANGEDXX -offset indent
.It Dv ZIP_FL_CENTRAL
Return extra fields from the archive's central directory.
.It Dv ZIP_FL_LOCAL
Return extra fields from the local file headers.
.It Dv ZIP_FL_UNCHANGED
Return the original unchanged extra fields, ignoring any changes made.
.El
.Pp
The
.Fn zip_file_extra_field_get_by_id
function returns the extra field with ID (two-byte signature)
.Ar extra_field_id
and index
.Ar extra_field_index
(in other words, the
.Ar extra_field_index Ns No 'th
extra field with ID
.Ar extra_field_id )
The other arguments are the same as for
.Fn zip_file_extra_field_get .
.Sh RETURN VALUES
Upon successful completion, a pointer to an extra field is returned,
or
.Dv NULL
if there is no extra field with that
.Ar extra_field_index
for the file with index
.Ar index .
In case of an error,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_field_get
and
.Fn zip_file_extra_field_get_by_id
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive ,
or
.Ar extra_field_index
is not a valid extra file index (for ID
.Ar extra_field_id ) .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_delete 3 ,
.Xr zip_file_extra_field_set 3 ,
.Xr zip_file_extra_fields_count 3
.Sh HISTORY
.Fn zip_file_extra_field_get
and
.Fn zip_file_extra_field_get_by_id
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
Please note that the extra field IDs 0x0001 (ZIP64 extension),
0x6375 (Infozip UTF-8 comment), and
0x7075 (Infozip UTF-8 file name) can not be read using
.Fn zip_file_extra_field_get
since they are used by
.Xr libzip 3
internally.
@@ -0,0 +1,115 @@
.\" zip_file_extra_field_set.mdoc -- set extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELD_SET 3
.Os
.Sh NAME
.Nm zip_file_extra_field_set
.Nd set extra field for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_extra_field_set "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "const zip_uint8_t *extra_field_data" "zip_uint16_t len" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_field_set
function sets the extra field with ID (two-byte signature)
.Ar extra_field_id
and index
.Ar extra_field_index
for the file at position
.Ar index
in the zip archive.
The extra field's data will be set to
.Ar extra_field_data
and length
.Ar len .
If a new entry shall be appended, set
.Ar extra_field_index
to
.Dv ZIP_EXTRA_FIELD_NEW .
.Pp
At least one of the following
.Ar flags
must be set:
.Bl -tag -width ZIP_FL_CENTRALXX -offset indent
.It Dv ZIP_FL_CENTRAL
Set extra field in the archive's central directory.
.It Dv ZIP_FL_LOCAL
Set extra field in the local file headers.
.El
.Pp
Please note that the extra field IDs 0x0001 (ZIP64 extension),
0x6375 (Infozip UTF-8 comment), and
0x7075 (Infozip UTF-8 file name) can not be set using
.Fn zip_file_extra_field_set
since they are set by
.Xr libzip 3
automatically when needed.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_field_set
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
The extra field size is too large (ID and length need 4 bytes; the
maximum length of all extra fields for one file combined is 65536
bytes).
This error also occurs if
.Ar extra_field_index
is too large.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_delete 3 ,
.Xr zip_file_extra_field_get 3 ,
.Xr zip_file_extra_fields_count 3
.Sh HISTORY
.Fn zip_file_extra_field_set
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,113 @@
.\" zip_file_extra_fields_count.mdoc -- count extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELDS_COUNT 3
.Os
.Sh NAME
.Nm zip_file_extra_fields_count ,
.Nm zip_file_extra_fields_count_by_id
.Nd count extra fields for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int16_t
.Fn zip_file_extra_fields_count "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags"
.Ft zip_int16_t
.Fn zip_file_extra_fields_count_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_fields_count
function counts the extra fields for the file at position
.Ar index
in the zip archive.
.Pp
The following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_CENTRALXX -offset indent
.It Dv ZIP_FL_CENTRAL
Count extra fields from the archive's central directory.
.It Dv ZIP_FL_LOCAL
Count extra fields from the local file headers.
.It Dv ZIP_FL_UNCHANGED
Count the original unchanged extra fields, ignoring any changes made.
.El
.Pp
The
.Fn zip_file_extra_fields_count_by_id
function counts the extra fields with ID (two-byte signature)
.Ar extra_field_id .
The other arguments are the same as for
.Fn zip_file_extra_fields_count .
.Pp
Extra fields that are the same in the central directory and the local file
header are merged into one.
Therefore, the counts with
.Dv ZIP_FL_CENTRAL
and
.Dv ZIP_FL_LOCAL
do not need to add up to the same value as when given
.Dv ZIP_FL_CENTRAL|ZIP_FL_LOCAL
at the same time.
.Sh RETURN VALUES
Upon successful completion, the requested number of extra fields is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_fields_count
and
.Fn zip_file_extra_fields_count_by_id
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive .
.\" TODO: _zip_read_local_ef errors
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_delete 3 ,
.Xr zip_file_extra_field_get 3 ,
.Xr zip_file_extra_field_set 3
.Sh HISTORY
.Fn zip_file_extra_fields_count
and
.Fn zip_file_extra_fields_count_by_id
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,113 @@
.\" zip_file_extra_fields_count.mdoc -- count extra field for file in zip
.\" Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_EXTRA_FIELDS_COUNT 3
.Os
.Sh NAME
.Nm zip_file_extra_fields_count ,
.Nm zip_file_extra_fields_count_by_id
.Nd count extra fields for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int16_t
.Fn zip_file_extra_fields_count "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags"
.Ft zip_int16_t
.Fn zip_file_extra_fields_count_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_extra_fields_count
function counts the extra fields for the file at position
.Ar index
in the zip archive.
.Pp
The following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_CENTRALXX -offset indent
.It Dv ZIP_FL_CENTRAL
Count extra fields from the archive's central directory.
.It Dv ZIP_FL_LOCAL
Count extra fields from the local file headers.
.It Dv ZIP_FL_UNCHANGED
Count the original unchanged extra fields, ignoring any changes made.
.El
.Pp
The
.Fn zip_file_extra_fields_count_by_id
function counts the extra fields with ID (two-byte signature)
.Ar extra_field_id .
The other arguments are the same as for
.Fn zip_file_extra_fields_count .
.Pp
Extra fields that are the same in the central directory and the local file
header are merged into one.
Therefore, the counts with
.Dv ZIP_FL_CENTRAL
and
.Dv ZIP_FL_LOCAL
do not need to add up to the same value as when given
.Dv ZIP_FL_CENTRAL|ZIP_FL_LOCAL
at the same time.
.Sh RETURN VALUES
Upon successful completion, the requested number of extra fields is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_extra_fields_count
and
.Fn zip_file_extra_fields_count_by_id
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_NOENT
.Ar index
is not a valid file index in
.Ar archive .
.\" TODO: _zip_read_local_ef errors
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_extra_field_delete 3 ,
.Xr zip_file_extra_field_get 3 ,
.Xr zip_file_extra_field_set 3
.Sh HISTORY
.Fn zip_file_extra_fields_count
and
.Fn zip_file_extra_fields_count_by_id
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,119 @@
.\" zip_file_get_comment.mdoc -- get comment for file in zip
.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 22, 2020
.Dt ZIP_FILE_GET_COMMENT 3
.Os
.Sh NAME
.Nm zip_file_get_comment
.Nd get comment for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_file_get_comment "zip_t *archive" "zip_uint64_t index" "zip_uint32_t *lenp" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_get_comment
function returns the comment for the file at position
.Ar index
in the zip archive.
The name is in UTF-8 encoding unless
.Dv ZIP_FL_ENC_RAW
was specified (see below).
This pointer should not be modified or
.Xr free 3 Ap d ,
and becomes invalid when
.Ar archive
is closed.
If
.Ar lenp
is not
.Dv NULL ,
the integer to which it points will be set to the length of the
comment.
If
.Ar flags
is set to
.Dv ZIP_FL_UNCHANGED ,
the original unchanged comment is returned.
.Pp
Additionally, the following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_ENC_STRICTXX -offset indent
.It Dv ZIP_FL_ENC_RAW
Return the unmodified comment as it is in the ZIP archive.
.It Dv ZIP_FL_ENC_GUESS
(Default.)
Guess the encoding of the comment in the ZIP archive and convert it
to UTF-8, if necessary.
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_STRICT
Follow the ZIP specification for file names and extend it to file
comments, expecting them to be encoded in CP-437 in the ZIP archive
(except if it is a UTF-8 comment from the special extra field).
Convert it to UTF-8.
.El
.Em Note :
ASCII is a subset of both CP-437 and UTF-8.
.Sh RETURN VALUES
Upon successful completion, a pointer to the comment is returned,
or
.Dv NULL
if there is no comment.
In case of an error,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_get_comment
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_set_comment 3 ,
.Xr zip_get_archive_comment 3
.Sh HISTORY
.Fn zip_file_get_comment
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,57 @@
.\" zip_file_get_error.mdoc -- extract zip_error from zip_file
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_GET_ERROR 3
.Os
.Sh NAME
.Nm zip_file_get_error
.Nd extract zip_error from zip_file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_error_t *
.Fn zip_file_get_error "zip_file_t *zf"
.Sh DESCRIPTION
.Fn zip_file_get_error
function returns the zip_error associated with the zip_file
.Ar zf .
.Sh SEE ALSO
.Xr libzip 3
.Sh HISTORY
.Fn zip_file_get_error
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,165 @@
.\" zip_file_get_external_attributes.mdoc -- get external attributes for file in zip
.\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_GET_EXTERNAL_ATTRIBUTES 3
.Os
.Sh NAME
.Nm zip_file_get_external_attributes
.Nd get external attributes for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_get_external_attributes "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "zip_uint8_t *opsys" "zip_uint32_t *attributes"
.Sh DESCRIPTION
The
.Fn zip_file_get_external_attributes
function returns the operating system and external attributes for the
file at position
.Ar index
in the zip archive.
The external attributes usually contain the operating system-specific
file permissions.
If
.Ar flags
is set to
.Dv ZIP_FL_UNCHANGED ,
the original unchanged values are returned.
If
.Ar opsys
or
.Ar attributes
are
.Dv NULL ,
they are not filled in.
.Pp
The following operating systems are defined by the zip specification:
.Bl -item -compact -offset indent
.It
.Dv ZIP_OPSYS_ACORN_RISC
.It
.Dv ZIP_OPSYS_ALTERNATE_MVS
.It
.Dv ZIP_OPSYS_AMIGA
.It
.Dv ZIP_OPSYS_ATARI_ST
.It
.Dv ZIP_OPSYS_BEOS
.It
.Dv ZIP_OPSYS_CPM
.It
.Dv ZIP_OPSYS_DOS
.It
.Dv ZIP_OPSYS_MACINTOSH
.It
.Dv ZIP_OPSYS_MVS
.It
.Dv ZIP_OPSYS_OPENVMS
.It
.Dv ZIP_OPSYS_OS_2
.It
.Dv ZIP_OPSYS_OS_400
.It
.Dv ZIP_OPSYS_OS_X
.It
.Dv ZIP_OPSYS_TANDEM
.It
.Dv ZIP_OPSYS_UNIX
.It
.Dv ZIP_OPSYS_VFAT
.It
.Dv ZIP_OPSYS_VM_CMS
.It
.Dv ZIP_OPSYS_VSE
.It
.Dv ZIP_OPSYS_WINDOWS_NTFS
(uncommon, use
.Dv ZIP_OPSYS_DOS
instead)
.It
.Dv ZIP_OPSYS_Z_SYSTEM
.El
.Pp
The defines above follow the PKWARE Inc. Appnote; please note that
the InfoZIP Appnote has a slightly different mapping.
.Sh RETURN VALUES
Upon successful completion, 0 is returned.
In case of an error,
.Dv \-1
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh EXAMPLES
The following code can be used to expand
.Ar attributes
if the operating system is
.Dv ZIP_OPSYS_DOS .
.Bd -literal
#include <sys/stat.h>
#define FA_RDONLY 0x01 // FILE_ATTRIBUTE_READONLY
#define FA_DIREC 0x10 // FILE_ATTRIBUTE_DIRECTORY
static mode_t
_zip_dos_attr2mode(zip_uint32_t attr)
{
mode_t m = S_IRUSR | S_IRGRP | S_IROTH;
if (0 == (attr & FA_RDONLY))
m |= S_IWUSR | S_IWGRP | S_IWOTH;
if (attr & FA_DIREC)
m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH;
return m;
}
.Ed
.Sh ERRORS
.Fn zip_file_get_external_attributes
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive .
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_set_external_attributes 3
.Sh HISTORY
.Fn zip_file_get_external_attributes
was added in libzip 0.11.2.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,89 @@
.\" zip_fseek.mdoc -- seek in file
.\" Copyright (C) 2016-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 11, 2024
.Dt ZIP_FSEEK 3
.Os
.Sh NAME
.Nm zip_fseek ,
.Nm zip_file_is_seekable
.Nd seek in file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int8_t
.Fn zip_fseek "zip_file_t *file" "zip_int64_t offset" "int whence"
.Ft int
.Fn zip_file_is_seekable "zip_file_t *file"
.Sh DESCRIPTION
The
.Fn zip_fseek
function seeks to the specified
.Ar offset
relative to
.Ar whence ,
just like
.Xr fseek 3 .
.Pp
.Nm
only works on uncompressed (stored), unencrypted data.
When called on compressed or encrypted data it will return an error.
.Pp
The
.Fn zip_file_is_seekable
function returns 1 if a file is seekable.
.Sh RETURN VALUES
If successful,
.Fn zip_fseek
returns 0.
Otherwise, \-1 is returned.
.Pp
.Fn zip_file_is_seekable
returns 1 if a file is seekable and 0 if not.
On an invalid argument, it returns \-1.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_file_get_error 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fread 3 ,
.Xr zip_ftell 3
.Sh HISTORY
.Fn zip_fseek
was added in libzip 1.2.0.
.Fn zip_file_is_seekable
was added in libzip 1.9.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,104 @@
.\" zip_file_rename.mdoc -- rename file in zip archive
.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 22, 2020
.Dt ZIP_FILE_RENAME 3
.Os
.Sh NAME
.Nm zip_file_rename
.Nd rename file in zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_rename "zip_t *archive" "zip_uint64_t index" "const char *name" "zip_flags_t flags"
.Sh DESCRIPTION
The file at position
.Ar index
in the zip archive
.Ar archive
is renamed to
.Ar name .
The
.Ar flags
argument can be any of:
.Bl -tag -width XZIPXFLXENCXSTRICTXX
.It Dv ZIP_FL_ENC_GUESS
Guess encoding of
.Ar name
(default).
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_UTF_8
Interpret
.Ar name
as UTF-8.
.It Dv ZIP_FL_ENC_CP437
Interpret
.Ar name
as code page 437 (CP-437).
.El
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_rename
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_DELETED
The file to be renamed has been deleted from the archive.
.It Bq Er ZIP_ER_EXISTS
There is already a file called
.Ar name
in the archive.
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive ,
.Ar name is
.Dv NULL ,
the empty string, or not a valid UTF-8 encoded string.
Also a file cannot be renamed to a directory or vice versa.
Directories are denoted by a trailing slash.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_unchange 3
.Sh HISTORY
.Fn zip_file_rename
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,175 @@
.\" zip_file_add.mdoc -- add files to zip archive
.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 18, 2024
.Dt ZIP_FILE_ADD 3
.Os
.Sh NAME
.Nm zip_file_add ,
.Nm zip_file_replace
.Nd add file to zip archive or replace file in zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_file_add "zip_t *archive" "const char *name" "zip_source_t *source" "zip_flags_t flags"
.Ft int
.Fn zip_file_replace "zip_t *archive" "zip_uint64_t index" "zip_source_t *source" "zip_flags_t flags"
.Sh DESCRIPTION
The function
.Fn zip_file_add
adds a file to a zip archive, while
.Fn zip_file_replace
replaces an existing file in a zip archive.
The argument
.Ar archive
specifies the zip archive to which the file should be added.
.Ar name
is the file's name in the zip archive (for
.Fn zip_file_add ) ,
while
.Ar index
specifies which file should be replaced (for
.Fn zip_file_replace ) .
The
.Ar flags
argument can be any combination of
.Dv ZIP_FL_OVERWRITE
with one of
.Dv ZIP_FL_ENC_* :
.Bl -tag -width XZIPXFLXENCXSTRICTXX
.It Dv ZIP_FL_OVERWRITE
Overwrite any existing file of the same name.
For
.Nm zip_file_add
only.
.It Dv ZIP_FL_ENC_GUESS
Guess encoding of
.Ar name
(default).
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_UTF_8
Interpret
.Ar name
as UTF-8.
.It Dv ZIP_FL_ENC_CP437
Interpret
.Ar name
as code page 437 (CP-437).
.El
The data is obtained from the
.Ar source
argument, see
.Xr zip_source 3 .
.Pp
.Em NOTE :
.Xr zip_source_free 3
should not be called on a
.Ar source
after it was used successfully in a
.Nm zip_file_add
or
.Nm zip_file_replace
call.
.Pp
Please also note that when using
.Nm zip_replace ,
the target file's extra field information will be deleted since this
usually is dependent on the file contents.
If you want to keep them, query them beforehand with
.Xr zip_file_extra_field_get 3
and restore them after
.Nm zip_replace
with
.Xr zip_file_extra_field_set 3 .
.Sh RETURN VALUES
Upon successful completion,
.Fn zip_file_add
returns the index of the new file in the archive, and
.Fn zip_file_replace
returns 0.
Otherwise, \-1 is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh EXAMPLES
.Bd -literal -offset indent
zip_source_t *s;
const char buf[]="teststring";
if ((s=zip_source_buffer(archive, buf, sizeof(buf), 0)) == NULL ||
zip_file_add(archive, name, s, ZIP_FL_ENC_UTF_8) < 0) {
zip_source_free(s);
printf("error adding file: %s\en", zip_strerror(archive));
}
.Ed
.Sh ERRORS
.Fn zip_file_add
and
.Fn zip_file_replace
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_EXISTS
There is already a file called
.Ar name
in the archive.
(Only applies to
.Fn zip_file_add ,
and only if
.Dv ZIP_FL_OVERWRITE
is not provided).
.It Bq Er ZIP_ER_INVAL
.Ar source
or
.Ar name
are
.Dv NULL ,
or
.Ar index
is invalid.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_RDONLY
Archive was opened in read-only mode.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_file_add
and
.Fn zip_file_replace
were added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,116 @@
.\" zip_file_set_comment.mdoc -- set comment for file in zip
.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 22, 2020
.Dt ZIP_FILE_SET_COMMENT 3
.Os
.Sh NAME
.Nm zip_file_set_comment
.Nd set comment for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_set_comment "zip_t *archive" "zip_uint64_t index" "const char *comment" "zip_uint16_t len" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_set_comment
function sets the comment for the file at position
.Ar index
in the zip archive to
.Ar comment
of length
.Ar len .
If
.Ar comment
is
.Dv NULL
and
.Ar len
is 0, the file comment will be removed.
The
.Ar flags
argument can be any of:
.Bl -tag -width XZIPXFLXENCXSTRICTXX
.It Dv ZIP_FL_ENC_GUESS
Guess encoding of
.Ar comment
(default).
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_UTF_8
Interpret
.Ar comment
as UTF-8.
.It Dv ZIP_FL_ENC_CP437
Interpret
.Ar comment
as code page 437 (CP-437).
.El
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_set_comment
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive ,
or
.Ar len
is less than 0 or longer than the maximum comment length in a zip file
(65535), or
.Ar comment
is not a valid UTF-8 encoded string.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_RDONLY
The
.Ar archive
was opened in read-only mode.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_get_comment 3 ,
.Xr zip_get_archive_comment 3 ,
.Xr zip_set_archive_comment 3
.Sh HISTORY
.Fn zip_file_set_comment
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,126 @@
.\" zip_file_set_mtime.mdoc -- set mtime for file in zip
.\" Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 18, 2022
.Dt ZIP_FILE_SET_MTIME 3
.Os
.Sh NAME
.Nm zip_file_set_dostime ,
.Nm zip_file_set_mtime
.Nd set last modification time (mtime) for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_set_dostime "zip_t *archive" "zip_uint64_t index" "zip_uint16_t dostime" "zip_uint16_t dosdate" "zip_flags_t flags"
.Ft int
.Fn zip_file_set_mtime "zip_t *archive" "zip_uint64_t index" "time_t mtime" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_set_mtime
function sets the last modification time (mtime) for the file at
position
.Ar index
in the zip archive to
.Ar mtime .
Currently, no support for any
.Ar flags
is implemented.
.Pp
In the zip archive, the time and date are saved as two 16-bit integers.
To set the values directly, call the
.Fn zip_file_set_dostime
function.
The values of the time bytes are defined as follows:
.Bl -tag -width 5n -offset indent
.It 0-4
seconds divided by two (1-2 = 1, 3-4 = 2, ...)
.It 5-10
minute (0-59)
.It 11-15
hour (0-23)
.El
.Pp
The values of the date bytes are defined as follows:
.Bl -tag -width 5n -offset indent
.It 0-4
day of the month (1-31)
.It 5-8
month (January = 1, February = 2, ...)
.It 9-15
year offset from 1980 (1980 = 0, 1981 = 1, ...)
.El
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_set_dostime
and
.Fn zip_file_set_mtime
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_OPNOTSUPP
Traditional PKWare encryption uses the file's mtime, therefore it cannot be changed without re-encrypting the data.
.It Bq Er ZIP_ER_RDONLY
The
.Ar archive
was opened in read-only mode.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_stat 3
.Sh HISTORY
.Fn zip_file_set_mtime
was added in libzip 1.0.
.Fn zip_file_set_dostime
was added in libzip 1.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
Following historical practice, the
.Fn zip_file_set_mtime
function translates the time from the zip archive into the local time
zone.
If you want to avoid this, use the
.Fn zip_file_set_dostime
function instead.
@@ -0,0 +1,121 @@
.\" zip_file_set_encryption.mdoc -- set encryption method for file
.\" Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 2, 2020
.Dt ZIP_FILE_SET_ENCRYPTION 3
.Os
.Sh NAME
.Nm zip_file_set_encryption
.Nd set encryption method for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_set_encryption "zip_t *archive" "zip_uint64_t index" "zip_uint16_t method" "const char *password"
.Sh DESCRIPTION
The
.Fn zip_file_set_encryption
function sets the encryption method for the file at position
.Ar index
in the zip archive to
.Ar method
using the password
.Ar password .
The
.Ar method
is the same as returned by
.Xr zip_stat 3 .
For the
.Ar method
argument, currently only the following values are supported:
.Bl -tag -width ZIP_CM_DEFLATE_XX
.It Dv ZIP_EM_NONE
No encryption.
.It Dv ZIP_EM_AES_128
Winzip AES-128 encryption.
.It Dv ZIP_EM_AES_192
Winzip AES-192 encryption.
.It Dv ZIP_EM_AES_256
Winzip AES-256 encryption.
.It Dv ZIP_EM_TRAD_PKWARE
Traditional PKWare encryption.
Do not use this method, it is not secure.
It is only provided for backwards compatibility.
.El
.Pp
If
.Ar password
is
.Dv NULL ,
the default password provided by
.Xr zip_set_default_password 3
is used.
.Pp
The current encryption method for a file in a zip archive can be
determined using
.Xr zip_stat 3 .
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_set_encryption
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_ENCRNOTSUPP
Unsupported compression method requested.
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive ,
or the argument combination is invalid.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_RDONLY
Read-only zip file, no changes allowed.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_encryption_method_supported 3 ,
.Xr zip_fopen_encrypted 3 ,
.Xr zip_fopen_index_encrypted 3 ,
.Xr zip_set_default_password 3 ,
.Xr zip_stat 3
.Sh HISTORY
.Fn zip_file_set_encryption
was added in libzip 1.2.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,89 @@
.\" zip_file_set_external_attributes.mdoc -- set external attributes for file in zip
.\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_SET_EXTERNAL_ATTRIBUTES 3
.Os
.Sh NAME
.Nm zip_file_set_external_attributes
.Nd set external attributes for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_set_external_attributes "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "zip_uint8_t opsys" "zip_uint32_t attributes"
.Sh DESCRIPTION
The
.Fn zip_file_set_external_attributes
function sets the operating system and external attributes for the
file at position
.Ar index
in the zip archive.
Currently, no
.Ar flags
are supported.
.Pp
For a list of known
.Ar opsys
values, see
.Xr zip_file_get_external_attributes 3 .
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_set_external_attributes
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_RDONLY
The
.Ar archive
was opened in read-only mode.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_get_external_attributes 3
.Sh HISTORY
.Fn zip_file_set_external_attributes
was added in libzip 0.11.2.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,126 @@
.\" zip_file_set_mtime.mdoc -- set mtime for file in zip
.\" Copyright (C) 2014-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 18, 2022
.Dt ZIP_FILE_SET_MTIME 3
.Os
.Sh NAME
.Nm zip_file_set_dostime ,
.Nm zip_file_set_mtime
.Nd set last modification time (mtime) for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_file_set_dostime "zip_t *archive" "zip_uint64_t index" "zip_uint16_t dostime" "zip_uint16_t dosdate" "zip_flags_t flags"
.Ft int
.Fn zip_file_set_mtime "zip_t *archive" "zip_uint64_t index" "time_t mtime" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_file_set_mtime
function sets the last modification time (mtime) for the file at
position
.Ar index
in the zip archive to
.Ar mtime .
Currently, no support for any
.Ar flags
is implemented.
.Pp
In the zip archive, the time and date are saved as two 16-bit integers.
To set the values directly, call the
.Fn zip_file_set_dostime
function.
The values of the time bytes are defined as follows:
.Bl -tag -width 5n -offset indent
.It 0-4
seconds divided by two (1-2 = 1, 3-4 = 2, ...)
.It 5-10
minute (0-59)
.It 11-15
hour (0-23)
.El
.Pp
The values of the date bytes are defined as follows:
.Bl -tag -width 5n -offset indent
.It 0-4
day of the month (1-31)
.It 5-8
month (January = 1, February = 2, ...)
.It 9-15
year offset from 1980 (1980 = 0, 1981 = 1, ...)
.El
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_file_set_dostime
and
.Fn zip_file_set_mtime
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_OPNOTSUPP
Traditional PKWare encryption uses the file's mtime, therefore it cannot be changed without re-encrypting the data.
.It Bq Er ZIP_ER_RDONLY
The
.Ar archive
was opened in read-only mode.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_stat 3
.Sh HISTORY
.Fn zip_file_set_mtime
was added in libzip 1.0.
.Fn zip_file_set_dostime
was added in libzip 1.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
Following historical practice, the
.Fn zip_file_set_mtime
function translates the time from the zip archive into the local time
zone.
If you want to avoid this, use the
.Fn zip_file_set_dostime
function instead.
@@ -0,0 +1,85 @@
.\" zip_file_strerror.mdoc -- get string representation for a zip error
.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FILE_STRERROR 3
.Os
.Sh NAME
.Nm zip_file_strerror ,
.Nm zip_strerror
.Nd get string representation for a zip error
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_file_strerror "zip_file_t *file"
.Ft const char *
.Fn zip_strerror "zip_t *archive"
.Sh DESCRIPTION
The
.Fn zip_strerror
function returns a string describing the last error for the zip archive
.Ar archive ,
while the
.Fn zip_file_strerror
function does the same for a zip file
.Ar file
(one file in an archive).
The returned string must not be modified or freed, and becomes invalid when
.Ar archive
or
.Ar file ,
respectively,
is closed or on the next call to
.Fn zip_strerror
or
.Fn zip_file_strerror ,
respectively,
for the same archive.
.Sh RETURN VALUES
.Fn zip_file_strerror
and
.Fn zip_strerror
return a pointer to the error string.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_strerror 3
.Sh HISTORY
.Fn zip_file_strerror
and
.Fn zip_strerror
were added in libzip 0.6.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,148 @@
.\" zip_fopen.mdoc -- open file in zip archive for reading
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FOPEN 3
.Os
.Sh NAME
.Nm zip_fopen ,
.Nm zip_fopen_index
.Nd open file in zip archive for reading
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_file_t *
.Fn zip_fopen "zip_t *archive" "const char *fname" "zip_flags_t flags"
.Ft zip_file_t *
.Fn zip_fopen_index "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_fopen
function opens the file name
.Ar fname
in
.Ar archive .
The
.Ar flags
argument specifies how the name lookup should be done, according to
the values are described in
.Xr zip_name_locate 3 .
Also, the following values may be
.Em or Ns No 'ed
to it.
.Bl -tag -offset indent -width ZIP_FL_COMPRESSED
.It Dv ZIP_FL_COMPRESSED
Read the compressed data.
Otherwise the data is uncompressed by
.Fn zip_fread .
.It Dv ZIP_FL_UNCHANGED
Read the original data from the zip archive, ignoring any changes made
to the file; this is not supported by all data sources.
.El
.Pp
The
.Fn zip_fopen_index
function opens the file at position
.Ar index .
.Pp
If encrypted data is encountered, the functions call
.Xr zip_fopen_encrypted 3
or
.Xr zip_fopen_index_encrypted 3
respectively, using the default password set with
.Xr zip_set_default_password 3 .
.Sh RETURN VALUES
Upon successful completion, a
.Ft struct zip_file
pointer is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er ZIP_ER_CHANGED
The file data has been changed and the data source does
not support rereading data.
.It Bq Er ZIP_ER_COMPNOTSUPP
The compression method used is not supported.
.It Bq Er ZIP_ER_ENCRNOTSUPP
The encryption method used is not supported.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOPASSWD
The file is encrypted, but no password has been provided.
.It Bq Er ZIP_ER_READ
A file read error occurred.
.It Bq Er ZIP_ER_SEEK
A file seek error occurred.
.It Bq Er ZIP_ER_WRONGPASSWD
The provided password does not match the password used for encryption.
Note that some incorrect passwords are not detected by the check done by
.Fn zip_fopen .
.It Bq Er ZIP_ER_ZLIB
Initializing the zlib stream failed.
.El
.Pp
The function
.Fn zip_fopen
may also fail and set
.Va zip_err
for any of the errors specified for the routine
.Xr zip_name_locate 3 .
.Pp
The function
.Fn zip_fopen_index
may also fail with
.Er ZIP_ER_INVAL
if
.Ar index
is invalid.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_fread 3 ,
.Xr zip_fseek 3 ,
.Xr zip_get_num_entries 3 ,
.Xr zip_name_locate 3 ,
.Xr zip_set_default_password 3
.Sh HISTORY
.Fn zip_fopen
and
.Fn zip_fopen_index
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,135 @@
.\" zip_fopen_encrypted.mdoc -- open encrypted file in zip archive for reading
.\" Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 15, 2020
.Dt ZIP_FOPEN_ENCRYPTED 3
.Os
.Sh NAME
.Nm zip_fopen_encrypted ,
.Nm zip_fopen_index_encrypted
.Nd open encrypted file in zip archive for reading
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_file_t *
.Fn zip_fopen_encrypted "zip_t *archive" "const char *fname" "zip_flags_t flags" "const char *password"
.Ft zip_file_t *
.Fn zip_fopen_index_encrypted "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "const char *password"
.Sh DESCRIPTION
The
.Fn zip_fopen_encrypted
function opens the encrypted file name
.Ar fname
in
.Ar archive
using the password given in the
.Ar password
argument.
If
.Ar password
is
.Dv NULL
or the empty string, the default password is used (see
.Xr zip_set_default_password 3 ) .
The
.Ar flags
argument are the same as for
.Xr zip_fopen 3 .
.Pp
The
.Fn zip_fopen_index_encrypted
function opens the file at position
.Ar index ,
see
.Xr zip_fopen_index 3 .
These functions are called automatically by
.Xr zip_fopen 3 ;
you only need to call them if you want to specify a non-default password
(see
.Xr zip_set_default_password 3 ) .
.Sh RETURN VALUES
Upon successful completion, a
.Ft struct zip_file
pointer is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Bl -tag -width ZIP_ER_ENCRNOTSUPPXX
.It Bq Er ZIP_ER_NOPASSWD
No password was provided.
.El
.Pp
The function
.Fn zip_fopen_encrypted
may also fail and set
.Va zip_err
for any of the errors specified for the routine
.Xr zip_fopen 3 .
.Pp
The function
.Fn zip_fopen_index_encrypted
may also fail and set
.Va zip_err
for any of the errors specified for the routine
.Xr zip_fopen_index 3 .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fread 3 ,
.Xr zip_get_num_entries 3 ,
.Xr zip_name_locate 3
.Sh HISTORY
.Fn zip_fopen_encrypted
and
.Fn zip_fopen_index_encrypted
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
The zip file format provides very limited possibility for password
verification (a short hash of is compared against one byte in the zip
archive).
For this reason, reading a file while using an incorrect password may
immediately fail with
.Er ZIP_ER_WRONGPASSWD ,
but if the mismatch is not detected, a zlib error may be returned
later instead.
Since zlib errors can also be caused by broken compressed data, there
is no way to make sure if the password was incorrect or if it was
correct, but the compressed data was invalid.
@@ -0,0 +1,148 @@
.\" zip_fopen.mdoc -- open file in zip archive for reading
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_FOPEN 3
.Os
.Sh NAME
.Nm zip_fopen ,
.Nm zip_fopen_index
.Nd open file in zip archive for reading
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_file_t *
.Fn zip_fopen "zip_t *archive" "const char *fname" "zip_flags_t flags"
.Ft zip_file_t *
.Fn zip_fopen_index "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_fopen
function opens the file name
.Ar fname
in
.Ar archive .
The
.Ar flags
argument specifies how the name lookup should be done, according to
the values are described in
.Xr zip_name_locate 3 .
Also, the following values may be
.Em or Ns No 'ed
to it.
.Bl -tag -offset indent -width ZIP_FL_COMPRESSED
.It Dv ZIP_FL_COMPRESSED
Read the compressed data.
Otherwise the data is uncompressed by
.Fn zip_fread .
.It Dv ZIP_FL_UNCHANGED
Read the original data from the zip archive, ignoring any changes made
to the file; this is not supported by all data sources.
.El
.Pp
The
.Fn zip_fopen_index
function opens the file at position
.Ar index .
.Pp
If encrypted data is encountered, the functions call
.Xr zip_fopen_encrypted 3
or
.Xr zip_fopen_index_encrypted 3
respectively, using the default password set with
.Xr zip_set_default_password 3 .
.Sh RETURN VALUES
Upon successful completion, a
.Ft struct zip_file
pointer is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er ZIP_ER_CHANGED
The file data has been changed and the data source does
not support rereading data.
.It Bq Er ZIP_ER_COMPNOTSUPP
The compression method used is not supported.
.It Bq Er ZIP_ER_ENCRNOTSUPP
The encryption method used is not supported.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOPASSWD
The file is encrypted, but no password has been provided.
.It Bq Er ZIP_ER_READ
A file read error occurred.
.It Bq Er ZIP_ER_SEEK
A file seek error occurred.
.It Bq Er ZIP_ER_WRONGPASSWD
The provided password does not match the password used for encryption.
Note that some incorrect passwords are not detected by the check done by
.Fn zip_fopen .
.It Bq Er ZIP_ER_ZLIB
Initializing the zlib stream failed.
.El
.Pp
The function
.Fn zip_fopen
may also fail and set
.Va zip_err
for any of the errors specified for the routine
.Xr zip_name_locate 3 .
.Pp
The function
.Fn zip_fopen_index
may also fail with
.Er ZIP_ER_INVAL
if
.Ar index
is invalid.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_fread 3 ,
.Xr zip_fseek 3 ,
.Xr zip_get_num_entries 3 ,
.Xr zip_name_locate 3 ,
.Xr zip_set_default_password 3
.Sh HISTORY
.Fn zip_fopen
and
.Fn zip_fopen_index
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,135 @@
.\" zip_fopen_encrypted.mdoc -- open encrypted file in zip archive for reading
.\" Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 15, 2020
.Dt ZIP_FOPEN_ENCRYPTED 3
.Os
.Sh NAME
.Nm zip_fopen_encrypted ,
.Nm zip_fopen_index_encrypted
.Nd open encrypted file in zip archive for reading
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_file_t *
.Fn zip_fopen_encrypted "zip_t *archive" "const char *fname" "zip_flags_t flags" "const char *password"
.Ft zip_file_t *
.Fn zip_fopen_index_encrypted "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "const char *password"
.Sh DESCRIPTION
The
.Fn zip_fopen_encrypted
function opens the encrypted file name
.Ar fname
in
.Ar archive
using the password given in the
.Ar password
argument.
If
.Ar password
is
.Dv NULL
or the empty string, the default password is used (see
.Xr zip_set_default_password 3 ) .
The
.Ar flags
argument are the same as for
.Xr zip_fopen 3 .
.Pp
The
.Fn zip_fopen_index_encrypted
function opens the file at position
.Ar index ,
see
.Xr zip_fopen_index 3 .
These functions are called automatically by
.Xr zip_fopen 3 ;
you only need to call them if you want to specify a non-default password
(see
.Xr zip_set_default_password 3 ) .
.Sh RETURN VALUES
Upon successful completion, a
.Ft struct zip_file
pointer is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Bl -tag -width ZIP_ER_ENCRNOTSUPPXX
.It Bq Er ZIP_ER_NOPASSWD
No password was provided.
.El
.Pp
The function
.Fn zip_fopen_encrypted
may also fail and set
.Va zip_err
for any of the errors specified for the routine
.Xr zip_fopen 3 .
.Pp
The function
.Fn zip_fopen_index_encrypted
may also fail and set
.Va zip_err
for any of the errors specified for the routine
.Xr zip_fopen_index 3 .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fread 3 ,
.Xr zip_get_num_entries 3 ,
.Xr zip_name_locate 3
.Sh HISTORY
.Fn zip_fopen_encrypted
and
.Fn zip_fopen_index_encrypted
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
.Sh CAVEATS
The zip file format provides very limited possibility for password
verification (a short hash of is compared against one byte in the zip
archive).
For this reason, reading a file while using an incorrect password may
immediately fail with
.Er ZIP_ER_WRONGPASSWD ,
but if the mismatch is not detected, a zlib error may be returned
later instead.
Since zlib errors can also be caused by broken compressed data, there
is no way to make sure if the password was incorrect or if it was
correct, but the compressed data was invalid.
@@ -0,0 +1,85 @@
.\" zip_fread.mdoc -- read from file
.\" Copyright (C) 2003-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 11, 2024
.Dt ZIP_FREAD 3
.Os
.Sh NAME
.Nm zip_fread
.Nd read from file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_fread "zip_file_t *file" "void *buf" "zip_uint64_t nbytes"
.Sh DESCRIPTION
The
.Fn zip_fread
function reads up to
.Ar nbytes
bytes from
.Ar file
into
.Ar buf
from the current position in the file (see
.Xr zip_fseek 3 ) .
After reading, the current position is updated by the number of bytes read.
.Sh RETURN VALUES
If successful, the number of bytes actually read is returned.
When
.Fn zip_fread
is called after reaching the end of the file, 0 is returned.
In case of error, \-1 is returned.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_file_get_error 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fseek 3
.Sh HISTORY
.Fn zip_fread
was added in libzip 0.6.
In libzip 0.10 the return type was changed from
.Vt ssize_t
to
.Vt zip_int64_t .
In libzip 0.10 the type of
.Ar nbytes
was changed from
.Vt size_t
to
.Vt zip_uint64_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,89 @@
.\" zip_fseek.mdoc -- seek in file
.\" Copyright (C) 2016-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 11, 2024
.Dt ZIP_FSEEK 3
.Os
.Sh NAME
.Nm zip_fseek ,
.Nm zip_file_is_seekable
.Nd seek in file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int8_t
.Fn zip_fseek "zip_file_t *file" "zip_int64_t offset" "int whence"
.Ft int
.Fn zip_file_is_seekable "zip_file_t *file"
.Sh DESCRIPTION
The
.Fn zip_fseek
function seeks to the specified
.Ar offset
relative to
.Ar whence ,
just like
.Xr fseek 3 .
.Pp
.Nm
only works on uncompressed (stored), unencrypted data.
When called on compressed or encrypted data it will return an error.
.Pp
The
.Fn zip_file_is_seekable
function returns 1 if a file is seekable.
.Sh RETURN VALUES
If successful,
.Fn zip_fseek
returns 0.
Otherwise, \-1 is returned.
.Pp
.Fn zip_file_is_seekable
returns 1 if a file is seekable and 0 if not.
On an invalid argument, it returns \-1.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_file_get_error 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fread 3 ,
.Xr zip_ftell 3
.Sh HISTORY
.Fn zip_fseek
was added in libzip 1.2.0.
.Fn zip_file_is_seekable
was added in libzip 1.9.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,67 @@
.\" zip_ftell.mdoc -- tell position in file
.\" Copyright (C) 2016-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 11, 2024
.Dt ZIP_FTELL 3
.Os
.Sh NAME
.Nm zip_ftell
.Nd tell position in file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_ftell "zip_file_t *file"
.Sh DESCRIPTION
The
.Fn zip_ftell
function reports the current offset in the file.
.Sh RETURN VALUES
If successful,
.Nm
returns the current file position.
Otherwise, \-1 is returned.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fclose 3 ,
.Xr zip_file_get_error 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fread 3 ,
.Xr zip_fseek 3
.Sh HISTORY
.Fn zip_ftell
was added in libzip 1.2.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,112 @@
.\" zip_get_archive_comment.mdoc -- get zip archive comment
.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 22, 2020
.Dt ZIP_GET_ARCHIVE_COMMENT 3
.Os
.Sh NAME
.Nm zip_get_archive_comment
.Nd get zip archive comment
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_get_archive_comment "zip_t *archive" "int *lenp" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_get_archive_comment
function returns the comment for the entire zip archive.
The return value is in UTF-8 encoding unless
.Dv ZIP_FL_ENC_RAW
was specified (see below).
This pointer should not be modified or
.Xr free 3 Ap d ,
and becomes invalid when
.Ar archive
is closed.
If
.Ar lenp
is not
.Dv NULL ,
the integer to which it points will be set to the length of the
comment.
If
.Ar flags
is set to
.Dv ZIP_FL_UNCHANGED ,
the original unchanged comment is returned.
.Pp
Additionally, the following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_ENC_STRICTXX -offset indent
.It Dv ZIP_FL_ENC_RAW
Return the unmodified archive comment as it is in the ZIP archive.
.It Dv ZIP_FL_ENC_GUESS
(Default.)
Guess the encoding of the archive comment in the ZIP archive and convert it
to UTF-8, if necessary.
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_STRICT
Follow the ZIP specification for file names and extend it to the
archive comment, thus also expecting it in CP-437 encoding.
Convert it to UTF-8.
.El
.Em Note :
ASCII is a subset of both CP-437 and UTF-8.
.Sh RETURN VALUES
Upon successful completion, a pointer to the comment is returned,
or
.Dv NULL
if there is no comment.
.\" In case of an error,
.\" .Dv NULL
.\" is returned and the error code in
.\" .Ar archive
.\" is set to indicate the error.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_get_comment 3
.Sh HISTORY
.Fn zip_get_archive_comment
was added in libzip 0.7.
In libzip 0.11 the type of
.Ar flags
was changed from
.Vt int
to
.Vt zip_flags_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,110 @@
.\" zip_get_archive_flag.mdoc -- get comment for file in zip
.\" Copyright (C) 2008-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 23, 2023
.Dt ZIP_GET_ARCHIVE_FLAG 3
.Os
.Sh NAME
.Nm zip_get_archive_flag
.Nd get status flags for zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_get_archive_flag "zip_t *archive" "zip_flags_t flag" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_get_archive_flag
function returns if the flag
.Ar flag
is set for the archive
.Ar archive .
The archive flags might have been changed with
.Fn zip_set_archive_flag ;
if
.Ar flags
is set to
.Dv ZIP_FL_UNCHANGED ,
the original unchanged flags are tested.
.Pp
Supported flags are:
.Bl -tag -width XZIPXAFLXRDONLYXXX
.It Dv ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE
If this flag is cleared, the archive file will be removed if the archive is empty.
If it is set, an empty archive will be created, which is not recommended by the zip specification.
This flag is always cleared unless explicitly set by the user with
.Xr zip_set_archive_flag 3 .
.It Dv ZIP_AFL_IS_TORRENTZIP
The archive is in torrentzip format.
.It Dv ZIP_AFL_RDONLY
The archive is read-only.
.It Dv ZIP_AFL_WANT_TORRENTZIP
If the flag is set, the archive will be written in torrentzip format.
This flag is always cleared unless explicitly set by the user with
.Xr zip_set_archive_flag 3 .
.El
.Sh RETURN VALUES
.Fn zip_get_archive_flag
returns 1 if
.Ar flag
is set for
.Ar archive ,
0 if not,
and \-1 if an error occurred.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_set_archive_flag 3
.Sh HISTORY
.Fn zip_get_archive_flag
was added in libzip 0.9.
In libzip 0.11 the type of
.Ar flag
was changed from
.Vt int
to
.Vt zip_flags_t m
and the type of
.Ar flags
was changed from
.Vt int
to
.Vt zip_flags_t .
.Dv ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE ,
.Dv ZIP_AFL_IS_TORRENTZIP ,
and
.Dv ZIP_AFL_WANT_TORRENTZIP
were added in libzip 1.10.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,60 @@
.\" zip_get_error.mdoc -- get zip_error for archive
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_GET_ERROR 3
.Os
.Sh NAME
.Nm zip_get_error
.Nd get zip error for archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_error_t *
.Fn zip_get_error "zip_t *archive"
.Sh DESCRIPTION
The
.Fn zip_get_error
function returns the zip error for the zip archive
.Ar archive .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_system 3 ,
.Xr zip_error_code_zip 3
.Sh HISTORY
.Fn zip_get_error
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,73 @@
.\" zip_get_file_comment.mdoc -- get comment for file in zip
.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_GET_FILE_COMMENT 3
.Os
.Sh NAME
.Nm zip_get_file_comment
.Nd get comment for file in zip (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_get_file_comment "zip_t *archive" "zip_uint64_t index" "int *lenp" "int flags"
.Sh DESCRIPTION
The
.Fn zip_get_file_comment
function is the obsolete version of
.Xr zip_file_get_comment 3 .
The only differences are the types of the
.Ar lenp
and
.Ar flags
arguments.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_get_comment 3
.Sh HISTORY
.Fn zip_get_file_comment
was added in libzip 0.7.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_get_comment
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,132 @@
.\" zip_get_name.mdoc -- get name of file by index
.\" Copyright (C) 2003-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 22, 2020
.Dt ZIP_GET_NAME 3
.Os
.Sh NAME
.Nm zip_get_name
.Nd get name of file by index
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_get_name "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_get_name
function returns the name of the file at position
.Ar index
in
.Ar archive .
The name is in UTF-8 encoding unless
.Dv ZIP_FL_ENC_RAW
was specified (see below).
.Pp
If
.Ar flags
is set to
.Dv ZIP_FL_UNCHANGED ,
the original unchanged filename is returned.
The returned string must not be modified or freed, and becomes invalid when
.Ar archive
is closed.
.Pp
Additionally, the following
.Ar flags
are supported:
.Bl -tag -width ZIP_FL_ENC_STRICTXX -offset indent
.It Dv ZIP_FL_ENC_RAW
Return the unmodified names as it is in the ZIP archive.
.It Dv ZIP_FL_ENC_GUESS
(Default.)
Guess the encoding of the name in the ZIP archive and convert it
to UTF-8, if necessary.
(Only CP-437 and UTF-8 are recognized.)
.It Dv ZIP_FL_ENC_STRICT
Follow the ZIP specification and expect CP-437 encoded names in
the ZIP archive (except if they are explicitly marked as UTF-8).
Convert it to UTF-8.
.El
.Em Note :
ASCII is a subset of both CP-437 and UTF-8.
.Sh RETURN VALUES
Upon successful completion, a pointer to the name is returned.
Otherwise,
.Dv NULL
and the error code in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_get_name
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_DELETED
.Ar index
refers to a file that has been deleted
(see
.Xr zip_delete 3 ) .
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive ,
or
.Ar index
points to an added file and
.Dv ZIP_FL_UNCHANGED
is set.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_name_locate 3
.Sh HISTORY
.Fn zip_get_name
was added in libzip 0.6.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
In libzip 0.11 the type of
.Ar flags
was changed from
.Vt int
to
.Vt zip_flags_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,88 @@
.\" zip_get_num_entries.mdoc -- get number of files in archive
.\" Copyright (C) 2011-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 19, 2022
.Dt ZIP_GET_NUM_ENTRIES 3
.Os
.Sh NAME
.Nm zip_get_num_entries
.Nd get number of entries in archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_get_num_entries "zip_t *archive" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_get_num_entries
function returns the number of entries in
.Ar archive .
Entries are all files that are present in the original archive or that
were added while the archive is open.
This includes deleted files, since
indices are not renumbered until the archive is closed.
(This allows one to refer to deleted files, e. g. to undelete them.)
.Pp
If
.Ar flags
is set to
.Dv ZIP_FL_UNCHANGED ,
the original number of files is returned.
.Sh RETURN VALUES
.Fn zip_get_num_entries
returns the number of entries in the zip archive,
or \-1 if
.Ar archive
is
.Dv NULL .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fopen_index 3 ,
.Xr zip_stat_index 3
.Sh HISTORY
.Fn zip_get_num_entries
was added in libzip 0.10.
In libzip 0.11 the return type was changed from
.Vt zip_uint64_t
to
.Vt zip_int64_t .
In libzip 0.11 the type of
.Ar flags
was changed from
.Vt int
to
.Vt zip_flags_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,75 @@
.\" zip_get_num_files.mdoc -- get number of files in archive
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_GET_NUM_FILES 3
.Os
.Sh NAME
.Nm zip_get_num_files
.Nd get number of files in archive (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_get_num_files "zip_t *archive"
.Sh DESCRIPTION
.Em This function is deprecated .
.Em Use
.Xr zip_get_num_entries 3
.Em instead .
.Pp
The
.Fn zip_get_num_files
function returns the number of files in
.Ar archive .
.Sh RETURN VALUES
.Fn zip_get_num_files
returns the number of files in the zip archive,
or \-1 if
.Ar archive
is
.Dv NULL .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fopen_index 3 ,
.Xr zip_stat_index 3
.Sh HISTORY
.Fn zip_get_num_files
was added in libzip 0.6.
It was deprecated in libzip 0.11, use
.Fn zip_get_num_entries instead
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,66 @@
.\" zip_libzip_version.mdoc -- return run-time version of library
.\" Copyright (C) 2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_LIBZIP_VERSION 3
.Os
.Sh NAME
.Nm zip_libzip_version
.Nd return run-time version of library
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft const char *
.Fn zip_libzip_version void
.Sh DESCRIPTION
.Nm
returns the version number of the library as string in the format
.Dq $MAJOR.$MINOR.$MICRO$SUFFIX
where
.Ar $MAJOR
is the major version,
.Ar $MINOR
the minor,
.Ar $MICRO
the micro, and
.Ar $SUFFIX
a suffix that's only set for development versions.
.Sh SEE ALSO
.Xr libzip 3
.Sh HISTORY
.Fn zip_libzip_version
was added in libzip 1.3.1.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,148 @@
.\" zip_name_locate.mdoc -- get index of file by name
.\" Copyright (C) 2003-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 15, 2022
.Dt ZIP_NAME_LOCATE 3
.Os
.Sh NAME
.Nm zip_name_locate
.Nd get index of file by name
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_name_locate "zip_t *archive" "const char *fname" "zip_flags_t flags"
.Sh DESCRIPTION
The
.Fn zip_name_locate
function returns the index of the file named
.Ar fname
in
.Ar archive .
If
.Ar archive
does not contain a file with that name, \-1 is returned.
.Pp
If neither
.Dv ZIP_FL_ENC_RAW
nor
.Dv ZIP_FL_ENC_STRICT
are specified, guess the encoding of the name in the ZIP archive and convert it
to UTF-8, if necessary, before comparing.
.Pp
If neither
.Dv ZIP_FL_ENC_CP437
nor
.Dv ZIP_FL_ENC_UTF_8
are specified, guess the encoding of
.Ar fname .
.Pp
Only CP-437 and UTF-8 are recognized.
.Pp
The
.Fa flags
are specified by
.Em or Ns No 'ing
the following values, or 0 for none of them.
.Bl -tag -offset indent -width ZIP_FL_ENC_STRICT
.It Dv ZIP_FL_NOCASE
Ignore case distinctions.
(Will only work well if the file names are ASCII.)
With this flag,
.Fn zip_name_locate
will be slow for archives with many files.
.It Dv ZIP_FL_NODIR
Ignore directory part of file name in archive.
With this flag,
.Fn zip_name_locate
will be slow for archives with many files.
.It Dv ZIP_FL_ENC_GUESS
This flag has no effect (its value is 0); it can be used to explicitly denote the absence of encoding flags.
.It Dv ZIP_FL_ENC_RAW
Compare
.Ar fname
against the unmodified names as they are in the ZIP archive, without converting them to UTF-8.
.It Dv ZIP_FL_ENC_STRICT
Follow the ZIP specification and expect CP-437 encoded names in
the ZIP archive (except if they are explicitly marked as UTF-8).
Convert them to UTF-8 before comparing.
.It Dv ZIP_FL_ENC_CP437
.Ar fname
is encoded as CP-437.
.It Dv ZIP_FL_ENC_UTF_8
.Ar fname
is encoded as UTF-8.
.El
.Pp
.Em Note :
ASCII is a subset of both CP-437 and UTF-8.
.Sh RETURN VALUES
.Fn zip_name_locate
returns the index of the file named
.Ar fname
or \-1, if
.Ar archive
does not contain an entry of that name.
.Sh ERRORS
.Fn zip_name_locate
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
One of the arguments is invalid.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOENT
No entry of the name
.Ar fname
is found in the archive.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_get_name 3
.Sh HISTORY
.Fn zip_name_locate
was added in libzip 0.6.
In libzip 0.11 the return type was changed from
.Vt int
to
.Vt zip_int64_t .
In libzip 0.11 the type of
.Ar flags
was changed from
.Vt int
to
.Vt zip_flags_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,192 @@
.\" zip_open.mdoc -- open zip archive
.\" Copyright (C) 2003-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 9, 2022
.Dt ZIP_OPEN 3
.Os
.Sh NAME
.Nm zip_open ,
.Nm zip_open_from_source
.Nd open zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_t *
.Fn zip_open "const char *path" "int flags" "int *errorp"
.Ft zip_t *
.Fn zip_open_from_source "zip_source_t *zs" "int flags" "zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_open
function opens the zip archive specified by
.Ar path
and returns a pointer to a
.Ft struct zip ,
used to manipulate the archive.
The
.Fa flags
are specified by
.Em or Ns No 'ing
the following values, or 0 for none of them.
.Bl -tag -offset indent -width ZIP_CHECKCONS
.It Dv ZIP_CHECKCONS
Perform additional stricter consistency checks on the archive, and
error if they fail.
.It Dv ZIP_CREATE
Create the archive if it does not exist.
.It Dv ZIP_EXCL
Error if archive already exists.
.It Dv ZIP_TRUNCATE
If archive exists, ignore its current contents.
In other words, handle it the same way as an empty archive.
.It Dv ZIP_RDONLY
Open archive in read-only mode.
.El
.Pp
If an error occurs and
.Ar errorp
is
.Pf non- Dv NULL ,
it will be set to the corresponding error code.
.Pp
The
.Fn zip_open_from_source
function opens a zip archive encapsulated by the zip_source
.Fa zs
using the provided
.Fa flags .
In case of error, the zip_error
.Fa ze
is filled in.
.Sh RETURN VALUES
Upon successful completion
.Fn zip_open
and
.Fn zip_open_from_source
return a
.Ft struct zip
pointer.
Otherwise,
.Dv NULL
is returned and
.Fn zip_open
sets
.Ar *errorp
to indicate the error, while
.Fn zip_open_from source
sets
.Ar ze
to indicate the error.
.Sh EXAMPLES
Here's an example of how you could report errors during
.Nm :
.Bd -literal
zip_t *za;
int err;
if ((za = zip_open(name, 0, &err)) == NULL) {
zip_error_t error;
zip_error_init_with_code(&error, err);
fprintf(stderr, "%s: cannot open zip archive '%s': %s\en",
progname, name, zip_error_strerror(&error));
zip_error_fini(&error);
return -1;
}
.Ed
.Sh ERRORS
The archive specified by
.Ar path
is opened unless:
.Bl -tag -width Er
.It Bq Er ZIP_ER_EXISTS
The file specified by
.Ar path
exists and
.Dv ZIP_EXCL
is set.
.It Bq Er ZIP_ER_INCONS
Inconsistencies were found in the file specified by
.Ar path .
This error is often caused by specifying
.Dv ZIP_CHECKCONS
but can also happen without it.
.It Bq Er ZIP_ER_INVAL
The
.Ar path
argument is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOENT
The file specified by
.Ar path
does not exist and
.Dv ZIP_CREATE
is not set.
.It Bq Er ZIP_ER_NOZIP
The file specified by
.Ar path
is not a zip archive.
.It Bq Er ZIP_ER_OPEN
The file specified by
.Ar path
could not be opened.
.It Bq Er ZIP_ER_READ
A read error occurred; see
.Va errno
for details.
.It Bq Er ZIP_ER_SEEK
The file specified by
.Ar path
does not allow seeks.
.El
For newly created archives,
.Fn zip_open
does not try to create the file; this is done when calling
.Xr zip_close 3
and any errors, like missing write permissions, will
be reported then.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3 ,
.Xr zip_error_strerror 3 ,
.Xr zip_fdopen 3
.Sh HISTORY
.Fn zip_open
and
.Fn zip_open_from_source
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,192 @@
.\" zip_open.mdoc -- open zip archive
.\" Copyright (C) 2003-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 9, 2022
.Dt ZIP_OPEN 3
.Os
.Sh NAME
.Nm zip_open ,
.Nm zip_open_from_source
.Nd open zip archive
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_t *
.Fn zip_open "const char *path" "int flags" "int *errorp"
.Ft zip_t *
.Fn zip_open_from_source "zip_source_t *zs" "int flags" "zip_error_t *ze"
.Sh DESCRIPTION
The
.Fn zip_open
function opens the zip archive specified by
.Ar path
and returns a pointer to a
.Ft struct zip ,
used to manipulate the archive.
The
.Fa flags
are specified by
.Em or Ns No 'ing
the following values, or 0 for none of them.
.Bl -tag -offset indent -width ZIP_CHECKCONS
.It Dv ZIP_CHECKCONS
Perform additional stricter consistency checks on the archive, and
error if they fail.
.It Dv ZIP_CREATE
Create the archive if it does not exist.
.It Dv ZIP_EXCL
Error if archive already exists.
.It Dv ZIP_TRUNCATE
If archive exists, ignore its current contents.
In other words, handle it the same way as an empty archive.
.It Dv ZIP_RDONLY
Open archive in read-only mode.
.El
.Pp
If an error occurs and
.Ar errorp
is
.Pf non- Dv NULL ,
it will be set to the corresponding error code.
.Pp
The
.Fn zip_open_from_source
function opens a zip archive encapsulated by the zip_source
.Fa zs
using the provided
.Fa flags .
In case of error, the zip_error
.Fa ze
is filled in.
.Sh RETURN VALUES
Upon successful completion
.Fn zip_open
and
.Fn zip_open_from_source
return a
.Ft struct zip
pointer.
Otherwise,
.Dv NULL
is returned and
.Fn zip_open
sets
.Ar *errorp
to indicate the error, while
.Fn zip_open_from source
sets
.Ar ze
to indicate the error.
.Sh EXAMPLES
Here's an example of how you could report errors during
.Nm :
.Bd -literal
zip_t *za;
int err;
if ((za = zip_open(name, 0, &err)) == NULL) {
zip_error_t error;
zip_error_init_with_code(&error, err);
fprintf(stderr, "%s: cannot open zip archive '%s': %s\en",
progname, name, zip_error_strerror(&error));
zip_error_fini(&error);
return -1;
}
.Ed
.Sh ERRORS
The archive specified by
.Ar path
is opened unless:
.Bl -tag -width Er
.It Bq Er ZIP_ER_EXISTS
The file specified by
.Ar path
exists and
.Dv ZIP_EXCL
is set.
.It Bq Er ZIP_ER_INCONS
Inconsistencies were found in the file specified by
.Ar path .
This error is often caused by specifying
.Dv ZIP_CHECKCONS
but can also happen without it.
.It Bq Er ZIP_ER_INVAL
The
.Ar path
argument is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_NOENT
The file specified by
.Ar path
does not exist and
.Dv ZIP_CREATE
is not set.
.It Bq Er ZIP_ER_NOZIP
The file specified by
.Ar path
is not a zip archive.
.It Bq Er ZIP_ER_OPEN
The file specified by
.Ar path
could not be opened.
.It Bq Er ZIP_ER_READ
A read error occurred; see
.Va errno
for details.
.It Bq Er ZIP_ER_SEEK
The file specified by
.Ar path
does not allow seeks.
.El
For newly created archives,
.Fn zip_open
does not try to create the file; this is done when calling
.Xr zip_close 3
and any errors, like missing write permissions, will
be reported then.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3 ,
.Xr zip_error_strerror 3 ,
.Xr zip_fdopen 3
.Sh HISTORY
.Fn zip_open
and
.Fn zip_open_from_source
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,84 @@
.\" zip_register_cancel_callback_with_state.mdoc -- allow cancelling during zip_close
.\" Copyright (C) 2021-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 18, 2022
.Dt ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE 3
.Os
.Sh NAME
.Nm zip_register_cancel_callback_with_state
.Nd allow cancelling during zip_close
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Vt typedef int (*zip_cancel_callback)(zip_t *, void *);
.Ft void
.Fn zip_register_cancel_callback_with_state "zip_t *archive" "zip_cancel_callback callback" "void (*ud_free)(void *)" "void *ud"
.Sh DESCRIPTION
This function can be used to cancel writing of a zip archive during
.Xr zip_close 3 .
.Pp
The
.Fn zip_register_cancel_callback_with_state
function registers a callback function
.Ar callback
for the zip archive
.Ar archive .
The
.Ar ud_free
function is called during cleanup for deleting the userdata supplied in
.Ar ud .
.Pp
The callback function is called during
.Xr zip_close 3
in regular intervals (after every zip archive entry that's completely
written to disk, and while writing data for entries) with zip archive
.Ar archive
and the user-provided user-data
.Ar ud
as arguments.
When the callback function returns a non-zero value, writing is cancelled and
.Xr zip_close 3
returns an error.
.Pp
The callback function should be fast, since it will be called often.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3 ,
.Xr zip_register_progress_callback_with_state 3
.Sh HISTORY
.Fn zip_register_cancel_callback_with_state
was added in libzip 1.6.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,77 @@
.\" zip_register_progress_callback.mdoc -- provide updates during zip_close
.\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_REGISTER_PROGRESS_CALLBACK 3
.Os
.Sh NAME
.Nm zip_register_progress_callback
.Nd provide updates during zip_close (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Vt typedef void (*zip_progress_callback_t)(double);
.Ft void
.Fn zip_register_progress_callback "zip_t *archive" "zip_progress_callback_t progress_callback"
.Sh DESCRIPTION
The function
.Fn zip_register_progress_callback
is the obsolete version of
.Xr zip_register_progress_callback_with_state 3 .
.Pp
The
.Fn zip_register_progress_callback
function registers a callback function
.Ar progress_callback
for the zip archive
.Ar archive .
This function is called during
.Xr zip_close 3
after every zip archive entry that's completely written to disk.
The value is a
.Vt double
in the range from 0.0 to 1.0.
This can be used to provide progress indicators for user interfaces.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3
.Sh HISTORY
.Fn zip_register_progress_callback
was added in libzip 1.2.0.
It was deprecated in libzip 1.3.0, use
.Fn zip_register_progress_callback_with_state
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,87 @@
.\" zip_register_progress_callback_with_state.mdoc -- provide updates during zip_close
.\" Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE 3
.Os
.Sh NAME
.Nm zip_register_progress_callback_with_state
.Nd provide updates during zip_close
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Vt typedef void (*zip_progress_callback)(zip_t *, double, void *);
.Ft void
.Fn zip_register_progress_callback_with_state "zip_t *archive" "double precision" "zip_progress_callback callback" "void (*ud_free)(void *)" "void *ud"
.Sh DESCRIPTION
The
.Fn zip_register_progress_callback_with_state
function registers a callback function
.Ar callback
for the zip archive
.Ar archive .
The
.Ar precision
argument is a double in the range from 0.00 to 1.0 that defines the
smallest change for which the callback should be called (to avoid too
frequent calls).
The
.Ar ud_free
function is called during cleanup for deleting the userdata supplied in
.Ar ud .
.Pp
The callback function is called during
.Xr zip_close 3
in regular intervals (after every zip archive entry that's completely
written to disk, and while writing data for entries) with zip archive
.Ar archive ,
the current progression state as a
.Vt double ,
and the user-provided user-data
.Ar ud
as arguments.
The progression state is a
.Vt double
in the range from 0.0 to 1.0.
This can be used to provide progress indicators for user interfaces.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_close 3 ,
.Xr zip_register_cancel_callback_with_state 3
.Sh HISTORY
.Fn zip_register_progress_callback_with_state
was added in libzip 1.3.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,70 @@
.\" zip_rename.mdoc -- rename file in zip archive
.\" Copyright (C) 2003-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_RENAME 3
.Os
.Sh NAME
.Nm zip_rename
.Nd rename file in zip archive (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_rename "zip_t *archive" "zip_uint64_t index" "const char *name"
.Sh DESCRIPTION
.Fn zip_rename
is the obsolete version of
.Xr zip_file_rename 3 .
It is the same as calling
.Xr zip_file_rename 3
with an empty flags argument.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_rename 3
.Sh HISTORY
.Fn zip_rename
was added in libzip 0.6.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_rename
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,96 @@
.\" zip_add.mdoc -- add files to zip archive
.\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_ADD 3
.Os
.Sh NAME
.Nm zip_add ,
.Nm zip_replace
.Nd add file to zip archive or replace file in zip archive (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_int64_t
.Fn zip_add "zip_t *archive" "const char *name" "zip_source_t *source"
.Ft int
.Fn zip_replace "zip_t *archive" "zip_uint64_t index" "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_add
is the obsolete version of
.Xr zip_file_add 3 .
It is the same as calling
.Xr zip_file_add 3
with an empty
.Ar flags
argument.
Similarly, the
.Fn zip_replace
function is the obsolete version of
.Xr zip_file_replace 3 .
It is the same as calling
.Xr zip_file_replace 3
with an empty
.Ar flags
argument.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3
.Sh HISTORY
.Fn zip_add
was added in libzip 0.6.
In libzip 0.10 the return type was changed from
.Vt int
to
.Vt zip_int64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_add
instead.
.Pp
.Fn zip_replace
was added in libzip 0.6.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_replace
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,93 @@
.\" zip_set_archive_comment.mdoc -- set zip archive comment
.\" Copyright (C) 2006-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SET_ARCHIVE_COMMENT 3
.Os
.Sh NAME
.Nm zip_set_archive_comment
.Nd set zip archive comment
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_set_archive_comment "zip_t *archive" "const char *comment" "zip_uint16_t len"
.Sh DESCRIPTION
The
.Fn zip_set_archive_comment
function sets the comment for the entire zip archive.
If
.Ar comment
is
.Dv NULL
and
.Ar len
is 0, the archive comment will be removed.
.Ar comment
must be encoded in ASCII or UTF-8.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_set_archive_comment
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar len
is less than 0 or longer than the maximum comment length in a zip file
(65535), or
.Ar comment
is not a valid UTF-8 encoded string.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_get_comment 3 ,
.Xr zip_file_set_comment 3 ,
.Xr zip_get_archive_comment 3
.Sh HISTORY
.Fn zip_set_archive_comment
was added in libzip 0.7.
In libzip 0.11 the type of
.Ar len
was changed from
.Vt int
to
.Vt zip_uint16_t .
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,90 @@
.\" zip_set_archive_flag.mdoc -- set zip archive flag
.\" Copyright (C) 2008-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 19, 2023
.Dt ZIP_SET_ARCHIVE_FLAG 3
.Os
.Sh NAME
.Nm zip_set_archive_flag
.Nd set zip archive flag
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_set_archive_flag "zip_t *archive" "zip_flags_t flag" "int value"
.Sh DESCRIPTION
The
.Fn zip_set_archive_flag
function sets the flag
.Ar flag
for the archive
.Ar archive
to the value
.Ar value .
.Pp
Supported flags are:
.Bl -tag -width XZIPXAFLXRDONLYXXX
.It Dv ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE
If this flag is cleared, the archive file will be removed if the archive is empty.
If it is set, an empty archive will be created, which is not recommended by the zip specification.
.It Dv ZIP_AFL_RDONLY
If this flag is set, no modification to the archive are allowed.
This flag can only be cleared if it was manually set with
.Nm ,
not if the archive was opened read-only.
.It Dv ZIP_AFL_WANT_TORRENTZIP
If this flag is set, the archive will be written in torrentzip format.
.El
.Sh RETURN VALUES
Upon successful completion 0 is returned, and \-1 if an error
occurred.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_get_archive_flag 3
.Sh HISTORY
.Fn zip_set_archive_flag
was added in libzip 0.9.
In libzip 0.11 the type of
.Ar flag
was changed from
.Vt int
to
.Vt zip_flags_t .
.Dv ZIP_AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE
and
.Dv ZIP_AFL_WANT_TORRENTZIP
were added in libzip 1.10.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,90 @@
.\" zip_set_default_password.mdoc -- set default password for zip
.\" Copyright (C) 2011-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 15, 2020
.Dt ZIP_SET_DEFAULT_PASSWORD 3
.Os
.Sh NAME
.Nm zip_set_default_password
.Nd set default password for encrypted files in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_set_default_password "zip_t *archive" "const char *password"
.Sh DESCRIPTION
The
.Fn zip_set_default_password
function sets the default password used when accessing encrypted files.
If
.Ar password
is
.Dv NULL
or the empty string, the default password is unset.
.Pp
If you prefer a different password for single files, use
.Xr zip_fopen_encrypted 3
instead of
.Xr zip_fopen 3 .
Usually, however, the same password is used for every file in an
zip archive.
.Pp
The password is not verified when calling this function.
See the
.Sx CAVEATS
section in
.Xr zip_fopen_encrypted 3
for more details about password handling.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_set_default_password
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_fopen 3 ,
.Xr zip_fopen_encrypted 3
.Sh HISTORY
.Fn zip_set_default_password
was added in libzip 0.10.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,79 @@
.\" zip_set_file_comment.mdoc -- set comment for file in zip
.\" Copyright (C) 2006-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SET_FILE_COMMENT 3
.Os
.Sh NAME
.Nm zip_set_file_comment
.Nd set comment for file in zip (obsolete interface)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_set_file_comment "zip_t *archive" "zip_uint64_t index" "const char *comment" "int len"
.Sh DESCRIPTION
The
.Fn zip_set_file_comment
function is the obsolete version of
.Xr zip_file_set_comment 3 .
The only differences are the type of the
.Ar len
argument and the additional
.Ar flags
argument.
.Fn zip_set_file_comment
is the same as calling
.Xr zip_file_set_comment 3
with an empty
.Ar flags
argument.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_set_comment 3
.Sh HISTORY
.Fn zip_set_file_comment
was added in libzip 0.7.
In libzip 0.10 the type of
.Ar index
was changed from
.Vt int
to
.Vt zip_uint64_t .
It was deprecated in libzip 0.11, use
.Fn zip_file_set_comment
instead.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,146 @@
.\" zip_set_file_compression.mdoc -- set compression method and its flags
.\" Copyright (C) 2012-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP files.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 2, 2023
.Dt ZIP_SET_FILE_COMPRESSION 3
.Os
.Sh NAME
.Nm zip_set_file_compression
.Nd set compression method for file in zip
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_set_file_compression "zip_t *archive" "zip_uint64_t index" "zip_int32_t comp" "zip_uint32_t comp_flags"
.Sh DESCRIPTION
The
.Fn zip_set_file_compression
function sets the compression method for the file at position
.Ar index
in the zip archive to
.Ar comp
with the compression method specific
.Ar comp_flags .
The
.Ar comp
is the same as returned by
.Xr zip_stat 3 .
For the
.Ar comp
argument, currently only the following values are supported:
.Bl -tag -width ZIP_CM_DEFLATE_XX
.It Dv ZIP_CM_DEFAULT
default compression; currently the same as
.Dv ZIP_CM_DEFLATE ,
but
.Ar flags
are ignored.
.It Dv ZIP_CM_STORE
Store the file uncompressed.
.It Dv ZIP_CM_BZIP2
Compress the file using the
.Xr bzip2 1
algorithm.
.It Dv ZIP_CM_DEFLATE
Deflate the file with the
.Xr zlib 3
algorithm and default options.
.It Dv ZIP_CM_XZ
Use the
.Xr xz 1
algorithm for compression
.It Dv ZIP_CM_ZSTD
Use the
.Xr zstd 1
algorithm for compression
.El
.Pp
.Em NOTE :
Only the deflate and store methods can be assumed to be universally
supported.
.Pp
The
.Ar comp_flags
argument defines the compression level.
This value is dependent on the compression algorithm.
In general, lower numbers mean faster de/compression and higher
numbers mean slower de/compression.
For
.Dv ZIP_CM_BZIP ,
.Dv ZIP_CM_DEFLATE ,
and
.Dv ZIP_CM_XZ
1 is the fastest compression and 9 the best, 0 chooses the default.
For
.Dv ZIP_CM_ZSTD
possible values are
.Xr ZSTD_minCLevel 3
to
.Xr ZSTD_maxCLevel 3 ; negative values must be cast to
.Ft zip_uint32_t .
.Pp
Further compression method specific flags might be added over time.
.Pp
The current compression method for a file in a zip archive can be
determined using
.Xr zip_stat 3 .
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar archive
is set to indicate the error.
.Sh ERRORS
.Fn zip_set_file_compression
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_COMPNOTSUPP
Unsupported compression method requested.
.It Bq Er ZIP_ER_INVAL
.Ar index
is not a valid file index in
.Ar archive ,
or the argument combination is invalid.
.It Bq Er ZIP_ER_RDONLY
Read-only zip file, no changes allowed.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_compression_method_supported 3 ,
.Xr zip_stat 3
.Sh HISTORY
.Fn zip_set_file_compression
was added in libzip 0.11.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,90 @@
.\" zip_source.mdoc -- description of zip data source
.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE 3
.Os
.Sh NAME
.Nm zip_source
.Nd zip data source structure
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Vt zip_source_t *zs ;
.Sh DESCRIPTION
A
.Vt struct zip_source
is a data source used by
.Xr libzip 3
for adding or replacing file contents for a file in a zip archive.
If the source supports seeking, it can also be used to open zip archives from.
It is created by calling one of
.Xr zip_source_buffer 3 ,
.Xr zip_source_buffer_create 3 ,
.Xr zip_source_file 3 ,
.Xr zip_source_file_create 3 ,
.Xr zip_source_filep 3 ,
.Xr zip_source_filep_create 3 ,
.Xr zip_source_function 3 ,
.Xr zip_source_function_create 3 ,
.Xr zip_source_window 3 ,
or
.Xr zip_source_zip 3 .
.Vt zip_source_t
is reference counted, and created with a reference count of 1.
.Xr zip_open_from_source 3 ,
.Xr zip_file_add 3 ,
and
.Xr zip_file_replace 3
will decrement the reference count of the
.Vt zip_source_t
when they are done using it, so
.Xr zip_source_free 3
only needs to be called when these functions return an error.
Use
.Xr zip_source_keep 3
to increase the reference count, for example if you need the source after
.Xr zip_close 3 .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source_buffer 3 ,
.Xr zip_source_file 3 ,
.Xr zip_source_filep 3 ,
.Xr zip_source_free 3 ,
.Xr zip_source_function 3 ,
.Xr zip_source_window 3 ,
.Xr zip_source_zip 3
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,89 @@
.\" zip_source_begin_write.mdoc -- prepare zip source for writing
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_BEGIN_WRITE 3
.Os
.Sh NAME
.Nm zip_source_begin_write ,
.Nm zip_source_begin_write_cloning
.Nd prepare zip source for writing
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_source_begin_write "zip_source_t *source"
.Ft int
.Fn zip_source_begin_write_cloning "zip_source_t *source" "zip_uint64_t offset"
.Sh DESCRIPTION
The functions
.Fn zip_source_begin_write
and
.Fn zip_source_begin_write_cloning
prepare
.Fa source
for writing.
Usually this involves creating temporary files or allocating buffers.
.Pp
.Fn zip_source_begin_write_cloning
preserves the first
.Ar offset
bytes of the original file.
This is done efficiently, and writes to
.Ar source
won't overwrite the original data until
.Fn zip_commit_write
is called.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar source
is set to indicate the error.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3 ,
.Xr zip_source_commit_write 3 ,
.Xr zip_source_rollback_write 3 ,
.Xr zip_source_seek_write 3 ,
.Xr zip_source_tell_write 3 ,
.Xr zip_source_write 3
.Sh HISTORY
.Fn zip_source_begin_write
was added in libzip 1.0.
.Pp
.Fn zip_source_begin_write_cloning
was added in libzip 1.4.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,89 @@
.\" zip_source_begin_write.mdoc -- prepare zip source for writing
.\" Copyright (C) 2014-2017 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_BEGIN_WRITE 3
.Os
.Sh NAME
.Nm zip_source_begin_write ,
.Nm zip_source_begin_write_cloning
.Nd prepare zip source for writing
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_source_begin_write "zip_source_t *source"
.Ft int
.Fn zip_source_begin_write_cloning "zip_source_t *source" "zip_uint64_t offset"
.Sh DESCRIPTION
The functions
.Fn zip_source_begin_write
and
.Fn zip_source_begin_write_cloning
prepare
.Fa source
for writing.
Usually this involves creating temporary files or allocating buffers.
.Pp
.Fn zip_source_begin_write_cloning
preserves the first
.Ar offset
bytes of the original file.
This is done efficiently, and writes to
.Ar source
won't overwrite the original data until
.Fn zip_commit_write
is called.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar source
is set to indicate the error.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3 ,
.Xr zip_source_commit_write 3 ,
.Xr zip_source_rollback_write 3 ,
.Xr zip_source_seek_write 3 ,
.Xr zip_source_tell_write 3 ,
.Xr zip_source_write 3
.Sh HISTORY
.Fn zip_source_begin_write
was added in libzip 1.0.
.Pp
.Fn zip_source_begin_write_cloning
was added in libzip 1.4.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,102 @@
.\" zip_source_buffer.mdoc -- create zip data source from buffer
.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_BUFFER 3
.Os
.Sh NAME
.Nm zip_source_buffer ,
.Nm zip_source_buffer_create
.Nd create zip data source from buffer
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_buffer "zip_t *archive" "const void *data" "zip_uint64_t len" "int freep"
.Ft zip_source_t *
.Fn zip_source_buffer_create "const void *data" "zip_uint64_t len" "int freep" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
create a zip source from the buffer
.Ar data
of size
.Ar len .
If
.Ar freep
is non-zero, the buffer will be freed when it is no longer needed.
.Ar data
must remain valid for the lifetime of the created source.
.Pp
The source can be used to open a zip archive from.
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
or
.Ar error
is set to indicate the error.
.Sh ERRORS
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar len
is greater than zero and
.Ar data
is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_open_from_source 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,102 @@
.\" zip_source_buffer.mdoc -- create zip data source from buffer
.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_BUFFER 3
.Os
.Sh NAME
.Nm zip_source_buffer ,
.Nm zip_source_buffer_create
.Nd create zip data source from buffer
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_buffer "zip_t *archive" "const void *data" "zip_uint64_t len" "int freep"
.Ft zip_source_t *
.Fn zip_source_buffer_create "const void *data" "zip_uint64_t len" "int freep" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
create a zip source from the buffer
.Ar data
of size
.Ar len .
If
.Ar freep
is non-zero, the buffer will be freed when it is no longer needed.
.Ar data
must remain valid for the lifetime of the created source.
.Pp
The source can be used to open a zip archive from.
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
or
.Ar error
is set to indicate the error.
.Sh ERRORS
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar len
is greater than zero and
.Ar data
is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_open_from_source 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
were added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,112 @@
.\" zip_source_buffer_fragment.mdoc -- create zip data source from multiple buffers
.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_BUFFER_FRAGMENT 3
.Os
.Sh NAME
.Nm zip_source_buffer_fragment ,
.Nm zip_source_buffer_fragment_create
.Nd create zip data source from multiple buffer
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_buffer_fragment "zip_t *archive" "zip_buffer_fragment_t *fragments" "zip_uint64_t nfragments" "int freep"
.Ft zip_source_t *
.Fn zip_source_buffer_fragment_create "zip_buffer_fragment_t *fragments" "zip_uint64_t nfragments" "int freep" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_buffer_fragment
and
.Fn zip_source_buffer_fragment_create
create a zip source from the data in
.Ar fragments .
.Ar nfragments
specifies the number of fragments.
If
.Ar freep
is non-zero, the data will be freed when it is no longer needed.
.Bd -literal
struct zip_stat {
zip_uint8_t *data; /* pointer to the actual data */
zip_uint64_t length; /* length of this fragment */
};
.Ed
.Pp
The data
.Ar fragments
point to must remain valid for the lifetime of the created source.
.Ar fragments
itself can be discarded once the source is created.
.Pp
The source can be used to open a zip archive from.
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
or
.Ar error
is set to indicate the error.
.Sh ERRORS
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar nfragments
is greater than zero and
.Ar fragments
is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_open_from_source 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_buffer_fragment
and
.Fn zip_source_buffer_fragment_create
were added in libzip 1.4.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,112 @@
.\" zip_source_buffer_fragment.mdoc -- create zip data source from multiple buffers
.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_BUFFER_FRAGMENT 3
.Os
.Sh NAME
.Nm zip_source_buffer_fragment ,
.Nm zip_source_buffer_fragment_create
.Nd create zip data source from multiple buffer
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_buffer_fragment "zip_t *archive" "zip_buffer_fragment_t *fragments" "zip_uint64_t nfragments" "int freep"
.Ft zip_source_t *
.Fn zip_source_buffer_fragment_create "zip_buffer_fragment_t *fragments" "zip_uint64_t nfragments" "int freep" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_buffer_fragment
and
.Fn zip_source_buffer_fragment_create
create a zip source from the data in
.Ar fragments .
.Ar nfragments
specifies the number of fragments.
If
.Ar freep
is non-zero, the data will be freed when it is no longer needed.
.Bd -literal
struct zip_stat {
zip_uint8_t *data; /* pointer to the actual data */
zip_uint64_t length; /* length of this fragment */
};
.Ed
.Pp
The data
.Ar fragments
point to must remain valid for the lifetime of the created source.
.Ar fragments
itself can be discarded once the source is created.
.Pp
The source can be used to open a zip archive from.
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.Dv NULL
is returned and the error code in
.Ar archive
or
.Ar error
is set to indicate the error.
.Sh ERRORS
.Fn zip_source_buffer
and
.Fn zip_source_buffer_create
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar nfragments
is greater than zero and
.Ar fragments
is
.Dv NULL .
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_open_from_source 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_buffer_fragment
and
.Fn zip_source_buffer_fragment_create
were added in libzip 1.4.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
@@ -0,0 +1,67 @@
.\" zip_source_close.mdoc -- close zip source (open for reading)
.\" Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\" products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 18, 2017
.Dt ZIP_SOURCE_CLOSE 3
.Os
.Sh NAME
.Nm zip_source_close
.Nd close zip_source (which was open for reading)
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_source_close "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_source_close
closes
.Fa source ,
indicating that no more data will be read.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar source
is set to indicate the error.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3 ,
.Xr zip_source_free 3 ,
.Xr zip_source_open 3
.Sh HISTORY
.Fn zip_source_close
was added in libzip 1.0.
.Sh AUTHORS
.An -nosplit
.An Dieter Baron Aq Mt dillo@nih.at
and
.An Thomas Klausner Aq Mt wiz@gatalith.at
Loaded 100 of 1177 files, more files were not shown because too many files have changed in this diff. Show more