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,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
@@ -0,0 +1,70 @@
.\" zip_source_commit_write.mdoc -- finalize changes to zip source
.\" 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_COMMIT_WRITE 3
.Os
.Sh NAME
.Nm zip_source_commit_write
.Nd finalize changes to zip source
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_source_commit_write "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_source_commit_write
finishes writing data to
.Fa source
and replaces the original with the newly written data.
.Sh RETURN VALUES
Upon successful completion 0 is returned.
Otherwise, \-1 is returned and the error information in
.Ar source
is set to indicate the error.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3 ,
.Xr zip_source_begin_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_commit_write
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_source_error.mdoc -- get zip_error for data source
.\" 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_ERROR 3
.Os
.Sh NAME
.Nm zip_source_error
.Nd get zip error for data source
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_error_t *
.Fn zip_source_error "zip_source_t *source"
.Sh DESCRIPTION
The
.Fn zip_source_error
function returns the zip error for the data source
.Ar source .
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_error_code_system 3 ,
.Xr zip_error_code_zip 3
.Sh HISTORY
.Fn zip_source_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,147 @@
.\" zip_source_file.mdoc -- create data source from a file
.\" 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 June 30, 2023
.Dt ZIP_SOURCE_FILE 3
.Os
.Sh NAME
.Nm zip_source_file ,
.Nm zip_source_file_create
.Nd create data source from a file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_file "zip_t *archive" "const char *fname" "zip_uint64_t start" "zip_int64_t len"
.Ft zip_source_t *
.Fn zip_source_file_create "const char *fname" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_file
and
.Fn zip_source_file_create
create a zip source from a file.
They open
.Ar fname
and read
.Ar len
bytes from offset
.Ar start
from it.
.Pp
When passing
.Dv ZIP_LENGTH_TO_END
(or \-1, which is deprecated) as
.Ar len ,
.Nm
determines the file size when it is called and uses that as the
expected file size.
If the file size grows between creating and reading from the source,
the additional data is ignored.
If the file shrinks,
.Nm libzip
treats it as an error
.Dv ( ZIP_ER_DATA_LENGTH ) .
.Pp
When passing
.Dv ZIP_LENGTH_UNCHECKED
as
.Ar len ,
.Nm
assumes the file's size is unknown.
Reading from the source returns as much data as is there at that time
(usually when calling
.Xr zip_close 3 ) .
.Pp
.Nm libzip
can do various optimizations if the size of a source is known when
it's created, so
.Dv ZIP_LENGTH_TO_END
is preferable.
If you deal with files that are likely to change while you are
processing them, you can use the less efficient
.Dv ZIP_LENGTH_UNCHECKED .
.Pp
If the file supports seek, the source can be used to open a zip archive from.
.Pp
The file is opened and read when the data from the source is used, usually by
.Fn zip_close
or
.Fn zip_open_from_source .
.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_file
and
.Fn zip_source_file_create
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar fname ,
.Ar start ,
or
.Ar len
are invalid.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_OPEN
Opening
.Ar fname
failed.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_file
and
.Fn zip_source_file_create
were added in libzip 1.0.
.Pp
.Dv ZIP_LENGTH_TO_END
and
.Dv ZIP_LENGTH_UNCHECKED
were added in libzip 1.10.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,147 @@
.\" zip_source_file.mdoc -- create data source from a file
.\" 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 June 30, 2023
.Dt ZIP_SOURCE_FILE 3
.Os
.Sh NAME
.Nm zip_source_file ,
.Nm zip_source_file_create
.Nd create data source from a file
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_file "zip_t *archive" "const char *fname" "zip_uint64_t start" "zip_int64_t len"
.Ft zip_source_t *
.Fn zip_source_file_create "const char *fname" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_file
and
.Fn zip_source_file_create
create a zip source from a file.
They open
.Ar fname
and read
.Ar len
bytes from offset
.Ar start
from it.
.Pp
When passing
.Dv ZIP_LENGTH_TO_END
(or \-1, which is deprecated) as
.Ar len ,
.Nm
determines the file size when it is called and uses that as the
expected file size.
If the file size grows between creating and reading from the source,
the additional data is ignored.
If the file shrinks,
.Nm libzip
treats it as an error
.Dv ( ZIP_ER_DATA_LENGTH ) .
.Pp
When passing
.Dv ZIP_LENGTH_UNCHECKED
as
.Ar len ,
.Nm
assumes the file's size is unknown.
Reading from the source returns as much data as is there at that time
(usually when calling
.Xr zip_close 3 ) .
.Pp
.Nm libzip
can do various optimizations if the size of a source is known when
it's created, so
.Dv ZIP_LENGTH_TO_END
is preferable.
If you deal with files that are likely to change while you are
processing them, you can use the less efficient
.Dv ZIP_LENGTH_UNCHECKED .
.Pp
If the file supports seek, the source can be used to open a zip archive from.
.Pp
The file is opened and read when the data from the source is used, usually by
.Fn zip_close
or
.Fn zip_open_from_source .
.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_file
and
.Fn zip_source_file_create
fail if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar fname ,
.Ar start ,
or
.Ar len
are invalid.
.It Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
.It Bq Er ZIP_ER_OPEN
Opening
.Ar fname
failed.
.El
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_file_add 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_file
and
.Fn zip_source_file_create
were added in libzip 1.0.
.Pp
.Dv ZIP_LENGTH_TO_END
and
.Dv ZIP_LENGTH_UNCHECKED
were added in libzip 1.10.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,112 @@
.\" zip_source_filep.mdoc -- create data source from a file stream
.\" 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 June 30, 2023
.Dt ZIP_SOURCE_FILEP 3
.Os
.Sh NAME
.Nm zip_source_filep ,
.Nm zip_source_filep_create
.Nd create data source from FILE *
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_filep "zip_t *archive" "FILE *file" "zip_uint64_t start" "zip_int64_t len"
.Ft zip_source_t *
.Fn zip_source_filep_create "FILE *file" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_filep
and
.Fn zip_source_filep_create
create a zip source from a file stream.
They read
.Ar len
bytes from offset
.Ar start
from the open file stream
.Ar file .
For a description of the
.Ar len
argument, see
.Xr zip_source_file 3 .
.Pp
If the file stream supports seeking, the source can be used to open
a read-only zip archive from.
.Pp
The file stream is closed when the source is being freed, usually
by
.Xr zip_close 3 .
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.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_filep
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar file ,
.Ar start ,
or
.Ar len
are invalid.
.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_source 3 ,
.Xr zip_source_file 3
.Sh HISTORY
.Fn zip_source_filep
and
.Fn zip_source_filep_create
were added in libzip 1.0.
.Pp
.Dv ZIP_LENGTH_TO_END
and
.Dv ZIP_LENGTH_UNCHECKED
were added in libzip 1.10.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,112 @@
.\" zip_source_filep.mdoc -- create data source from a file stream
.\" 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 June 30, 2023
.Dt ZIP_SOURCE_FILEP 3
.Os
.Sh NAME
.Nm zip_source_filep ,
.Nm zip_source_filep_create
.Nd create data source from FILE *
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_filep "zip_t *archive" "FILE *file" "zip_uint64_t start" "zip_int64_t len"
.Ft zip_source_t *
.Fn zip_source_filep_create "FILE *file" "zip_uint64_t start" "zip_int64_t len" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_filep
and
.Fn zip_source_filep_create
create a zip source from a file stream.
They read
.Ar len
bytes from offset
.Ar start
from the open file stream
.Ar file .
For a description of the
.Ar len
argument, see
.Xr zip_source_file 3 .
.Pp
If the file stream supports seeking, the source can be used to open
a read-only zip archive from.
.Pp
The file stream is closed when the source is being freed, usually
by
.Xr zip_close 3 .
.Sh RETURN VALUES
Upon successful completion, the created source is returned.
Otherwise,
.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_filep
fails if:
.Bl -tag -width Er
.It Bq Er ZIP_ER_INVAL
.Ar file ,
.Ar start ,
or
.Ar len
are invalid.
.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_source 3 ,
.Xr zip_source_file 3
.Sh HISTORY
.Fn zip_source_filep
and
.Fn zip_source_filep_create
were added in libzip 1.0.
.Pp
.Dv ZIP_LENGTH_TO_END
and
.Dv ZIP_LENGTH_UNCHECKED
were added in libzip 1.10.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,76 @@
.\" zip_source_free.mdoc -- free zip data source
.\" 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_SOURCE_FREE 3
.Os
.Sh NAME
.Nm zip_source_free
.Nd free zip data source
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft void
.Fn zip_source_free "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_source_free
decrements the reference count of
.Ar source
and frees it if the reference count drops to 0.
If
.Ar source
is
.Dv NULL ,
it does nothing.
.Pp
.Em NOTE :
This function should not be called on a
.Ar source
after it was used successfully in a
.Xr zip_open_from_source 3 ,
.Xr zip_file_add 3 ,
or
.Xr zip_file_replace 3
call.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3 ,
.Xr zip_source_keep 3
.Sh HISTORY
.Fn zip_source_free
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,415 @@
.\" zip_source_function.mdoc -- create data source from function
.\" 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 January 5, 2023
.Dt ZIP_SOURCE_FUNCTION 3
.Os
.Sh NAME
.Nm zip_source_function ,
.Nm zip_source_function_create
.Nd create data source from function
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_function "zip_t *archive" "zip_source_callback fn" "void *userdata"
.Ft zip_source_t *
.Fn zip_source_function_create "zip_source_callback fn" "void *userdata" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_function
and
.Fn zip_source_function_create
create a zip source from the user-provided function
.Ar fn ,
which must be of the following type:
.Pp
.Ft typedef zip_int64_t
.Fo \fR(*\fPzip_source_callback\fR)\fP
.Fa "void *userdata" "void *data" "zip_uint64_t len" "zip_source_cmd_t cmd"
.Fc
.Pp
.Ar archive
or
.Ar error
are used for reporting errors and can be
.Dv NULL .
.Pp
When called by the library, the first argument is the
.Ar userdata
argument supplied to the function.
The next two arguments are a buffer
.Ar data
of size
.Ar len
when data is passed in or expected to be returned, or else
.Dv NULL
and 0.
The last argument,
.Ar cmd ,
specifies which action the function should perform.
.Pp
Depending on the uses, there are three useful sets of commands to be supported by a
.Fn zip_source_callback :
.Bl -tag -width seekable-read-sourceXX
.It read source
Providing streamed data (for file data added to archives).
Must support
.Dv ZIP_SOURCE_OPEN ,
.Dv ZIP_SOURCE_READ ,
.Dv ZIP_SOURCE_CLOSE ,
.Dv ZIP_SOURCE_STAT ,
and
.Dv ZIP_SOURCE_ERROR .
.Pp
If your source uses any allocated memory (including
.Ar userdata )
it should also implement
.Dv ZIP_SOURCE_FREE
to avoid memory leaks.
.It seekable read source
Same as previous, but from a source allowing reading from arbitrary
offsets (also for read-only zip archive).
Must additionally support
.Dv ZIP_SOURCE_SEEK ,
.Dv ZIP_SOURCE_TELL ,
and
.Dv ZIP_SOURCE_SUPPORTS .
.It read/write source
Same as previous, but additionally allowing writing (also for writable
zip archives).
Must additionally support
.Dv ZIP_SOURCE_BEGIN_WRITE ,
.Dv ZIP_SOURCE_COMMIT_WRITE ,
.Dv ZIP_SOURCE_ROLLBACK_WRITE ,
.Dv ZIP_SOURCE_SEEK_WRITE ,
.Dv ZIP_SOURCE_TELL_WRITE ,
and
.Dv ZIP_SOURCE_REMOVE .
.Pp
On top of the above, supporting the pseudo-command
.Dv ZIP_SOURCE_SUPPORTS_REOPEN
allows calling
.Fn zip_source_open
again after calling
.Fn zip_source_close .
.El
.Ss Dv ZIP_SOURCE_ACCEPT_EMPTY
Return 1 if an empty source should be accepted as a valid zip archive.
This is the default if this command is not supported by a source.
File system backed sources should return 0.
.Ss Dv ZIP_SOURCE_BEGIN_WRITE
Prepare the source for writing.
Use this to create any temporary file(s).
.Ss Dv ZIP_SOURCE_BEGIN_WRITE_CLONING
Prepare the source for writing, keeping the first
.Ar len
bytes of the original file.
Only implement this command if it is more efficient than copying the
data, and if it does not destructively overwrite the original file
(you still have to be able to execute
.Dv ZIP_SOURCE_ROLLBACK_WRITE ) .
.Pp
The next write should happen at byte
.Ar offset .
.Ss Dv ZIP_SOURCE_CLOSE
Reading is done.
.Ss Dv ZIP_SOURCE_COMMIT_WRITE
Finish writing to the source.
Replace the original data with the newly written data.
Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the
newly written data.
.Ss Dv ZIP_SOURCE_ERROR
Get error information.
.Ar data
points to an array of two ints, which should be filled with the libzip
error code and the corresponding system error code for the error that
occurred.
See
.Xr zip_errors 3
for details on the error codes.
If the source stores error information in a zip_error_t, use
.Xr zip_error_to_data 3
and return its return value.
Otherwise, return 2 * sizeof(int).
.Ss Dv ZIP_SOURCE_FREE
Clean up and free all resources, including
.Ar userdata .
The callback function will not be called again.
.Ss Dv ZIP_SOURCE_GET_FILE_ATTRIBUTES
Provide information about various data.
Then the data should be put in the appropriate entry in the passed
.Vt zip_file_attributes_t
argument, and the appropriate
.Dv ZIP_FILE_ATTRIBUTES_*
value must be or'ed into the
.Ar valid
member to denote that the corresponding data has been provided.
A
.Vt zip_file_attributes_t
structure can be initialized using
.Xr zip_file_attributes_init 3 .
.Bl -tag -width 10n
.It ASCII mode
If a file is a plaintext file in ASCII.
Can be used by extraction tools to automatically convert line endings
(part of the internal file attributes).
Member
.Ar ascii ,
flag
.Dv ZIP_FILE_ATTRIBUTES_ASCII .
.It General Purpose Bit Flags (limited to Compression Flags)
The general purpose bit flag in the zip in the local and central
directory headers contain information about the compression method.
Member
.Ar general_purpose_bit_flags
and
.Ar general_purpose_bit_mask
to denote which members have been set;
flag
.Dv ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS .
.It External File Attributes
The external file attributes (usually operating system-specific).
Member
.Ar external_file_attributes ,
flag
.Dv ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES .
.It Version Needed
A minimum version needed required to unpack this entry (in the usual
"major * 10 + minor" format).
Member
.Ar version_needed ,
flag
.Dv ZIP_FILE_ATTRIBUTES_VERSION_NEEDED .
.It Operating System
One of the operating systems as defined by the
.Dv ZIP_OPSYS_*
variables (see
.Pa zip.h ) .
This value affects the interpretation of the external file attributes.
Member
.Ar host_system ,
flag
.Dv ZIP_FILE_ATTRIBUTES_HOST_SYSTEM .
.El
.Ss Dv ZIP_SOURCE_OPEN
Prepare for reading.
.Ss Dv ZIP_SOURCE_READ
Read data into the buffer
.Ar data
of size
.Ar len .
Return the number of bytes placed into
.Ar data
on success, and zero for end-of-file.
.Ss Dv ZIP_SOURCE_REMOVE
Remove the underlying file.
This is called if a zip archive is empty when closed.
.Ss Dv ZIP_SOURCE_ROLLBACK_WRITE
Abort writing to the source.
Discard written data.
Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the
original data.
.Ss Dv ZIP_SOURCE_SEEK
Specify position to read next byte from, like
.Xr fseek 3 .
Use
.Xr ZIP_SOURCE_GET_ARGS 3
to decode the arguments into the following struct:
.Bd -literal
struct zip_source_args_seek {
zip_int64_t offset;
int whence;
};
.Ed
.Pp
If the size of the source's data is known, use
.Xr zip_source_seek_compute_offset 3
to validate the arguments and compute the new offset.
.Ss Dv ZIP_SOURCE_SEEK_WRITE
Specify position to write next byte to, like
.Xr fseek 3 .
See
.Dv ZIP_SOURCE_SEEK
for details.
.Ss Dv ZIP_SOURCE_STAT
Get meta information for the input data.
.Ar data
points to an allocated
.Vt struct zip_stat ,
which should be initialized using
.Xr zip_stat_init 3
and then filled in.
.Pp
For uncompressed, unencrypted data, all information is optional.
However, fill in as much information as is readily available.
.Pp
If the data is compressed,
.Dv ZIP_STAT_COMP_METHOD ,
.Dv ZIP_STAT_SIZE ,
and
.Dv ZIP_STAT_CRC
must be filled in.
.Pp
If the data is encrypted,
.Dv ZIP_STAT_ENCRYPTION_METHOD ,
.Dv ZIP_STAT_COMP_METHOD ,
.Dv ZIP_STAT_SIZE ,
and
.Dv ZIP_STAT_CRC
must be filled in.
.Pp
Information only available after the source has been read (e.g., size)
can be omitted in an earlier call.
.Em NOTE :
.Fn zip_source_function
may be called with this argument even after being called with
.Dv ZIP_SOURCE_CLOSE .
.Pp
Return sizeof(struct zip_stat) on success.
.Ss Dv ZIP_SOURCE_SUPPORTS
Return bitmap specifying which commands are supported.
Use
.Xr zip_source_make_command_bitmap 3 .
If this command is not implemented, the source is assumed to be a
read source without seek support.
.Ss Dv ZIP_SOURCE_TELL
Return the current read offset in the source, like
.Xr ftell 3 .
.Ss Dv ZIP_SOURCE_TELL_WRITE
Return the current write offset in the source, like
.Xr ftell 3 .
.Ss Dv ZIP_SOURCE_WRITE
Write data to the source.
Return number of bytes written.
.Ss Dv ZIP_SOURCE_SUPPORTS_REOPEN
This command is never actually invoked, support for it signals the
ability to handle multiple open/read/close cycles.
.Ss Return Values
Commands should return \-1 on error.
.Dv ZIP_SOURCE_ERROR
will be called to retrieve the error code.
On success, commands return 0, unless specified otherwise in the
description above.
.Ss Calling Conventions
The library will always issue
.Dv ZIP_SOURCE_OPEN
before issuing
.Dv ZIP_SOURCE_READ ,
.Dv ZIP_SOURCE_SEEK ,
or
.Dv ZIP_SOURCE_TELL .
When it no longer wishes to read from this source, it will issue
.Dv ZIP_SOURCE_CLOSE .
If the library wishes to read the data again, it will issue
.Dv ZIP_SOURCE_OPEN
a second time.
If the function is unable to provide the data again, it should
return \-1.
.Pp
.Dv ZIP_SOURCE_BEGIN_WRITE
or
.Dv ZIP_SOURCE_BEGIN_WRITE_CLONING
will be called before
.Dv ZIP_SOURCE_WRITE ,
.Dv ZIP_SOURCE_SEEK_WRITE ,
or
.Dv ZIP_SOURCE_TELL_WRITE .
When writing is complete, either
.Dv ZIP_SOURCE_COMMIT_WRITE
or
.Dv ZIP_SOURCE_ROLLBACK_WRITE
will be called.
.Pp
.Dv ZIP_SOURCE_ACCEPT_EMPTY ,
.Dv ZIP_SOURCE_GET_FILE_ATTRIBUTES ,
and
.Dv ZIP_SOURCE_STAT
can be issued at any time.
.Pp
.Dv ZIP_SOURCE_ERROR
will only be issued in response to the function
returning \-1.
.Pp
.Dv ZIP_SOURCE_FREE
will be the last command issued;
if
.Dv ZIP_SOURCE_OPEN
was called and succeeded,
.Dv ZIP_SOURCE_CLOSE
will be called before
.Dv ZIP_SOURCE_FREE ,
and similarly for
.Dv ZIP_SOURCE_BEGIN_WRITE
or
.Dv ZIP_SOURCE_BEGIN_WRITE_CLONING
and
.Dv ZIP_SOURCE_COMMIT_WRITE
or
.Dv ZIP_SOURCE_ROLLBACK_WRITE .
.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 (unless
it is
.Dv NULL ) .
.Sh ERRORS
.Fn zip_source_function
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_file_add 3 ,
.Xr zip_file_attributes_init 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_source 3 ,
.Xr zip_stat_init 3
.Sh HISTORY
.Fn zip_source_function
and
.Fn zip_source_function_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,415 @@
.\" zip_source_function.mdoc -- create data source from function
.\" 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 January 5, 2023
.Dt ZIP_SOURCE_FUNCTION 3
.Os
.Sh NAME
.Nm zip_source_function ,
.Nm zip_source_function_create
.Nd create data source from function
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft zip_source_t *
.Fn zip_source_function "zip_t *archive" "zip_source_callback fn" "void *userdata"
.Ft zip_source_t *
.Fn zip_source_function_create "zip_source_callback fn" "void *userdata" "zip_error_t *error"
.Sh DESCRIPTION
The functions
.Fn zip_source_function
and
.Fn zip_source_function_create
create a zip source from the user-provided function
.Ar fn ,
which must be of the following type:
.Pp
.Ft typedef zip_int64_t
.Fo \fR(*\fPzip_source_callback\fR)\fP
.Fa "void *userdata" "void *data" "zip_uint64_t len" "zip_source_cmd_t cmd"
.Fc
.Pp
.Ar archive
or
.Ar error
are used for reporting errors and can be
.Dv NULL .
.Pp
When called by the library, the first argument is the
.Ar userdata
argument supplied to the function.
The next two arguments are a buffer
.Ar data
of size
.Ar len
when data is passed in or expected to be returned, or else
.Dv NULL
and 0.
The last argument,
.Ar cmd ,
specifies which action the function should perform.
.Pp
Depending on the uses, there are three useful sets of commands to be supported by a
.Fn zip_source_callback :
.Bl -tag -width seekable-read-sourceXX
.It read source
Providing streamed data (for file data added to archives).
Must support
.Dv ZIP_SOURCE_OPEN ,
.Dv ZIP_SOURCE_READ ,
.Dv ZIP_SOURCE_CLOSE ,
.Dv ZIP_SOURCE_STAT ,
and
.Dv ZIP_SOURCE_ERROR .
.Pp
If your source uses any allocated memory (including
.Ar userdata )
it should also implement
.Dv ZIP_SOURCE_FREE
to avoid memory leaks.
.It seekable read source
Same as previous, but from a source allowing reading from arbitrary
offsets (also for read-only zip archive).
Must additionally support
.Dv ZIP_SOURCE_SEEK ,
.Dv ZIP_SOURCE_TELL ,
and
.Dv ZIP_SOURCE_SUPPORTS .
.It read/write source
Same as previous, but additionally allowing writing (also for writable
zip archives).
Must additionally support
.Dv ZIP_SOURCE_BEGIN_WRITE ,
.Dv ZIP_SOURCE_COMMIT_WRITE ,
.Dv ZIP_SOURCE_ROLLBACK_WRITE ,
.Dv ZIP_SOURCE_SEEK_WRITE ,
.Dv ZIP_SOURCE_TELL_WRITE ,
and
.Dv ZIP_SOURCE_REMOVE .
.Pp
On top of the above, supporting the pseudo-command
.Dv ZIP_SOURCE_SUPPORTS_REOPEN
allows calling
.Fn zip_source_open
again after calling
.Fn zip_source_close .
.El
.Ss Dv ZIP_SOURCE_ACCEPT_EMPTY
Return 1 if an empty source should be accepted as a valid zip archive.
This is the default if this command is not supported by a source.
File system backed sources should return 0.
.Ss Dv ZIP_SOURCE_BEGIN_WRITE
Prepare the source for writing.
Use this to create any temporary file(s).
.Ss Dv ZIP_SOURCE_BEGIN_WRITE_CLONING
Prepare the source for writing, keeping the first
.Ar len
bytes of the original file.
Only implement this command if it is more efficient than copying the
data, and if it does not destructively overwrite the original file
(you still have to be able to execute
.Dv ZIP_SOURCE_ROLLBACK_WRITE ) .
.Pp
The next write should happen at byte
.Ar offset .
.Ss Dv ZIP_SOURCE_CLOSE
Reading is done.
.Ss Dv ZIP_SOURCE_COMMIT_WRITE
Finish writing to the source.
Replace the original data with the newly written data.
Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the
newly written data.
.Ss Dv ZIP_SOURCE_ERROR
Get error information.
.Ar data
points to an array of two ints, which should be filled with the libzip
error code and the corresponding system error code for the error that
occurred.
See
.Xr zip_errors 3
for details on the error codes.
If the source stores error information in a zip_error_t, use
.Xr zip_error_to_data 3
and return its return value.
Otherwise, return 2 * sizeof(int).
.Ss Dv ZIP_SOURCE_FREE
Clean up and free all resources, including
.Ar userdata .
The callback function will not be called again.
.Ss Dv ZIP_SOURCE_GET_FILE_ATTRIBUTES
Provide information about various data.
Then the data should be put in the appropriate entry in the passed
.Vt zip_file_attributes_t
argument, and the appropriate
.Dv ZIP_FILE_ATTRIBUTES_*
value must be or'ed into the
.Ar valid
member to denote that the corresponding data has been provided.
A
.Vt zip_file_attributes_t
structure can be initialized using
.Xr zip_file_attributes_init 3 .
.Bl -tag -width 10n
.It ASCII mode
If a file is a plaintext file in ASCII.
Can be used by extraction tools to automatically convert line endings
(part of the internal file attributes).
Member
.Ar ascii ,
flag
.Dv ZIP_FILE_ATTRIBUTES_ASCII .
.It General Purpose Bit Flags (limited to Compression Flags)
The general purpose bit flag in the zip in the local and central
directory headers contain information about the compression method.
Member
.Ar general_purpose_bit_flags
and
.Ar general_purpose_bit_mask
to denote which members have been set;
flag
.Dv ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS .
.It External File Attributes
The external file attributes (usually operating system-specific).
Member
.Ar external_file_attributes ,
flag
.Dv ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES .
.It Version Needed
A minimum version needed required to unpack this entry (in the usual
"major * 10 + minor" format).
Member
.Ar version_needed ,
flag
.Dv ZIP_FILE_ATTRIBUTES_VERSION_NEEDED .
.It Operating System
One of the operating systems as defined by the
.Dv ZIP_OPSYS_*
variables (see
.Pa zip.h ) .
This value affects the interpretation of the external file attributes.
Member
.Ar host_system ,
flag
.Dv ZIP_FILE_ATTRIBUTES_HOST_SYSTEM .
.El
.Ss Dv ZIP_SOURCE_OPEN
Prepare for reading.
.Ss Dv ZIP_SOURCE_READ
Read data into the buffer
.Ar data
of size
.Ar len .
Return the number of bytes placed into
.Ar data
on success, and zero for end-of-file.
.Ss Dv ZIP_SOURCE_REMOVE
Remove the underlying file.
This is called if a zip archive is empty when closed.
.Ss Dv ZIP_SOURCE_ROLLBACK_WRITE
Abort writing to the source.
Discard written data.
Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the
original data.
.Ss Dv ZIP_SOURCE_SEEK
Specify position to read next byte from, like
.Xr fseek 3 .
Use
.Xr ZIP_SOURCE_GET_ARGS 3
to decode the arguments into the following struct:
.Bd -literal
struct zip_source_args_seek {
zip_int64_t offset;
int whence;
};
.Ed
.Pp
If the size of the source's data is known, use
.Xr zip_source_seek_compute_offset 3
to validate the arguments and compute the new offset.
.Ss Dv ZIP_SOURCE_SEEK_WRITE
Specify position to write next byte to, like
.Xr fseek 3 .
See
.Dv ZIP_SOURCE_SEEK
for details.
.Ss Dv ZIP_SOURCE_STAT
Get meta information for the input data.
.Ar data
points to an allocated
.Vt struct zip_stat ,
which should be initialized using
.Xr zip_stat_init 3
and then filled in.
.Pp
For uncompressed, unencrypted data, all information is optional.
However, fill in as much information as is readily available.
.Pp
If the data is compressed,
.Dv ZIP_STAT_COMP_METHOD ,
.Dv ZIP_STAT_SIZE ,
and
.Dv ZIP_STAT_CRC
must be filled in.
.Pp
If the data is encrypted,
.Dv ZIP_STAT_ENCRYPTION_METHOD ,
.Dv ZIP_STAT_COMP_METHOD ,
.Dv ZIP_STAT_SIZE ,
and
.Dv ZIP_STAT_CRC
must be filled in.
.Pp
Information only available after the source has been read (e.g., size)
can be omitted in an earlier call.
.Em NOTE :
.Fn zip_source_function
may be called with this argument even after being called with
.Dv ZIP_SOURCE_CLOSE .
.Pp
Return sizeof(struct zip_stat) on success.
.Ss Dv ZIP_SOURCE_SUPPORTS
Return bitmap specifying which commands are supported.
Use
.Xr zip_source_make_command_bitmap 3 .
If this command is not implemented, the source is assumed to be a
read source without seek support.
.Ss Dv ZIP_SOURCE_TELL
Return the current read offset in the source, like
.Xr ftell 3 .
.Ss Dv ZIP_SOURCE_TELL_WRITE
Return the current write offset in the source, like
.Xr ftell 3 .
.Ss Dv ZIP_SOURCE_WRITE
Write data to the source.
Return number of bytes written.
.Ss Dv ZIP_SOURCE_SUPPORTS_REOPEN
This command is never actually invoked, support for it signals the
ability to handle multiple open/read/close cycles.
.Ss Return Values
Commands should return \-1 on error.
.Dv ZIP_SOURCE_ERROR
will be called to retrieve the error code.
On success, commands return 0, unless specified otherwise in the
description above.
.Ss Calling Conventions
The library will always issue
.Dv ZIP_SOURCE_OPEN
before issuing
.Dv ZIP_SOURCE_READ ,
.Dv ZIP_SOURCE_SEEK ,
or
.Dv ZIP_SOURCE_TELL .
When it no longer wishes to read from this source, it will issue
.Dv ZIP_SOURCE_CLOSE .
If the library wishes to read the data again, it will issue
.Dv ZIP_SOURCE_OPEN
a second time.
If the function is unable to provide the data again, it should
return \-1.
.Pp
.Dv ZIP_SOURCE_BEGIN_WRITE
or
.Dv ZIP_SOURCE_BEGIN_WRITE_CLONING
will be called before
.Dv ZIP_SOURCE_WRITE ,
.Dv ZIP_SOURCE_SEEK_WRITE ,
or
.Dv ZIP_SOURCE_TELL_WRITE .
When writing is complete, either
.Dv ZIP_SOURCE_COMMIT_WRITE
or
.Dv ZIP_SOURCE_ROLLBACK_WRITE
will be called.
.Pp
.Dv ZIP_SOURCE_ACCEPT_EMPTY ,
.Dv ZIP_SOURCE_GET_FILE_ATTRIBUTES ,
and
.Dv ZIP_SOURCE_STAT
can be issued at any time.
.Pp
.Dv ZIP_SOURCE_ERROR
will only be issued in response to the function
returning \-1.
.Pp
.Dv ZIP_SOURCE_FREE
will be the last command issued;
if
.Dv ZIP_SOURCE_OPEN
was called and succeeded,
.Dv ZIP_SOURCE_CLOSE
will be called before
.Dv ZIP_SOURCE_FREE ,
and similarly for
.Dv ZIP_SOURCE_BEGIN_WRITE
or
.Dv ZIP_SOURCE_BEGIN_WRITE_CLONING
and
.Dv ZIP_SOURCE_COMMIT_WRITE
or
.Dv ZIP_SOURCE_ROLLBACK_WRITE .
.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 (unless
it is
.Dv NULL ) .
.Sh ERRORS
.Fn zip_source_function
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_file_add 3 ,
.Xr zip_file_attributes_init 3 ,
.Xr zip_file_replace 3 ,
.Xr zip_source 3 ,
.Xr zip_stat_init 3
.Sh HISTORY
.Fn zip_source_function
and
.Fn zip_source_function_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,62 @@
.\" zip_source_is_deleted.mdoc -- check if zip source is deleted
.\" 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_IS_DELETED 3
.Os
.Sh NAME
.Nm zip_source_is_deleted
.Nd check if zip_source is deleted
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_source_is_deleted "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_source_is_deleted
returns whether the zip_source was deleted.
This can for example happen when all entries are removed from a zip archive.
.Sh RETURN VALUES
.Fn zip_source_is_deleted
returns 1 if the zip_source is deleted and 0 otherwise.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3
.Sh HISTORY
.Fn zip_source_is_deleted
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,65 @@
.\" zip_source_seek.mdoc -- set read offset in source
.\" Copyright (C) 2023 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 10, 2023
.Dt ZIP_SOURCE_IS_SEEKABLE 3
.Os
.Sh NAME
.Nm zip_source_is_seekable
.Nd check if a source supports seeking
.Sh LIBRARY
libzip (-lzip)
.Sh SYNOPSIS
.In zip.h
.Ft int
.Fn zip_source_is_seekable "zip_source_t *source"
.Sh DESCRIPTION
The function
.Fn zip_source_is_seekable
checks if
.Fa source
supports seeking via
.Xr zip_source_seek 3 .
.Sh RETURN VALUES
If the source supports seeking, 1 is returned.
Otherwise, 0 is returned.
.Sh SEE ALSO
.Xr libzip 3 ,
.Xr zip_source 3 ,
.Xr zip_source_seek 3
.Sh HISTORY
.Fn zip_source_is_seekable
was 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
Loaded 100 of 1177 files, more files were not shown because too many files have changed in this diff. Show more