Add mandoc generated man pages (from mdoc) for distribution.
diff --git a/man/ZIP_SOURCE_GET_ARGS.man b/man/ZIP_SOURCE_GET_ARGS.man
new file mode 100644
index 0000000..263dc11
--- /dev/null
+++ b/man/ZIP_SOURCE_GET_ARGS.man
@@ -0,0 +1,47 @@
+.TH "ZIP_SOURCE_GET_ARGS" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBZIP_SOURCE_GET_ARGS\fR
+\- validate and cast arguments to source callback
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fItype *\fR
+.PD 0
+.HP 4n
+\fBZIP_SOURCE_GET_ARGS\fR(\fItype\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBZIP_SOURCE_GET_ARGS\fR()
+macro casts
+\fIdata\fR
+to a pointer to
+\fItype\fR.
+.SH "RETURN VALUES"
+On success,
+\fBZIP_SOURCE_GET_ARGS\fR()
+returns
+\fIdata\fR.
+In case of error, it returns
+\fRNULL\fR
+and sets
+\fIerror\fR.
+.SH "ERRORS"
+\fBZIP_SOURCE_GET_ARGS\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIlen\fR
+is less than the size of
+\fItype\fR
+.SH "SEE ALSO"
+libzip(3),
+zip_source_function(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/libzip.man b/man/libzip.man
new file mode 100644
index 0000000..fe2950d
--- /dev/null
+++ b/man/libzip.man
@@ -0,0 +1,256 @@
+.TH "LIBZIP" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBlibzip\fR
+\- library for manipulating zip archives
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.SH "DESCRIPTION"
+\fBlibzip\fR
+is a library for reading, creating, and modifying zip archives.
+.PP
+The main design criteria for
+\fBlibzip\fR
+were:
+.PD 0
+.TP 4n
+\fB\(bu\fR
+Do not create corrupt files, even in case of errors.
+.TP 4n
+\fB\(bu\fR
+Do not delete data.
+.TP 4n
+\fB\(bu\fR
+Be efficient.
+.PD
+.PP
+For this reason, when modifying zip archives,
+\fBlibzip\fR
+writes to a temporary file and replaces the original
+zip archive atomically.
+.PP
+Below there are two sections listing functions: one for how to read
+from zip archives and one for how to create/modify them.
+.SH "READING ZIP ARCHIVES"
+.SS "open archive"
+.TP 4n
+\fB\(bu\fR
+zip_open(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_fdopen(3)
+.PD
+.SS "find files"
+.TP 4n
+\fB\(bu\fR
+zip_name_locate(3)
+.SS "read files"
+.TP 4n
+\fB\(bu\fR
+zip_fopen(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_fopen_encrypted(3)
+.TP 4n
+\fB\(bu\fR
+zip_fopen_index(3)
+.TP 4n
+\fB\(bu\fR
+zip_fopen_index_encrypted(3)
+.TP 4n
+\fB\(bu\fR
+zip_fread(3)
+.TP 4n
+\fB\(bu\fR
+zip_fseek(3)
+(uncompressed files only)
+.TP 4n
+\fB\(bu\fR
+zip_ftell(3)
+(uncompressed files only)
+.TP 4n
+\fB\(bu\fR
+zip_fclose(3)
+.PD
+.SS "close archive"
+.TP 4n
+\fB\(bu\fR
+zip_close(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_discard(3)
+.PD
+.SS "miscellaneous"
+.TP 4n
+\fB\(bu\fR
+zip_stat(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_file_get_comment(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_get_external_attributes(3)
+.TP 4n
+\fB\(bu\fR
+zip_get_archive_comment(3)
+.TP 4n
+\fB\(bu\fR
+zip_get_archive_flag(3)
+.TP 4n
+\fB\(bu\fR
+zip_get_name(3)
+.TP 4n
+\fB\(bu\fR
+zip_get_num_entries(3)
+.TP 4n
+\fB\(bu\fR
+zip_set_default_password(3)
+.PD
+.SH "CREATING/MODIFYING ZIP ARCHIVES"
+.SS "create/open archive"
+.TP 4n
+\fB\(bu\fR
+zip_open(3)
+.SS "add/change files and directories"
+.TP 4n
+\fB\(bu\fR
+zip_dir_add(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_file_add(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_replace(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_set_comment(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_set_external_attributes(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_set_encryption(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_set_mtime(3)
+.TP 4n
+\fB\(bu\fR
+zip_set_file_compression(3)
+.TP 4n
+\fB\(bu\fR
+zip_source_buffer(3)
+.TP 4n
+\fB\(bu\fR
+zip_source_file(3)
+.TP 4n
+\fB\(bu\fR
+zip_source_filep(3)
+.TP 4n
+\fB\(bu\fR
+zip_source_free(3)
+.TP 4n
+\fB\(bu\fR
+zip_source_function(3)
+.TP 4n
+\fB\(bu\fR
+zip_source_zip(3)
+.PD
+.SS "rename files"
+.TP 4n
+\fB\(bu\fR
+zip_rename(3)
+.SS "delete files"
+.TP 4n
+\fB\(bu\fR
+zip_delete(3)
+.SS "revert changes"
+.TP 4n
+\fB\(bu\fR
+zip_unchange(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_unchange_all(3)
+.TP 4n
+\fB\(bu\fR
+zip_unchange_archive(3)
+.PD
+.SS "read/modify extra fields"
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_field_by_id(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_field_delete(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_field_delete_by_id(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_field_get(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_field_set(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_fields_count(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_extra_fields_count_by_id(3)
+.PD
+.SS "close archive"
+.TP 4n
+\fB\(bu\fR
+zip_close(3)
+.SS "miscellaneous"
+.TP 4n
+\fB\(bu\fR
+zip_libzip_version(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_register_progress_callback_with_state(3)
+.TP 4n
+\fB\(bu\fR
+zip_set_archive_comment(3)
+.TP 4n
+\fB\(bu\fR
+zip_set_archive_flag(3)
+.TP 4n
+\fB\(bu\fR
+zip_source(3)
+.PD
+.SH "ERROR HANDLING"
+.TP 4n
+\fB\(bu\fR
+zip_error_to_str(3)
+.PD 0
+.TP 4n
+\fB\(bu\fR
+zip_strerror(3)
+.TP 4n
+\fB\(bu\fR
+zip_file_strerror(3)
+.TP 4n
+\fB\(bu\fR
+zip_error_get(3)
+.TP 4n
+\fB\(bu\fR
+zip_error_get_sys_type(3)
+.TP 4n
+\fB\(bu\fR
+zip_errors(3)
+.PD
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_add.man b/man/zip_add.man
new file mode 100644
index 0000000..eaf4eb7
--- /dev/null
+++ b/man/zip_add.man
@@ -0,0 +1,50 @@
+.TH "ZIP_ADD" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_add\fR,
+\fBzip_replace\fR
+\- add file to zip archive or replace file in zip archive (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_source_t\ *source\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_replace\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_add\fR()
+is the obsolete version of
+zip_file_add(3).
+It is the same as calling
+zip_file_add(3)
+with an empty
+\fIflags\fR
+argument.
+Similarly, the
+\fBzip_replace\fR()
+function is the obsolete version of
+zip_file_replace(3).
+It is the same as calling
+zip_file_replace(3)
+with an empty
+\fIflags\fR
+argument.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_add(3),
+zip_file_replace(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_add_dir.man b/man/zip_add_dir.man
new file mode 100644
index 0000000..04fccd2
--- /dev/null
+++ b/man/zip_add_dir.man
@@ -0,0 +1,31 @@
+.TH "ZIP_ADD_DIR" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_add_dir\fR
+\- add directory to zip archive (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_add_dir\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_add_dir\fR()
+is the obsolete version of
+zip_dir_add(3).
+It is the same as calling
+zip_dir_add(3)
+with an empty flags argument.
+.SH "SEE ALSO"
+libzip(3),
+zip_dir_add(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_close.man b/man/zip_close.man
new file mode 100644
index 0000000..3583a3c
--- /dev/null
+++ b/man/zip_close.man
@@ -0,0 +1,100 @@
+.TH "ZIP_CLOSE" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_close\fR
+\- close zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_close\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_close\fR()
+function writes any changes made to
+\fIarchive\fR
+to disk.
+If
+\fIarchive\fR
+contains no files, the file is completely removed (no empty archive is
+written).
+If successful,
+\fIarchive\fR
+is freed.
+If writing fails,
+\fBzip_close\fR()
+fails;
+\fIarchive\fR
+is left unchanged and must still be freed.
+.PP
+To close and free a zip archive without saving changes, use
+zip_discard(3).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_close\fR()
+will fail if:
+.TP 19n
+[\fRZIP_ER_EOF\fR]
+Unexpected end-of-file found while reading from a file.
+.TP 19n
+[\fRZIP_ER_INTERNAL\fR]
+The callback function of an added or replaced file returned an
+error but failed to report which.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+The
+\fIpath\fR
+argument is
+\fRNULL\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_NOZIP\fR]
+File is not a zip archive.
+.TP 19n
+[\fRZIP_ER_READ\fR]
+A file read failed.
+.TP 19n
+[\fRZIP_ER_RENAME\fR]
+A temporary file could not be renamed to its final name.
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
+A file seek failed.
+.TP 19n
+[\fRZIP_ER_TMPOPEN\fR]
+A temporary file could not be created.
+.TP 19n
+[\fRZIP_ER_WRITE\fR]
+A file write failed.
+.TP 19n
+[\fRZIP_ER_ZLIB\fR]
+An error occurred while (de)compressing a stream with
+zlib(3).
+.PD 0
+.PP
+Additionally, any errors returned by the callback function
+for added or replaced files will be passed back.
+.PD
+.SH "SEE ALSO"
+libzip(3),
+zip_discard(3),
+zip_error_get(3),
+zip_fdopen(3),
+zip_open(3),
+zip_register_progress_callback_with_state(3),
+zip_strerror(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_delete.man b/man/zip_delete.man
new file mode 100644
index 0000000..a4bc2cf
--- /dev/null
+++ b/man/zip_delete.man
@@ -0,0 +1,42 @@
+.TH "ZIP_DELETE" "3" "March 10, 2009" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_delete\fR
+\- delete file from zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_delete\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR);
+.PD
+.SH "DESCRIPTION"
+The file at position
+\fIindex\fR
+in the zip archive
+\fIarchive\fR
+is marked as deleted.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_delete\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_unchange(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_dir_add.man b/man/zip_dir_add.man
new file mode 100644
index 0000000..73654a1
--- /dev/null
+++ b/man/zip_dir_add.man
@@ -0,0 +1,79 @@
+.TH "ZIP_DIR_ADD" "3" "December 4, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_dir_add\fR
+\- add directory to zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_dir_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_dir_add\fR()
+adds a directory to a zip archive.
+The argument
+\fIarchive\fR
+specifies the zip archive to which the directory should be added.
+\fIname\fR
+is the directory's name in the zip archive.
+The
+\fIflags\fR
+argument can be any of:
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
+Guess encoding of
+\fIname\fR
+(default).
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
+Interpret
+\fIname\fR
+as UTF-8.
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
+Interpret
+\fIname\fR
+as code page 437 (CP-437).
+.SH "RETURN VALUES"
+Upon successful completion, the index of the new entry in the archive
+is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_dir_add\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
+There is already an entry called
+\fIname\fR
+in the archive.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIarchive\fR
+or
+\fIname\fR
+are
+\fRNULL\fR,
+or invalid UTF-8 encoded file names.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
+.SH "CAVEATS"
+\fBzip_dir_add\fR()
+does not look in the file system, it just creates one entry in the
+archive for the provided name.
diff --git a/man/zip_discard.man b/man/zip_discard.man
new file mode 100644
index 0000000..3a3fae1
--- /dev/null
+++ b/man/zip_discard.man
@@ -0,0 +1,30 @@
+.TH "ZIP_DISCARD" "3" "February 13, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_discard\fR
+\- close zip archive and discard changes
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_discard\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_discard\fR()
+function closes
+\fIarchive\fR
+and frees the memory allocated for it.
+Any changes to the archive are not written to disk and discarded.
+.SH "SEE ALSO"
+libzip(3),
+zip_close(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_clear.man b/man/zip_error_clear.man
new file mode 100644
index 0000000..2cf0431
--- /dev/null
+++ b/man/zip_error_clear.man
@@ -0,0 +1,40 @@
+.TH "ZIP_ERROR_CLEAR" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_clear\fR,
+\fBzip_file_error_clear\fR
+\- clear error state for archive or file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_clear\fR(\fIzip_t\ *archive\fR);
+.PD
+.PP
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_file_error_clear\fR(\fIzip_file_t\ *file\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_clear\fR()
+function clears the error state for the zip archive
+\fIarchive\fR.
+.PP
+The
+\fBzip_file_error_clear\fR()
+function does the same for the zip file
+\fIfile\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_get(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_code_system.man b/man/zip_error_code_system.man
new file mode 100644
index 0000000..bc839e2
--- /dev/null
+++ b/man/zip_error_code_system.man
@@ -0,0 +1,32 @@
+.TH "ZIP_ERROR_CODE_SYSTEM" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_code_system\fR
+\- get operating system error part of zip_error
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_code_system\fR(\fIconst\ zip_error_t\ *ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_code_system\fR()
+function returns the system specific part of the error from the
+zip_error error
+\fIze\fR.
+For finding out what system reported the error, use
+zip_error_system_type(3).
+.SH "SEE ALSO"
+libzip(3),
+zip_error_code_zip(3),
+zip_error_system_type(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_code_zip.man b/man/zip_error_code_zip.man
new file mode 100644
index 0000000..627413a
--- /dev/null
+++ b/man/zip_error_code_zip.man
@@ -0,0 +1,29 @@
+.TH "ZIP_ERROR_CODE_ZIP" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_code_zip\fR
+\- get libzip error part of zip_error
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_code_zip\fR(\fIconst\ zip_error_t\ *ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_code_zip\fR()
+function returns the libzip specific part of the error from the
+zip_error error
+\fIze\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_code_system(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_fini.man b/man/zip_error_fini.man
new file mode 100644
index 0000000..f715aef
--- /dev/null
+++ b/man/zip_error_fini.man
@@ -0,0 +1,29 @@
+.TH "ZIP_ERROR_FINI" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_fini\fR
+\- clean up zip_error structure
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_fini\fR(\fIzip_error_t\ *ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_fini\fR()
+function cleans up and frees internally allocated memory of the
+zip_error pointed to by
+\fIze\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_init(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_get.man b/man/zip_error_get.man
new file mode 100644
index 0000000..eba8c3b
--- /dev/null
+++ b/man/zip_error_get.man
@@ -0,0 +1,87 @@
+.TH "ZIP_ERROR_GET" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_get\fR,
+\fBzip_file_error_get\fR
+\- get error codes for archive or file (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_get\fR(\fIzip_t\ *archive\fR, \fIint\ *zep\fR, \fIint\ *sep\fR);
+.PD
+.PP
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_file_error_get\fR(\fIzip_file_t\ *file\fR, \fIint\ *zep\fR, \fIint\ *sep\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_error_get\fR()
+and
+\fBzip_file_error_get\fR()
+are deprecated.
+Use
+zip_error_code_system(3),
+zip_error_code_zip(3),
+zip_file_get_error(3),
+and
+zip_get_error(3)
+instead.
+.PP
+For
+\fBzip_error_get\fR(),
+replace
+.nf
+.sp
+.RS 6n
+int ze, se;
+zip_error_get(za, &ze, &se);
+.RE
+.fi
+with
+.nf
+.sp
+.RS 6n
+int ze, se;
+zip_error_t *error = zip_get_error(za);
+ze = zip_error_code_zip(error);
+se = zip_error_code_system(error);
+.RE
+.fi
+For
+\fBzip_file_error_get\fR(),
+replace
+.nf
+.sp
+.RS 6n
+int ze, se;
+zip_file_error_get(zf, &ze, &se);
+.RE
+.fi
+with
+.nf
+.sp
+.RS 6n
+int ze, se;
+zip_error_t *error = zip_file_get_error(zf);
+ze = zip_error_code_zip(error);
+se = zip_error_code_system(error);
+.RE
+.fi
+.SH "SEE ALSO"
+libzip(3),
+zip_error_code_system(3),
+zip_error_code_zip(3),
+zip_file_get_error(3),
+zip_get_error(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_get_sys_type.man b/man/zip_error_get_sys_type.man
new file mode 100644
index 0000000..7b1290b
--- /dev/null
+++ b/man/zip_error_get_sys_type.man
@@ -0,0 +1,49 @@
+.TH "ZIP_ERROR_GET_SYS_TYPE" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_get_sys_type\fR
+\- get type of system error code (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_get_sys_type\fR(\fIint\ ze\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_error_get_sys_type\fR()
+is deprecated; use
+zip_error_init_with_code(3)
+and
+zip_error_system_type(3)
+instead.
+.PP
+Replace
+.nf
+.sp
+.RS 6n
+int i = zip_error_get_sys_type(ze);
+.RE
+.fi
+with
+.nf
+.sp
+.RS 6n
+zip_error_t error;
+zip_error_init_with_code(&error, ze);
+int i = zip_error_system_type(&error);
+.RE
+.fi
+.SH "SEE ALSO"
+libzip(3),
+zip_error_init_with_code(3),
+zip_error_system_type(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_init.man b/man/zip_error_init.man
new file mode 100644
index 0000000..d8b996f
--- /dev/null
+++ b/man/zip_error_init.man
@@ -0,0 +1,46 @@
+.TH "ZIP_ERROR_INIT" "3" "December 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_init\fR,
+\fBzip_error_init_with_code\fR
+\- initialize zip_error structure
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_init\fR(\fIzip_error_t\ *error\fR);
+.PD
+.PP
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_init_with_code\fR(\fIzip_error_t\ *error\fR, \fIint\ ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_init\fR()
+function initializes the zip_error pointed to by
+\fIerror\fR.
+\fI*error\fR
+must be allocated before calling
+\fBzip_error_init\fR().
+.PP
+The
+\fBzip_error_init_with_code\fR()
+function does the same, but additionally sets the zip error code to
+\fIze\fR
+and sets the system error code to the current
+errno(3)
+value, if appropriate.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_fini(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_set.man b/man/zip_error_set.man
new file mode 100644
index 0000000..02e2f01
--- /dev/null
+++ b/man/zip_error_set.man
@@ -0,0 +1,38 @@
+.TH "ZIP_ERROR_SET" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_set\fR
+\- fill in zip_error structure
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_error_set\fR(\fIzip_error_t\ *ze\fR, \fIint\ le\fR, \fIint\ se\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_set\fR()
+function sets the zip_error pointed to by
+\fIze\fR
+to the libzip error code
+\fIle\fR
+and the system error code
+\fIse\fR.
+.PP
+\fIze\fR
+must be allocated and initialized with
+zip_error_fini(3)
+before calling
+\fBzip_error\fR(\fIset\fR).
+.SH "SEE ALSO"
+libzip(3),
+zip_error_init(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_strerror.man b/man/zip_error_strerror.man
new file mode 100644
index 0000000..b69d5a2
--- /dev/null
+++ b/man/zip_error_strerror.man
@@ -0,0 +1,36 @@
+.TH "ZIP_ERROR_STRERROR" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_strerror\fR
+\- create human-readable string for zip_error
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_error_strerror\fR(\fIzip_error_t\ *ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_strerror\fR()
+function returns an error message string corresponding to
+\fIze\fR
+like
+strerror(3).
+This string will stay valid until the next call to
+\fBzip_error_strerror\fR()
+or until
+zip_error_fini(3)
+is called.
+.SH "SEE ALSO"
+libzip(3),
+strerror(3),
+zip_error_fini(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_system_type.man b/man/zip_error_system_type.man
new file mode 100644
index 0000000..fe0b20d
--- /dev/null
+++ b/man/zip_error_system_type.man
@@ -0,0 +1,47 @@
+.TH "ZIP_ERROR_SYSTEM_TYPE" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_system_type\fR
+\- return type of system error
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_system_type\fR(\fIconst\ zip_error_t\ *ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_error_system_type\fR()
+function returns the type of the system specific part for the zip_error
+\fIze\fR.
+Currently, the following system types are defined:
+.TP 13n
+\fRZIP_ET_NONE\fR
+System specific part of
+\fIze\fR
+is unused.
+.TP 13n
+\fRZIP_ET_SYS\fR
+System specific part of
+\fIze\fR
+is an
+errno(2).
+.TP 13n
+\fRZIP_ET_ZLIB\fR
+System specific part of
+\fIze\fR
+is a
+zlib(3)
+error.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_code_system(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_to_data.man b/man/zip_error_to_data.man
new file mode 100644
index 0000000..b90a49c
--- /dev/null
+++ b/man/zip_error_to_data.man
@@ -0,0 +1,38 @@
+.TH "ZIP_ERROR_TO_DATA" "3" "November 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_to_data\fR
+\- convert zip_error to return value suitable for ZIP_SOURCE_ERROR
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_error_to_data\fR(\fIconst\ zip_error_t\ *ze\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR);
+.PD
+.SH "DESCRIPTION"
+\fBzip_error_to_data\fR()
+function converts the zip_error
+\fIze\fR
+into data suitable as return value for
+\fRZIP_SOURCE_ERROR\fR.
+The data is written into the buffer
+\fIdata\fR
+of size
+\fIlen\fR.
+If the buffer is not large enough to hold 2 ints, an error is
+returned.
+.SH "RETURN VALUES"
+\fBzip_error_to_data\fR()
+returns 2*(sizeof int) on success, and \-1 on error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source_function(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_error_to_str.man b/man/zip_error_to_str.man
new file mode 100644
index 0000000..eac887f
--- /dev/null
+++ b/man/zip_error_to_str.man
@@ -0,0 +1,52 @@
+.TH "ZIP_ERROR_TO_STR" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_error_to_str\fR
+\- get string representation of zip error (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_error_to_str\fR(\fIchar\ *buf\fR, \fIzip_uint64_t\ len\fR, \fIint\ ze\fR, \fIint\ se\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_error_to_str\fR()
+is deprecated; use
+zip_error_init_with_code(3)
+and
+zip_error_strerror(3)
+instead.
+.PP
+Replace
+.nf
+.sp
+.RS 6n
+char buf[BUFSIZE];
+zip_error_to_str(buf, sizeof(buf), ze, se);
+printf("%s", buf);
+.RE
+.fi
+with
+.nf
+.sp
+.RS 6n
+zip_error_t error;
+zip_error_init_with_code(&error, ze);
+printf("%s", zip_error_strerror(&error));
+zip_error_fini(&error);
+.RE
+.fi
+.SH "SEE ALSO"
+libzip(3),
+zip_error_init_with_code(3),
+zip_error_strerror(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_errors.man b/man/zip_errors.man
new file mode 100644
index 0000000..e42b35b
--- /dev/null
+++ b/man/zip_errors.man
@@ -0,0 +1,112 @@
+.TH "ZIP_ERRORS" "3" "October 6, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_errors\fR
+\- list of all libzip error codes
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.SH "DESCRIPTION"
+The following error codes are used by libzip:
+.TP 23n
+[\fRZIP_ER_CHANGED\fR]
+Entry has been changed.
+.TP 23n
+[\fRZIP_ER_CLOSE\fR]
+Closing zip archive failed.
+.TP 23n
+[\fRZIP_ER_COMPNOTSUPP\fR]
+Compression method not supported.
+.TP 23n
+[\fRZIP_ER_COMPRESSED_DATA\fR]
+Compressed data invalid.
+.TP 23n
+[\fRZIP_ER_CRC\fR]
+CRC error.
+.TP 23n
+[\fRZIP_ER_DELETED\fR]
+Entry has been deleted.
+.TP 23n
+[\fRZIP_ER_ENCRNOTSUPP\fR]
+Encryption method not supported.
+.TP 23n
+[\fRZIP_ER_EOF\fR]
+Premature end of file.
+.TP 23n
+[\fRZIP_ER_EXISTS\fR]
+File already exists.
+.TP 23n
+[\fRZIP_ER_INCONS\fR]
+Zip archive inconsistent.
+.TP 23n
+[\fRZIP_ER_INTERNAL\fR]
+Internal error.
+.TP 23n
+[\fRZIP_ER_INUSE\fR]
+Resource still in use.
+.TP 23n
+[\fRZIP_ER_INVAL\fR]
+Invalid argument.
+.TP 23n
+[\fRZIP_ER_MEMORY\fR]
+Malloc failure.
+.TP 23n
+[\fRZIP_ER_MULTIDISK\fR]
+Multi-disk zip archives not supported.
+.TP 23n
+[\fRZIP_ER_NOENT\fR]
+No such file.
+.TP 23n
+[\fRZIP_ER_NOPASSWD\fR]
+No password provided.
+.TP 23n
+[\fRZIP_ER_NOZIP\fR]
+Not a zip archive.
+.TP 23n
+[\fRZIP_ER_OK\fR]
+No error.
+.TP 23n
+[\fRZIP_ER_OPEN\fR]
+Can't open file.
+.TP 23n
+[\fRZIP_ER_OPNOTSUPP\fR]
+Operation not supported.
+.TP 23n
+[\fRZIP_ER_RDONLY\fR]
+Read-only archive.
+.TP 23n
+[\fRZIP_ER_READ\fR]
+Read error.
+.TP 23n
+[\fRZIP_ER_REMOVE\fR]
+Can't remove file.
+.TP 23n
+[\fRZIP_ER_RENAME\fR]
+Renaming temporary file failed.
+.TP 23n
+[\fRZIP_ER_SEEK\fR]
+Seek error.
+.TP 23n
+[\fRZIP_ER_TELL\fR]
+Tell error.
+.TP 23n
+[\fRZIP_ER_TMPOPEN\fR]
+Failure to create temporary file.
+.TP 23n
+[\fRZIP_ER_WRITE\fR]
+Write error.
+.TP 23n
+[\fRZIP_ER_WRONGPASSWD\fR]
+Wrong password provided.
+.TP 23n
+[\fRZIP_ER_ZIPCLOSED\fR]
+Containing zip archive was closed.
+.TP 23n
+[\fRZIP_ER_ZLIB\fR]
+Zlib error.
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_fclose.man b/man/zip_fclose.man
new file mode 100644
index 0000000..0f6eb56
--- /dev/null
+++ b/man/zip_fclose.man
@@ -0,0 +1,34 @@
+.TH "ZIP_FCLOSE" "3" "September 12, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_fclose\fR
+\- close file in zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_fclose\fR(\fIzip_file_t\ *file\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_fclose\fR()
+function closes
+\fIfile\fR
+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"
+libzip(3),
+zip_fopen(3),
+zip_fread(3),
+zip_fseek(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_fdopen.man b/man/zip_fdopen.man
new file mode 100644
index 0000000..6a4661e
--- /dev/null
+++ b/man/zip_fdopen.man
@@ -0,0 +1,122 @@
+.TH "ZIP_FDOPEN" "3" "February 13, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_fdopen\fR
+\- open zip archive using open file descriptor
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fdopen\fR(\fIint\ fd\fR, \fIint\ flags\fR, \fIint\ *errorp\fR);
+.PD
+.SH "DESCRIPTION"
+The zip archive specified by the open file descriptor
+\fIfd\fR
+is opened and a pointer to a
+\fIstruct zip\fR,
+used to manipulate the archive, is returned.
+In contrast to
+zip_open(3),
+using
+\fBzip_fdopen\fR
+the archive can only be opened in read-only mode.
+The
+\fIfd\fR
+argument may not be used any longer after calling
+\fBzip_fdopen\fR.
+The
+\fIflags\fR
+are specified by
+\fIor\fR'ing
+the following values, or 0 for none of them.
+.RS 6n
+.TP 15n
+\fRZIP_CHECKCONS\fR
+Perform additional stricter consistency checks on the archive, and
+error if they fail.
+.RE
+.PP
+If an error occurs and
+\fIerrorp\fR
+is
+non-\fRNULL\fR,
+it will be set to the corresponding error code.
+.SH "RETURN VALUES"
+Upon successful completion
+\fBzip_fdopen\fR()
+returns a
+\fIstruct zip\fR
+pointer, and
+\fIfd\fR
+should not be used any longer, nor passed to
+close(2).
+Otherwise,
+\fRNULL\fR
+is returned and
+\fI*errorp\fR
+is set to indicate the error.
+In the error case,
+\fIfd\fR
+remains unchanged.
+.SH "ERRORS"
+The file specified by
+\fIfd\fR
+is prepared for use by
+libzip(3)
+unless:
+.TP 19n
+[\fRZIP_ER_INCONS\fR]
+Inconsistencies were found in the file specified by
+\fIpath\fR.
+This error is often caused by specifying
+\fRZIP_CHECKCONS\fR
+but can also happen without it.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+The
+\fIflags\fR
+argument is invalid.
+Not all
+zip_open(3)
+flags are allowed for
+\fBzip_fdopen\fR,
+see
+\fIDESCRIPTION\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_NOZIP\fR]
+The file specified by
+\fIfd\fR
+is not a zip archive.
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
+The file specified by
+\fIfd\fR
+could not be prepared for use by
+libzip(3).
+.TP 19n
+[\fRZIP_ER_READ\fR]
+A read error occurred; see
+\fIerrno\fR
+for details.
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
+The file specified by
+\fIfd\fR
+does not allow seeks.
+.SH "SEE ALSO"
+libzip(3),
+zip_close(3),
+zip_error_to_str(3),
+zip_open(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_add.man b/man/zip_file_add.man
new file mode 100644
index 0000000..c3a808f
--- /dev/null
+++ b/man/zip_file_add.man
@@ -0,0 +1,143 @@
+.TH "ZIP_FILE_ADD" "3" "November 6, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_add\fR,
+\fBzip_file_replace\fR
+\- add file to zip archive or replace file in zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_file_add\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *name\fR, \fIzip_source_t\ *source\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_replace\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_source_t\ *source\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_file_add\fR()
+adds a file to a zip archive, while
+\fBzip_file_replace\fR()
+replaces an existing file in a zip archive.
+The argument
+\fIarchive\fR
+specifies the zip archive to which the file should be added.
+\fIname\fR
+is the file's name in the zip archive (for
+\fBzip_file_add\fR()),
+while
+\fIindex\fR
+specifies which file should be replaced (for
+\fBzip_file_replace\fR()).
+The
+\fIflags\fR
+argument can be any combination of
+\fRZIP_FL_OVERWRITE\fR
+with one of
+\fRZIP_FL_ENC_*\fR:
+.TP 22n
+\fRZIP_FL_OVERWRITE\fR
+Overwrite any existing file of the same name.
+For
+\fBzip_file_add\fR
+only.
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
+Guess encoding of
+\fIname\fR
+(default).
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
+Interpret
+\fIname\fR
+as UTF-8.
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
+Interpret
+\fIname\fR
+as code page 437 (CP-437).
+.PD 0
+.PP
+The data is obtained from the
+\fIsource\fR
+argument, see
+zip_source(3).
+.PD
+.PP
+\fINOTE\fR:
+zip_source_free(3)
+should not be called on a
+\fIsource\fR
+after it was used successfully in a
+\fBzip_file_add\fR
+or
+\fBzip_file_replace\fR
+call.
+.SH "RETURN VALUES"
+Upon successful completion,
+\fBzip_file_add\fR()
+returns the index of the new file in the archive, and
+\fBzip_file_replace\fR()
+returns 0.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "EXAMPLES"
+.nf
+.RS 6n
+zip_source_t *s;
+const char buf="teststring";
+
+if ((s=zip_source_buffer(archive, buffer, 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));
+}
+.RE
+.fi
+.SH "ERRORS"
+\fBzip_file_add\fR()
+and
+\fBzip_file_replace\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
+There is already a file called
+\fIname\fR
+in the archive.
+(Only applies to
+\fBzip_file_add\fR(),
+and only if
+\fRZIP_FL_OVERWRITE\fR
+is not provided).
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIsource\fR
+or
+\fIname\fR
+are
+\fRNULL\fR,
+or
+\fIindex\fR
+is invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
+Archive was opened in read-only mode.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_extra_field_delete.man b/man/zip_file_extra_field_delete.man
new file mode 100644
index 0000000..7179434
--- /dev/null
+++ b/man/zip_file_extra_field_delete.man
@@ -0,0 +1,102 @@
+.TH "ZIP_FILE_EXTRA_FIELD_DELETE" "3" "July 31, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_extra_field_delete\fR,
+\fBzip_file_extra_field_delete_by_id\fR
+\- delete extra field for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_delete\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_delete_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_extra_field_delete\fR()
+function deletes the extra field with index
+\fIextra_field_index\fR
+for the file at position
+\fIindex\fR
+in the zip archive.
+.PP
+If
+\fIextra_field_index\fR
+is
+\fRZIP_EXTRA_FIELD_ALL\fR,
+then all extra fields will be deleted.
+.PP
+The following
+\fIflags\fR
+are supported:
+.RS 6n
+.TP 18n
+\fRZIP_FL_CENTRAL\fR
+Delete extra fields from the archive's central directory.
+.TP 18n
+\fRZIP_FL_LOCAL\fR
+Delete extra fields from the local file headers.
+.RE
+.PP
+The
+\fBzip_file_extra_field_delete_by_id\fR()
+function deletes the extra field with ID (two-byte signature)
+\fIextra_field_id\fR
+and index
+\fIextra_field_index\fR
+(in other words, the
+\fIextra_field_index\fR'th
+extra field with ID
+\fIextra_field_id\fR)
+The other arguments are the same as for
+\fBzip_file_extra_field_delete\fR()
+(\fRZIP_EXTRA_FIELD_ALL\fR
+will delete all extra fields of the specified ID).
+.PP
+Please note that due to the library design, the index of an extra
+field may be different between central directory and local file
+headers.
+For this reason, it is not allowed to specify both
+\fRZIP_FL_CENTRAL\fR
+and
+\fRZIP_FL_LOCAL\fR
+in
+\fIflags\fR,
+except when deleting all extra fields (i.e.,
+\fIextra_field_index\fR
+being
+\fRZIP_EXTRA_FIELD_ALL\fR).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_extra_field_delete\fR()
+and
+\fBzip_file_extra_field_delete_by_id\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_extra_field_get(3),
+zip_file_extra_field_set(3),
+zip_file_extra_fields_count(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_extra_field_get.man b/man/zip_file_extra_field_get.man
new file mode 100644
index 0000000..5c2c883
--- /dev/null
+++ b/man/zip_file_extra_field_get.man
@@ -0,0 +1,130 @@
+.TH "ZIP_FILE_EXTRA_FIELD_GET" "3" "October 8, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_extra_field_get\fR,
+\fBzip_file_extra_field_get_by_id\fR
+\- get extra field for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst zip_uint8_t *\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_get\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_uint16_t\ *idp\fR, \fIzip_uint16_t\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIconst zip_uint8_t *\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_get_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIzip_uint16_t\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_extra_field_get\fR()
+function returns the extra field with index
+\fIextra_field_index\fR
+for the file at position
+\fIindex\fR
+in the zip archive.
+This pointer should not be modified or
+free(3)'d,
+and becomes invalid when
+\fIarchive\fR
+is closed.
+If
+\fIidp\fR
+is not
+\fRNULL\fR,
+the integer to which it points will be set to the ID (two-byte
+signature) of the selected extra field.
+If
+\fIlenp\fR
+is not
+\fRNULL\fR,
+the integer to which it points will be set to the length of the
+extra field.
+Generally speaking,
+\fIlenp\fR
+and
+\fIidp\fR
+should be passed since only the extra field data is returned (i.e.,
+neither the ID nor the length, if the
+\fIidp\fR
+and
+\fIlenp\fR
+arguments are not provided).
+.PP
+The following
+\fIflags\fR
+are supported:
+.RS 6n
+.TP 20n
+\fRZIP_FL_CENTRAL\fR
+Return extra fields from the archive's central directory.
+.TP 20n
+\fRZIP_FL_LOCAL\fR
+Return extra fields from the local file headers.
+.TP 20n
+\fRZIP_FL_UNCHANGED\fR
+Return the original unchanged extra fields, ignoring any changes made.
+.RE
+.PP
+The
+\fBzip_file_extra_field_get_by_id\fR()
+function returns the extra field with ID (two-byte signature)
+\fIextra_field_id\fR
+and index
+\fIextra_field_index\fR
+(in other words, the
+\fIextra_field_index\fR'th
+extra field with ID
+\fIextra_field_id\fR)
+The other arguments are the same as for
+\fBzip_file_extra_field_get\fR().
+.SH "RETURN VALUES"
+Upon successful completion, a pointer to an extra field is returned,
+or
+\fRNULL\fR
+if there is no extra field with that
+\fIextra_field_index\fR
+for the file with index
+\fIindex\fR.
+In case of an error,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_extra_field_get\fR()
+and
+\fBzip_file_extra_field_get_by_id\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR,
+or
+\fIextra_field_index\fR
+is not a valid extra file index (for ID
+\fIextra_field_id\fR).
+.SH "SEE ALSO"
+libzip(3),
+zip_file_extra_field_delete(3),
+zip_file_extra_field_set(3),
+zip_file_extra_fields_count(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
+.SH "CAVEATS"
+Please note that the extra field IDs 0x0001 (ZIP64 extension),
+0x6375 (Infozip UTF-8 comment), and
+0x7075 (Infozip UTF-8 file name) can not be read using
+\fBzip_file_extra_field_get\fR()
+since they are used by
+libzip(3)
+internally.
diff --git a/man/zip_file_extra_field_set.man b/man/zip_file_extra_field_set.man
new file mode 100644
index 0000000..0926ec0
--- /dev/null
+++ b/man/zip_file_extra_field_set.man
@@ -0,0 +1,87 @@
+.TH "ZIP_FILE_EXTRA_FIELD_SET" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_extra_field_set\fR
+\- set extra field for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_field_set\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_uint16_t\ extra_field_index\fR, \fIconst\ zip_uint8_t\ *extra_field_data\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_extra_field_set\fR()
+function sets the extra field with ID (two-byte signature)
+\fIextra_field_id\fR
+and index
+\fIextra_field_index\fR
+for the file at position
+\fIindex\fR
+in the zip archive.
+The extra field's data will be set to
+\fIextra_field_data\fR
+and length
+\fIlen\fR.
+If a new entry shall be appended, set
+\fIextra_field_index\fR
+to
+\fRZIP_EXTRA_FIELD_NEW\fR.
+.PP
+At least one of the following
+\fIflags\fR
+must be set:
+.RS 6n
+.TP 18n
+\fRZIP_FL_CENTRAL\fR
+Set extra field in the archive's central directory.
+.TP 18n
+\fRZIP_FL_LOCAL\fR
+Set extra field in the local file headers.
+.RE
+.PP
+Please note that the extra field IDs 0x0001 (ZIP64 extension),
+0x6375 (Infozip UTF-8 comment), and
+0x7075 (Infozip UTF-8 file name) can not be set using
+\fBzip_file_extra_field_set\fR()
+since they are set by
+libzip(3)
+automatically when needed.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_extra_field_set\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+The extra field size is too large (ID and length need 4 bytes; the
+maximum length of all extra fields for one file combined is 65536
+bytes).
+This error also occurs if
+\fIextra_field_index\fR
+is too large.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_extra_field_delete(3),
+zip_file_extra_field_get(3),
+zip_file_extra_fields_count(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_extra_fields_count.man b/man/zip_file_extra_fields_count.man
new file mode 100644
index 0000000..17d3f7e
--- /dev/null
+++ b/man/zip_file_extra_fields_count.man
@@ -0,0 +1,85 @@
+.TH "ZIP_FILE_EXTRA_FIELDS_COUNT" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_extra_fields_count\fR,
+\fBzip_file_extra_fields_count_by_id\fR
+\- count extra fields for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int16_t\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_fields_count\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIzip_int16_t\fR
+.PD 0
+.HP 4n
+\fBzip_file_extra_fields_count_by_id\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ extra_field_id\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_extra_fields_count\fR()
+function counts the extra fields for the file at position
+\fIindex\fR
+in the zip archive.
+.PP
+The following
+\fIflags\fR
+are supported:
+.RS 6n
+.TP 18n
+\fRZIP_FL_CENTRAL\fR
+Count extra fields from the archive's central directory.
+.TP 18n
+\fRZIP_FL_LOCAL\fR
+Count extra fields from the local file headers.
+.TP 18n
+\fRZIP_FL_UNCHANGED\fR
+Count the original unchanged extra fields, ignoring any changes made.
+.RE
+.PP
+The
+\fBzip_file_extra_fields_count_by_id\fR()
+function counts the extra fields with ID (two-byte signature)
+\fIextra_field_id\fR.
+The other arguments are the same as for
+\fBzip_file_extra_fields_count\fR().
+.PP
+Extra fields that are the same in the central directory and the local file
+header are merged into one.
+Therefore, the counts with
+\fRZIP_FL_CENTRAL\fR
+and
+\fRZIP_FL_LOCAL\fR
+do not need to add up to the same value as when given
+\fRZIP_FL_CENTRAL|ZIP_FL_LOCAL\fR
+at the same time.
+.SH "RETURN VALUES"
+Upon successful completion, the requested number of extra fields is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_extra_fields_count\fR()
+and
+\fBzip_file_extra_fields_count_by_id\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_extra_field_delete(3),
+zip_file_extra_field_get(3),
+zip_file_extra_field_set(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_get_comment.man b/man/zip_file_get_comment.man
new file mode 100644
index 0000000..94b5cb4
--- /dev/null
+++ b/man/zip_file_get_comment.man
@@ -0,0 +1,89 @@
+.TH "ZIP_FILE_GET_COMMENT" "3" "September 19, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_get_comment\fR
+\- get comment for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_file_get_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint32_t\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_get_comment\fR()
+function returns the comment for the file at position
+\fIindex\fR
+in the zip archive.
+The name is in UTF-8 encoding unless
+\fRZIP_FL_ENC_RAW\fR
+was specified (see below).
+This pointer should not be modified or
+free(3)'d,
+and becomes invalid when
+\fIarchive\fR
+is closed.
+If
+\fIlenp\fR
+is not
+\fRNULL\fR,
+the integer to which it points will be set to the length of the
+comment.
+If
+\fIflags\fR
+is set to
+\fRZIP_FL_UNCHANGED\fR,
+the original unchanged comment is returned.
+.PP
+Additionally, the following
+\fIflags\fR
+are supported:
+.RS 6n
+.TP 21n
+\fRZIP_FL_ENC_RAW\fR
+Return the unmodified comment as it is in the ZIP archive.
+.TP 21n
+\fRZIP_FL_ENC_GUESS\fR
+(Default.)
+Guess the encoding of the comment in the ZIP archive and convert it
+to UTF-8, if necessary.
+.TP 21n
+\fRZIP_FL_ENC_STRICT\fR
+Follow the ZIP specification for file names and extend it to file
+comments, expecting them to be encoded in CP-437 in the ZIP archive
+(except if it is a UTF-8 comment from the special extra field).
+Convert it to UTF-8.
+.RE
+\fINote\fR:
+ASCII is a subset of both CP-437 and UTF-8.
+.SH "RETURN VALUES"
+Upon successful completion, a pointer to the comment is returned,
+or
+\fRNULL\fR
+if there is no comment.
+In case of an error,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_get_comment\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_set_comment(3),
+zip_get_archive_comment(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_get_error.man b/man/zip_file_get_error.man
new file mode 100644
index 0000000..c80dad5
--- /dev/null
+++ b/man/zip_file_get_error.man
@@ -0,0 +1,26 @@
+.TH "ZIP_FILE_GET_ERROR" "3" "November 9, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_get_error\fR
+\- extract zip_error from zip_file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_error_t *\fR
+.PD 0
+.HP 4n
+\fBzip_file_get_error\fR(\fIzip_file_t\ *zf\fR);
+.PD
+.SH "DESCRIPTION"
+\fBzip_file_get_error\fR()
+function returns the zip_error associated with the zip_file
+\fIzf\fR.
+.SH "SEE ALSO"
+libzip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_rename.man b/man/zip_file_rename.man
new file mode 100644
index 0000000..ab2fa41
--- /dev/null
+++ b/man/zip_file_rename.man
@@ -0,0 +1,74 @@
+.TH "ZIP_FILE_RENAME" "3" "June 23, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_rename\fR
+\- rename file in zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_rename\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *name\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The file at position
+\fIindex\fR
+in the zip archive
+\fIarchive\fR
+is renamed to
+\fIname\fR.
+The
+\fIflags\fR
+argument can be any of:
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
+Guess encoding of
+\fIname\fR
+(default).
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
+Interpret
+\fIname\fR
+as UTF-8.
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
+Interpret
+\fIname\fR
+as code page 437 (CP-437).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_rename\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_DELETED\fR]
+The file to be renamed has been deleted from the archive.
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
+There is already a file called
+\fIname\fR
+in the archive.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR,
+\fIname is\fR
+\fRNULL\fR,
+the empty string, or not a valid UTF-8 encoded string.
+Also a file cannot be renamed to a directory or vice versa.
+Directories are denoted by a trailing slash.
+.SH "SEE ALSO"
+libzip(3),
+zip_unchange(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_set_comment.man b/man/zip_file_set_comment.man
new file mode 100644
index 0000000..da94789
--- /dev/null
+++ b/man/zip_file_set_comment.man
@@ -0,0 +1,86 @@
+.TH "ZIP_FILE_SET_COMMENT" "3" "September 19, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_set_comment\fR
+\- set comment for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_set_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_set_comment\fR()
+function sets the comment for the file at position
+\fIindex\fR
+in the zip archive to
+\fIcomment\fR
+of length
+\fIlen\fR.
+If
+\fIcomment\fR
+is
+\fRNULL\fR
+and
+\fIlen\fR
+is 0, the file comment will be removed.
+The
+\fIflags\fR
+argument can be any of:
+.TP 22n
+\fRZIP_FL_ENC_GUESS\fR
+Guess encoding of
+\fIcomment\fR
+(default).
+.TP 22n
+\fRZIP_FL_ENC_UTF_8\fR
+Interpret
+\fIcomment\fR
+as UTF-8.
+.TP 22n
+\fRZIP_FL_ENC_CP437\fR
+Interpret
+\fIcomment\fR
+as code page 437 (CP-437).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_set_comment\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR,
+or
+\fIlen\fR
+is less than 0 or longer than the maximum comment length in a zip file
+(65535), or
+\fIcomment\fR
+is not a valid UTF-8 encoded string.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
+The
+\fIarchive\fR
+was opened in read-only mode.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_get_comment(3),
+zip_get_archive_comment(3),
+zip_set_archive_comment(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_set_encryption.man b/man/zip_file_set_encryption.man
new file mode 100644
index 0000000..5867037
--- /dev/null
+++ b/man/zip_file_set_encryption.man
@@ -0,0 +1,87 @@
+.TH "ZIP_FILE_SET_ENCRYPTION" "3" "December 16, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_set_encryption\fR
+\- set encryption method for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_set_encryption\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_uint16_t\ method\fR, \fIconst\ char\ *password\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_set_encryption\fR()
+function sets the encryption method for the file at position
+\fIindex\fR
+in the zip archive to
+\fImethod\fR
+using the password
+\fIpassword\fR.
+The
+\fImethod\fR
+is the same as returned by
+zip_stat(3).
+For the
+\fImethod\fR
+argument, currently only the following values are supported:
+.TP 19n
+\fRZIP_EM_NONE\fR
+No encryption.
+.TP 19n
+\fRZIP_EM_AES_128\fR
+Winzip AES-128 encryption.
+.TP 19n
+\fRZIP_EM_AES_192\fR
+Winzip AES-192 encryption.
+.TP 19n
+\fRZIP_EM_AES_256\fR
+Winzip AES-256 encryption.
+.PP
+If
+\fIpassword\fR
+is
+\fRNULL\fR,
+the default password provided by
+zip_set_default_password(3)
+is used.
+.PP
+The current encryption method for a file in a zip archive can be
+determined using
+zip_stat(3).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_set_encryption\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_ENCRNOTSUPP\fR]
+Unsupported compression method requested.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR,
+or the argument combination is invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
+Read-only zip file, no changes allowed.
+.SH "SEE ALSO"
+libzip(3),
+zip_set_default_password(3),
+zip_stat(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_set_external_attributes.man b/man/zip_file_set_external_attributes.man
new file mode 100644
index 0000000..9bc4721
--- /dev/null
+++ b/man/zip_file_set_external_attributes.man
@@ -0,0 +1,59 @@
+.TH "ZIP_FILE_SET_EXTERNAL_ATTRIBUTES" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_set_external_attributes\fR
+\- set external attributes for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_set_external_attributes\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint8_t\ opsys\fR, \fIzip_uint32_t\ attributes\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_set_external_attributes\fR()
+function sets the operating system and external attributes for the
+file at position
+\fIindex\fR
+in the zip archive.
+Currently, no
+\fIflags\fR
+are supported.
+.PP
+For a list of known
+\fIopsys\fR
+values, see
+zip_file_get_external_attributes(3).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_set_external_attributes\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
+The
+\fIarchive\fR
+was opened in read-only mode.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_get_external_attributes(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_set_mtime.man b/man/zip_file_set_mtime.man
new file mode 100644
index 0000000..475f989
--- /dev/null
+++ b/man/zip_file_set_mtime.man
@@ -0,0 +1,55 @@
+.TH "ZIP_FILE_SET_MTIME" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_set_mtime\fR
+\- set last modification time (mtime) for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_file_set_mtime\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fItime_t\ mtime\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_file_set_mtime\fR()
+function sets the last modification time (mtime) for the file at
+position
+\fIindex\fR
+in the zip archive to
+\fImtime\fR.
+Currently, no support for any
+\fIflags\fR
+is implemented.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_file_set_mtime\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
+The
+\fIarchive\fR
+was opened in read-only mode.
+.SH "SEE ALSO"
+libzip(3),
+zip_stat(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_file_strerror.man b/man/zip_file_strerror.man
new file mode 100644
index 0000000..ae5ffde
--- /dev/null
+++ b/man/zip_file_strerror.man
@@ -0,0 +1,56 @@
+.TH "ZIP_FILE_STRERROR" "3" "December 27, 2004" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_file_strerror\fR,
+\fBzip_strerror\fR
+\- get string representation for a zip error
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_file_strerror\fR(\fIzip_file_t\ *file\fR);
+.PD
+.PP
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_strerror\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_strerror\fR()
+function returns a string describing the last error for the zip archive
+\fIarchive\fR,
+while the
+\fBzip_file_strerror\fR()
+function does the same for a zip file
+\fIfile\fR
+(one file in an archive).
+The returned string must not be modified or freed, and becomes invalid when
+\fIarchive\fR
+or
+\fIfile\fR,
+respectively,
+is closed or on the next call to
+\fBzip_strerror\fR()
+or
+\fBzip_file_strerror\fR(),
+respectively,
+for the same archive.
+.SH "RETURN VALUES"
+\fBzip_file_strerror\fR()
+and
+\fBzip_strerror\fR()
+return a pointer to the error string.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_to_str(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_fopen.man b/man/zip_fopen.man
new file mode 100644
index 0000000..1b8af68
--- /dev/null
+++ b/man/zip_fopen.man
@@ -0,0 +1,127 @@
+.TH "ZIP_FOPEN" "3" "September 12, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_fopen\fR,
+\fBzip_fopen_index\fR
+\- open file in zip archive for reading
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.PP
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen_index\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_fopen\fR()
+function opens the file name
+\fIfname\fR
+in
+\fIarchive\fR.
+The
+\fIflags\fR
+argument specifies how the name lookup should be done, according to
+the values are described in
+zip_name_locate(3).
+Also, the following values may be
+\fIor\fR'ed
+to it.
+.RS 6n
+.TP 19n
+\fRZIP_FL_COMPRESSED\fR
+Read the compressed data.
+Otherwise the data is uncompressed by
+\fBzip_fread\fR().
+.TP 19n
+\fRZIP_FL_UNCHANGED\fR
+Read the original data from the zip archive, ignoring any changes made
+to the file.
+.RE
+.PP
+The
+\fBzip_fopen_index\fR()
+function opens the file at position
+\fIindex\fR.
+.PP
+If encrypted data is encountered, the functions call
+zip_fopen_encrypted(3)
+or
+zip_fopen_index_encrypted(3)
+respectively, using the default password set with
+zip_set_default_password(3).
+.SH "RETURN VALUES"
+Upon successful completion, a
+\fIstruct zip_file\fR
+pointer is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+.TP 19n
+[\fRZIP_ER_CHANGED\fR]
+The file data has been changed.
+.TP 19n
+[\fRZIP_ER_COMPNOTSUPP\fR]
+The compression method used is not supported.
+.TP 19n
+[\fRZIP_ER_ENCRNOTSUPP\fR]
+The encryption method used is not supported.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_NOPASSWD\fR]
+The file is encrypted, but no password has been provided.
+.TP 19n
+[\fRZIP_ER_READ\fR]
+A file read error occurred.
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
+A file seek error occurred.
+.TP 19n
+[\fRZIP_ER_WRONGPASSWD\fR]
+The provided password does not match the password used for encryption.
+Note that some incorrect passwords are not detected by the check done by
+\fBzip_fopen\fR().
+.TP 19n
+[\fRZIP_ER_ZLIB\fR]
+Initializing the zlib stream failed.
+.PP
+The function
+\fBzip_fopen\fR()
+may also fail and set
+\fIzip_err\fR
+for any of the errors specified for the routine
+zip_name_locate(3).
+.PP
+The function
+\fBzip_fopen_index\fR()
+may also fail with
+\fRZIP_ER_INVAL\fR
+if
+\fIindex\fR
+is invalid.
+.SH "SEE ALSO"
+libzip(3),
+zip_fclose(3),
+zip_fread(3),
+zip_fseek(3),
+zip_get_num_entries(3),
+zip_name_locate(3),
+zip_set_default_password(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_fopen_encrypted.man b/man/zip_fopen_encrypted.man
new file mode 100644
index 0000000..1acc6db
--- /dev/null
+++ b/man/zip_fopen_encrypted.man
@@ -0,0 +1,87 @@
+.TH "ZIP_FOPEN_ENCRYPTED" "3" "July 22, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_fopen_encrypted\fR,
+\fBzip_fopen_index_encrypted\fR
+\- open encrypted file in zip archive for reading
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen_encrypted\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR, \fIconst\ char\ *password\fR);
+.PD
+.PP
+\fIzip_file_t *\fR
+.PD 0
+.HP 4n
+\fBzip_fopen_index_encrypted\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIconst\ char\ *password\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_fopen_encrypted\fR()
+function opens the encrypted file name
+\fIfname\fR
+in
+\fIarchive\fR
+using the password given in the
+\fIpassword\fR
+argument.
+The
+\fIflags\fR
+argument are the same as for
+zip_fopen(3).
+.PP
+The
+\fBzip_fopen_index_encrypted\fR()
+function opens the file at position
+\fIindex\fR,
+see
+zip_fopen_index(3).
+These functions are called automatically by
+zip_fopen(3);
+you only need to call them if you want to specify a non-default password
+(see
+zip_set_default_password(3)).
+.SH "RETURN VALUES"
+Upon successful completion, a
+\fIstruct zip_file\fR
+pointer is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+.TP 22n
+[\fRZIP_ER_NOPASSWD\fR]
+No password was provided.
+.PP
+The function
+\fBzip_fopen_encrypted\fR()
+may also fail and set
+\fIzip_err\fR
+for any of the errors specified for the routine
+zip_fopen(3).
+.PP
+The function
+\fBzip_fopen_index_encrypted\fR()
+may also fail and set
+\fIzip_err\fR
+for any of the errors specified for the routine
+zip_fopen_index(3).
+.SH "SEE ALSO"
+libzip(3),
+zip_fclose(3),
+zip_fopen(3),
+zip_fread(3),
+zip_get_num_entries(3),
+zip_name_locate(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_fread.man b/man/zip_fread.man
new file mode 100644
index 0000000..79190a8
--- /dev/null
+++ b/man/zip_fread.man
@@ -0,0 +1,37 @@
+.TH "ZIP_FREAD" "3" "September 12, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_fread\fR
+\- read from file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_fread\fR(\fIzip_file_t\ *file\fR, \fIvoid\ *buf\fR, \fIzip_uint64_t\ nbytes\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_fread\fR()
+function reads at most
+\fInbytes\fR
+bytes from
+\fIfile\fR
+into
+\fIbuf\fR.
+.SH "RETURN VALUES"
+If successful, the number of bytes actually read is returned.
+Otherwise, \-1 is returned.
+.SH "SEE ALSO"
+libzip(3),
+zip_fclose(3),
+zip_fopen(3),
+zip_fseek(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_fseek.man b/man/zip_fseek.man
new file mode 100644
index 0000000..503d104
--- /dev/null
+++ b/man/zip_fseek.man
@@ -0,0 +1,44 @@
+.TH "ZIP_FSEEK" "3" "October 1, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_fseek\fR
+\- seek in file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int8_t\fR
+.PD 0
+.HP 4n
+\fBzip_fseek\fR(\fIzip_file_t\ *file\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_fseek\fR()
+function seeks to the specified
+\fIoffset\fR
+relative to
+\fIwhence\fR,
+just like
+fseek(3).
+.PP
+\fBzip_fseek\fR
+only works on uncompressed (stored) data.
+When called on compressed data it will return an error.
+.SH "RETURN VALUES"
+If successful,
+\fBzip_fseek\fR
+returns 0.
+Otherwise, \-1 is returned.
+.SH "SEE ALSO"
+libzip(3),
+zip_fclose(3),
+zip_fopen(3),
+zip_fread(3),
+zip_ftell(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_archive_comment.man b/man/zip_get_archive_comment.man
new file mode 100644
index 0000000..d2decf7
--- /dev/null
+++ b/man/zip_get_archive_comment.man
@@ -0,0 +1,72 @@
+.TH "ZIP_GET_ARCHIVE_COMMENT" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_archive_comment\fR
+\- get zip archive comment
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_get_archive_comment\fR(\fIzip_t\ *archive\fR, \fIint\ *lenp\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_get_archive_comment\fR()
+function returns the comment for the entire zip archive.
+The name is in UTF-8 encoding unless
+\fRZIP_FL_ENC_RAW\fR
+was specified (see below).
+This pointer should not be modified or
+free(3)'d,
+and becomes invalid when
+\fIarchive\fR
+is closed.
+If
+\fIlenp\fR
+is not
+\fRNULL\fR,
+the integer to which it points will be set to the length of the
+comment.
+If
+\fIflags\fR
+is set to
+\fRZIP_FL_UNCHANGED\fR,
+the original unchanged comment is returned.
+.PP
+Additionally, the following
+\fIflags\fR
+are supported:
+.RS 6n
+.TP 21n
+\fRZIP_FL_ENC_RAW\fR
+Return the unmodified archive comment as it is in the ZIP archive.
+.TP 21n
+\fRZIP_FL_ENC_GUESS\fR
+(Default.)
+Guess the encoding of the archive comment in the ZIP archive and convert it
+to UTF-8, if necessary.
+.TP 21n
+\fRZIP_FL_ENC_STRICT\fR
+Follow the ZIP specification for file names and extend it to the
+archive comment, thus also expecting it in CP-437 encoding.
+Convert it to UTF-8.
+.RE
+\fINote\fR:
+ASCII is a subset of both CP-437 and UTF-8.
+.SH "RETURN VALUES"
+Upon successful completion, a pointer to the comment is returned,
+or
+\fRNULL\fR
+if there is no comment.
+.SH "SEE ALSO"
+libzip(3),
+zip_get_file_comment(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_archive_flag.man b/man/zip_get_archive_flag.man
new file mode 100644
index 0000000..61dfaa3
--- /dev/null
+++ b/man/zip_get_archive_flag.man
@@ -0,0 +1,50 @@
+.TH "ZIP_GET_ARCHIVE_FLAG" "3" "April 29, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_archive_flag\fR
+\- get status flags for zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_get_archive_flag\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flag\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_get_archive_flag\fR()
+function returns if the flag
+\fIflag\fR
+is set for the archive
+\fIarchive\fR.
+The archive flags might have been changed with
+\fBzip_set_archive_flag\fR();
+if
+\fIflags\fR
+is set to
+\fRZIP_FL_UNCHANGED\fR,
+the original unchanged flags are tested.
+.PP
+Supported flags are:
+.TP 20n
+\fRZIP_AFL_RDONLY\fR
+The archive is read-only.
+.SH "RETURN VALUES"
+\fBzip_get_archive_flag\fR()
+returns 1 if
+\fIflag\fR
+is set for
+\fIarchive\fR,
+0 if not,
+and \-1 if an error occurred.
+.SH "SEE ALSO"
+libzip(3),
+zip_set_archive_flag(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_error.man b/man/zip_get_error.man
new file mode 100644
index 0000000..ac315f1
--- /dev/null
+++ b/man/zip_get_error.man
@@ -0,0 +1,29 @@
+.TH "ZIP_GET_ERROR" "3" "October 30, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_error\fR
+\- get zip error for archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_error_t *\fR
+.PD 0
+.HP 4n
+\fBzip_get_error\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_get_error\fR()
+function returns the zip error for the zip archive
+\fIarchive\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_code_system(3),
+zip_error_code_zip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_file_comment.man b/man/zip_get_file_comment.man
new file mode 100644
index 0000000..e620484
--- /dev/null
+++ b/man/zip_get_file_comment.man
@@ -0,0 +1,33 @@
+.TH "ZIP_GET_FILE_COMMENT" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_file_comment\fR
+\- get comment for file in zip (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_get_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIint\ *lenp\fR, \fIint\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_get_file_comment\fR()
+function is the obsolete version of
+zip_file_get_comment(3).
+The only differences are the types of the
+\fIlenp\fR
+and
+\fIflags\fR
+arguments.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_get_comment(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_name.man b/man/zip_get_name.man
new file mode 100644
index 0000000..8f9f996
--- /dev/null
+++ b/man/zip_get_name.man
@@ -0,0 +1,92 @@
+.TH "ZIP_GET_NAME" "3" "February 20, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_name\fR
+\- get name of file by index
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_get_name\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_get_name\fR()
+function returns the name of the file at position
+\fIindex\fR
+in
+\fIarchive\fR.
+The name is in UTF-8 encoding unless
+\fRZIP_FL_ENC_RAW\fR
+was specified (see below).
+.PP
+If
+\fIflags\fR
+is set to
+\fRZIP_FL_UNCHANGED\fR,
+the original unchanged filename is returned.
+The returned string must not be modified or freed, and becomes invalid when
+\fIarchive\fR
+is closed.
+.PP
+Additionally, the following
+\fIflags\fR
+are supported:
+.RS 6n
+.TP 21n
+\fRZIP_FL_ENC_RAW\fR
+Return the unmodified names as it is in the ZIP archive.
+.TP 21n
+\fRZIP_FL_ENC_GUESS\fR
+(Default.)
+Guess the encoding of the name in the ZIP archive and convert it
+to UTF-8, if necessary.
+.TP 21n
+\fRZIP_FL_ENC_STRICT\fR
+Follow the ZIP specification and expect CP-437 encoded names in
+the ZIP archive (except if they are explicitly marked as UTF-8).
+Convert it to UTF-8.
+.RE
+\fINote\fR:
+ASCII is a subset of both CP-437 and UTF-8.
+.SH "RETURN VALUES"
+Upon successful completion, a pointer to the name is returned.
+Otherwise,
+\fRNULL\fR
+and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_get_name\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_DELETED\fR]
+\fIindex\fR
+refers to a file that has been deleted
+(see
+zip_delete(3)).
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR,
+or
+\fIindex\fR
+points to an added file and
+\fRZIP_FL_UNCHANGED\fR
+is set.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_name_locate(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_num_entries.man b/man/zip_get_num_entries.man
new file mode 100644
index 0000000..4965e98
--- /dev/null
+++ b/man/zip_get_num_entries.man
@@ -0,0 +1,41 @@
+.TH "ZIP_GET_NUM_ENTRIES" "3" "August 1, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_num_entries\fR
+\- get number of files in archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_get_num_entries\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_get_num_entries\fR()
+function returns the number of files in
+\fIarchive\fR.
+If
+\fIflags\fR
+is set to
+\fRZIP_FL_UNCHANGED\fR,
+the original number of entries is returned.
+.SH "RETURN VALUES"
+\fBzip_get_num_entries\fR()
+returns the number of files in the zip archive,
+or \-1 if
+\fIarchive\fR
+is
+\fRNULL\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_fopen_index(3),
+zip_stat_index(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_get_num_files.man b/man/zip_get_num_files.man
new file mode 100644
index 0000000..a5bffe1
--- /dev/null
+++ b/man/zip_get_num_files.man
@@ -0,0 +1,41 @@
+.TH "ZIP_GET_NUM_FILES" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_get_num_files\fR
+\- get number of files in archive (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_get_num_files\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+\fIThis function is deprecated\fR.
+\fIUse\fR
+zip_get_num_entries(3)
+\fIinstead\fR.
+.PP
+The
+\fBzip_get_num_files\fR()
+function returns the number of files in
+\fIarchive\fR.
+.SH "RETURN VALUES"
+\fBzip_get_num_files\fR()
+returns the number of files in the zip archive,
+or \-1 if
+\fIarchive\fR
+is
+\fRNULL\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_fopen_index(3),
+zip_stat_index(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_libzip_version.man b/man/zip_libzip_version.man
new file mode 100644
index 0000000..442edea
--- /dev/null
+++ b/man/zip_libzip_version.man
@@ -0,0 +1,35 @@
+.TH "ZIP_LIBZIP_VERSION" "3" "October 6, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_libzip_version\fR
+\- return run-time version of library
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIconst char *\fR
+.PD 0
+.HP 4n
+\fBzip_libzip_version\fR(\fIvoid\fR);
+.PD
+.SH "DESCRIPTION"
+\fBzip_libzip_version\fR
+returns the version number of the library as string in the format
+\(Lq$MAJOR.$MINOR.$MICRO$SUFFIX\(Rq
+where
+\fI$MAJOR\fR
+is the major version,
+\fI$MINOR\fR
+the minor,
+\fI$MICRO\fR
+the micro, and
+\fI$SUFFIX\fR
+a suffix that's only set for development versions.
+.SH "SEE ALSO"
+libzip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_name_locate.man b/man/zip_name_locate.man
new file mode 100644
index 0000000..2005b1d
--- /dev/null
+++ b/man/zip_name_locate.man
@@ -0,0 +1,90 @@
+.TH "ZIP_NAME_LOCATE" "3" "April 25, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_name_locate\fR
+\- get index of file by name
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_name_locate\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_name_locate\fR()
+function returns the index of the file named
+\fIfname\fR
+in
+\fIarchive\fR.
+If
+\fIarchive\fR
+does not contain a file with that name, \-1 is returned.
+The
+\fIflags\fR
+are specified by
+\fIor\fR'ing
+the following values, or 0 for none of them.
+.RS 6n
+.TP 15n
+\fRZIP_FL_NOCASE\fR
+Ignore case distinctions.
+(Will only work well if the file names are ASCII.)
+With this flag,
+\fBzip_name_locate\fR()
+will be slow for archives with many files.
+.TP 15n
+\fRZIP_FL_NODIR\fR
+Ignore directory part of file name in archive.
+With this flag,
+\fBzip_name_locate\fR()
+will be slow for archives with many files.
+.TP 15n
+\fRZIP_FL_ENC_RAW\fR
+.br
+Compare against the unmodified names as it is in the ZIP archive.
+.TP 15n
+\fRZIP_FL_ENC_GUESS\fR
+(Default.)
+Guess the encoding of the name in the ZIP archive and convert it
+to UTF-8, if necessary, before comparing.
+.TP 15n
+\fRZIP_FL_ENC_STRICT\fR
+Follow the ZIP specification and expect CP-437 encoded names in
+the ZIP archive (except if they are explicitly marked as UTF-8).
+Convert it to UTF-8 before comparing.
+.RE
+\fINote\fR:
+ASCII is a subset of both CP-437 and UTF-8.
+.SH "RETURN VALUES"
+\fBzip_name_locate\fR()
+returns the index of the file named
+\fIfname\fR
+or \-1, if
+\fIarchive\fR
+does not contain an entry of that name.
+.SH "ERRORS"
+\fBzip_name_locate\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+One of the arguments is invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+No entry of the name
+\fIfname\fR
+is found in the archive.
+.SH "SEE ALSO"
+libzip(3),
+zip_get_name(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_open.man b/man/zip_open.man
new file mode 100644
index 0000000..9027d07
--- /dev/null
+++ b/man/zip_open.man
@@ -0,0 +1,153 @@
+.TH "ZIP_OPEN" "3" "November 9, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_open\fR,
+\fBzip_open_from_source\fR
+\- open zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_t *\fR
+.PD 0
+.HP 4n
+\fBzip_open\fR(\fIconst\ char\ *path\fR, \fIint\ flags\fR, \fIint\ *errorp\fR);
+.PD
+.PP
+\fIzip_t *\fR
+.PD 0
+.HP 4n
+\fBzip_open_from_source\fR(\fIzip_source_t\ *zs\fR, \fIint\ flags\fR, \fIzip_error_t\ *ze\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_open\fR()
+function opens the zip archive specified by
+\fIpath\fR
+and returns a pointer to a
+\fIstruct zip\fR,
+used to manipulate the archive.
+The
+\fIflags\fR
+are specified by
+\fIor\fR'ing
+the following values, or 0 for none of them.
+.RS 6n
+.TP 15n
+\fRZIP_CHECKCONS\fR
+Perform additional stricter consistency checks on the archive, and
+error if they fail.
+.TP 15n
+\fRZIP_CREATE\fR
+Create the archive if it does not exist.
+.TP 15n
+\fRZIP_EXCL\fR
+Error if archive already exists.
+.TP 15n
+\fRZIP_TRUNCATE\fR
+If archive exists, ignore its current contents.
+In other words, handle it the same way as an empty archive.
+.TP 15n
+\fRZIP_RDONLY\fR
+Open archive in read-only mode.
+.RE
+.PP
+If an error occurs and
+\fIerrorp\fR
+is
+non-\fRNULL\fR,
+it will be set to the corresponding error code.
+.PP
+The
+\fBzip_open_from_source\fR()
+function opens a zip archive encapsulated by the zip_source
+\fIzs\fR
+using the provided
+\fIflags\fR.
+In case of error, the zip_error
+\fIze\fR
+is filled in.
+.SH "RETURN VALUES"
+Upon successful completion
+\fBzip_open\fR()
+and
+\fBzip_open_from_source\fR()
+return a
+\fIstruct zip\fR
+pointer.
+Otherwise,
+\fRNULL\fR
+is returned and
+\fBzip_open\fR()
+sets
+\fI*errorp\fR
+to indicate the error, while
+\fBzip_open_from\fR(\fIsource\fR)
+sets
+\fIze\fR
+to indicate the error.
+.SH "ERRORS"
+The archive specified by
+\fIpath\fR
+is opened unless:
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
+The file specified by
+\fIpath\fR
+exists and
+\fRZIP_EXCL\fR
+is set.
+.TP 19n
+[\fRZIP_ER_INCONS\fR]
+Inconsistencies were found in the file specified by
+\fIpath\fR.
+This error is often caused by specifying
+\fRZIP_CHECKCONS\fR
+but can also happen without it.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+The
+\fIpath\fR
+argument is
+\fRNULL\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_NOENT\fR]
+The file specified by
+\fIpath\fR
+does not exist and
+\fRZIP_CREATE\fR
+is not set.
+.TP 19n
+[\fRZIP_ER_NOZIP\fR]
+The file specified by
+\fIpath\fR
+is not a zip archive.
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
+The file specified by
+\fIpath\fR
+could not be opened.
+.TP 19n
+[\fRZIP_ER_READ\fR]
+A read error occurred; see
+\fIerrno\fR
+for details.
+.TP 19n
+[\fRZIP_ER_SEEK\fR]
+The file specified by
+\fIpath\fR
+does not allow seeks.
+.SH "SEE ALSO"
+libzip(3),
+zip_close(3),
+zip_error_to_str(3),
+zip_fdopen(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_register_progress_callback.man b/man/zip_register_progress_callback.man
new file mode 100644
index 0000000..f74fa7a
--- /dev/null
+++ b/man/zip_register_progress_callback.man
@@ -0,0 +1,44 @@
+.TH "ZIP_REGISTER_PROGRESS_CALLBACK" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_register_progress_callback\fR
+\- provide updates during zip_close (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fItypedef void (*zip_progress_callback_t)(double);\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_register_progress_callback\fR(\fIzip_t\ *archive\fR, \fIzip_progress_callback_t\ progress_callback\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_register_progress_callback\fR()
+is the obsolete version of
+zip_register_progress_callback_with_state(3).
+.PP
+The
+\fBzip_register_progress_callback\fR()
+function registers a callback function
+\fIprogress_callback\fR
+for the zip archive
+\fIarchive\fR.
+This function is called during
+zip_close(3)
+after every zip archive entry that's completely written to disk.
+The value is a
+\fIdouble\fR
+in the range from 0.0 to 1.0.
+This can be used to provide progress indicators for user interfaces.
+.SH "SEE ALSO"
+libzip(3),
+zip_close(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_register_progress_callback_with_state.man b/man/zip_register_progress_callback_with_state.man
new file mode 100644
index 0000000..5d8ef6f
--- /dev/null
+++ b/man/zip_register_progress_callback_with_state.man
@@ -0,0 +1,56 @@
+.TH "ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_register_progress_callback_with_state\fR
+\- provide updates during zip_close
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fItypedef void (*zip_progress_callback)(zip_t *, double, void *);\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_register_progress_callback_with_state\fR(\fIzip_t\ *archive\fR, \fIdouble\ precision\fR, \fIzip_progress_callback\ callback\fR, \fIvoid\ (*ud_free)(void\ *)\fR, \fIvoid\ *ud\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_register_progress_callback_with_state\fR()
+function registers a callback function
+\fIcallback\fR
+for the zip archive
+\fIarchive\fR.
+The
+\fIprecision\fR
+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
+\fIud_free\fR
+function is called during cleanup for deleting the userdata supplied in
+\fIud\fR.
+.PP
+The callback function is called during
+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
+\fIarchive\fR,
+the current progression state as a
+\fIdouble\fR,
+and the user-provided user-data
+\fIud\fR
+as arguments.
+The progression state is a
+\fIdouble\fR
+in the range from 0.0 to 1.0.
+This can be used to provide progress indicators for user interfaces.
+.SH "SEE ALSO"
+libzip(3),
+zip_close(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_rename.man b/man/zip_rename.man
new file mode 100644
index 0000000..cd1f60d
--- /dev/null
+++ b/man/zip_rename.man
@@ -0,0 +1,30 @@
+.TH "ZIP_RENAME" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_rename\fR
+\- rename file in zip archive (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_rename\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *name\fR);
+.PD
+.SH "DESCRIPTION"
+\fBzip_rename\fR()
+is the obsolete version of
+zip_file_rename(3).
+It is the same as calling
+zip_file_rename(3)
+with an empty flags argument.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_rename(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_set_archive_comment.man b/man/zip_set_archive_comment.man
new file mode 100644
index 0000000..a0998bd
--- /dev/null
+++ b/man/zip_set_archive_comment.man
@@ -0,0 +1,56 @@
+.TH "ZIP_SET_ARCHIVE_COMMENT" "3" "July 22, 2012" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_set_archive_comment\fR
+\- set zip archive comment
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_archive_comment\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_set_archive_comment\fR()
+function sets the comment for the entire zip archive.
+If
+\fIcomment\fR
+is
+\fRNULL\fR
+and
+\fIlen\fR
+is 0, the archive comment will be removed.
+\fIcomment\fR
+must be encoded in ASCII or UTF-8.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_set_archive_comment\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIlen\fR
+is less than 0 or longer than the maximum comment length in a zip file
+(65535), or
+\fIcomment\fR
+is not a valid UTF-8 encoded string.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_get_archive_comment(3),
+zip_get_file_comment(3),
+zip_set_file_comment(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_set_archive_flag.man b/man/zip_set_archive_flag.man
new file mode 100644
index 0000000..adfb95b
--- /dev/null
+++ b/man/zip_set_archive_flag.man
@@ -0,0 +1,37 @@
+.TH "ZIP_SET_ARCHIVE_FLAG" "3" "April 29, 2015" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_set_archive_flag\fR
+\- set zip archive flag
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_archive_flag\fR(\fIzip_t\ *archive\fR, \fIzip_flags_t\ flag\fR, \fIint\ value\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_set_archive_flag\fR()
+function sets the flag
+\fIflag\fR
+for the archive
+\fIarchive\fR
+to the value
+\fIvalue\fR.
+.PP
+Currently there are no supported flags.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned, and \-1 if an error
+occurred.
+.SH "SEE ALSO"
+libzip(3),
+zip_get_archive_flag(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_set_default_password.man b/man/zip_set_default_password.man
new file mode 100644
index 0000000..2219e71
--- /dev/null
+++ b/man/zip_set_default_password.man
@@ -0,0 +1,51 @@
+.TH "ZIP_SET_DEFAULT_PASSWORD" "3" "January 3, 2011" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_set_default_password\fR
+\- set default password for encrypted files in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_default_password\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *password\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_set_default_password\fR()
+function sets the default password used when accessing encrypted files.
+If
+\fIpassword\fR
+is
+\fRNULL\fR,
+the default password is unset.
+.PP
+If you prefer a different password for single files, use
+zip_fopen_encrypted(3)
+instead of
+zip_fopen(3).
+Usually, however, the same password is used for every file in an
+zip archive.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_set_default_password\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_fopen(3),
+zip_fopen_encrypted(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_set_file_comment.man b/man/zip_set_file_comment.man
new file mode 100644
index 0000000..ca79943
--- /dev/null
+++ b/man/zip_set_file_comment.man
@@ -0,0 +1,39 @@
+.TH "ZIP_SET_FILE_COMMENT" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_set_file_comment\fR
+\- set comment for file in zip (obsolete interface)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIint\ len\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_set_file_comment\fR()
+function is the obsolete version of
+zip_file_set_comment(3).
+The only differences are the type of the
+\fIlen\fR
+argument and the additional
+\fIflags\fR
+argument.
+\fBzip_set_file_comment\fR()
+is the same as calling
+zip_file_set_comment(3)
+with an empty
+\fIflags\fR
+argument.
+.SH "SEE ALSO"
+libzip(3),
+zip_file_set_comment(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_set_file_compression.man b/man/zip_set_file_compression.man
new file mode 100644
index 0000000..a970d81
--- /dev/null
+++ b/man/zip_set_file_compression.man
@@ -0,0 +1,92 @@
+.TH "ZIP_SET_FILE_COMPRESSION" "3" "November 13, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_set_file_compression\fR
+\- set compression method for file in zip
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_set_file_compression\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_int32_t\ comp\fR, \fIzip_uint32_t\ comp_flags\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_set_file_compression\fR()
+function sets the compression method for the file at position
+\fIindex\fR
+in the zip archive to
+\fIcomp\fR
+with the compression method specific
+\fIcomp_flags\fR.
+The
+\fIcomp\fR
+is the same as returned by
+zip_stat(3).
+For the
+\fIcomp\fR
+argument, currently only the following values are supported:
+.TP 19n
+\fRZIP_CM_DEFAULT\fR
+default compression; currently the same as
+\fRZIP_CM_DEFLATE\fR.
+.TP 19n
+\fRZIP_CM_STORE\fR
+Store the file uncompressed.
+.TP 19n
+\fRZIP_CM_BZIP2\fR
+Compress the file using the
+bzip2(1)
+algorithm.
+.TP 19n
+\fRZIP_CM_DEFLATE\fR
+Deflate the file with the
+zlib(3)
+algorithm and default options
+.PP
+\fINOTE\fR:
+Only the deflate and store methods can be assumed to be universally
+supported.
+.PP
+The
+\fIcomp_flags\fR
+argument defines the compression level, 1 being fastest compression
+and 9 highest.
+Allowed values are 0 (which uses the default compression for the
+algorithm) and 1-9, other values are undefined.
+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
+zip_stat(3).
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_set_file_compression\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_COMPNOTSUPP\fR]
+Unsupported compression method requested.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIarchive\fR,
+or the argument combination is invalid.
+.TP 19n
+[\fRZIP_ER_RDONLY\fR]
+Read-only zip file, no changes allowed.
+.SH "SEE ALSO"
+libzip(3),
+zip_stat(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_begin_write.man b/man/zip_source_begin_write.man
new file mode 100644
index 0000000..5ba499c
--- /dev/null
+++ b/man/zip_source_begin_write.man
@@ -0,0 +1,40 @@
+.TH "ZIP_SOURCE_BEGIN_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_begin_write\fR
+\- prepare zip source for writing
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_begin_write\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_begin_write\fR()
+prepares
+\fIsource\fR
+for writing.
+Usually this involves creating temporary files or allocating buffers.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_commit_write(3),
+zip_source_rollback_write(3),
+zip_source_seek_write(3),
+zip_source_tell_write(3),
+zip_source_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_buffer.man b/man/zip_source_buffer.man
new file mode 100644
index 0000000..7e26c44
--- /dev/null
+++ b/man/zip_source_buffer.man
@@ -0,0 +1,72 @@
+.TH "ZIP_SOURCE_BUFFER" "3" "October 17, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_buffer\fR
+\- create zip data source from buffer
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_buffer\fR(\fIzip_t\ *archive\fR, \fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR, \fIint\ freep\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_buffer_create\fR(\fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR, \fIint\ freep\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_buffer\fR()
+and
+\fBzip_source_buffer_create\fR()
+create a zip source from the buffer
+\fIdata\fR
+of size
+\fIlen\fR.
+If
+\fIfreep\fR
+is non-zero, the buffer will be freed when it is no longer needed.
+\fIdata\fR
+must remain valid for the lifetime of the created source.
+.PP
+The source can be used to open a zip archive from.
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_buffer\fR()
+and
+\fBzip_source_buffer_create\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIlen\fR
+is greater than zero and
+\fIdata\fR
+is
+\fRNULL\fR.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_open_from_source(3),
+zip_replace(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_close.man b/man/zip_source_close.man
new file mode 100644
index 0000000..8c0a873
--- /dev/null
+++ b/man/zip_source_close.man
@@ -0,0 +1,36 @@
+.TH "ZIP_SOURCE_CLOSE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_close\fR
+\- open zip_source (which was open for reading)
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_close\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_close\fR()
+closes
+\fIsource\fR,
+indicating that no more data will be read.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_free(3),
+zip_source_open(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_commit_write.man b/man/zip_source_commit_write.man
new file mode 100644
index 0000000..6bd026a
--- /dev/null
+++ b/man/zip_source_commit_write.man
@@ -0,0 +1,39 @@
+.TH "ZIP_SOURCE_COMMIT_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_commit_write\fR
+\- finalize changes to zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_commit_write\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_commit_write\fR()
+finishes writing data to
+\fIsource\fR
+and replaces the original with the newly written data.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_begin_write(3),
+zip_source_rollback_write(3),
+zip_source_seek_write(3),
+zip_source_tell_write(3),
+zip_source_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_error.man b/man/zip_source_error.man
new file mode 100644
index 0000000..f5784c7
--- /dev/null
+++ b/man/zip_source_error.man
@@ -0,0 +1,29 @@
+.TH "ZIP_SOURCE_ERROR" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_error\fR
+\- get zip error for data source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_error_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_error\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_source_error\fR()
+function returns the zip error for the data source
+\fIsource\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_error_code_system(3),
+zip_error_code_zip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_file.man b/man/zip_source_file.man
new file mode 100644
index 0000000..8882e66
--- /dev/null
+++ b/man/zip_source_file.man
@@ -0,0 +1,85 @@
+.TH "ZIP_SOURCE_FILE" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_file\fR
+\- create data source from a file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_file\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_file_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_file\fR()
+and
+\fBzip_source_file_create\fR()
+create a zip source from a file.
+They open
+\fIfname\fR
+and read
+\fIlen\fR
+bytes from offset
+\fIstart\fR
+from it.
+If
+\fIlen\fR
+is 0 or \-1, the whole file (starting from
+\fIstart\fR)
+is used.
+.PP
+If the file supports seek, the source can be used to open a zip archive from.
+.PP
+The file is opened and read when the data from the source is used, usually by
+\fBzip_close\fR()
+or
+\fBzip_open_from_source\fR().
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_file\fR()
+and
+\fBzip_source_file_create\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
+or
+\fIlen\fR
+are invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
+Opening
+\fIfname\fR
+failed.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_filep.man b/man/zip_source_filep.man
new file mode 100644
index 0000000..a94b4ca
--- /dev/null
+++ b/man/zip_source_filep.man
@@ -0,0 +1,77 @@
+.TH "ZIP_SOURCE_FILEP" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_filep\fR
+\- create data source from FILE *
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_filep\fR(\fIzip_t\ *archive\fR, \fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_filep_create\fR(\fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_filep\fR()
+and
+\fBzip_source_filep_create\fR()
+create a zip source from a file stream.
+They read
+\fIlen\fR
+bytes from offset
+\fIstart\fR
+from the open file stream
+\fIfile\fR.
+If
+\fIlen\fR
+is 0 or \-1, the whole file (starting from
+\fIstart\fR)
+is used.
+.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
+zip_close(3).
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_filep\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfile\fR,
+\fIstart\fR,
+or
+\fIlen\fR
+are invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_free.man b/man/zip_source_free.man
new file mode 100644
index 0000000..7bb6f3f
--- /dev/null
+++ b/man/zip_source_free.man
@@ -0,0 +1,45 @@
+.TH "ZIP_SOURCE_FREE" "3" "November 1, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_free\fR
+\- free zip data source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_source_free\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_free\fR()
+decrements the reference count of
+\fIsource\fR
+and frees it if the reference count drops to 0.
+If
+\fIsource\fR
+is
+\fRNULL\fR,
+it does nothing.
+.PP
+\fINOTE\fR:
+This function should not be called on a
+\fIsource\fR
+after it was used successfully in a
+zip_open_from_source(3),
+zip_file_add(3),
+or
+zip_file_replace(3)
+call.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_keep(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_function.man b/man/zip_source_function.man
new file mode 100644
index 0000000..ef5ec88
--- /dev/null
+++ b/man/zip_source_function.man
@@ -0,0 +1,291 @@
+.TH "ZIP_SOURCE_FUNCTION" "3" "November 6, 2017" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_function\fR
+\- create data source from function
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_function\fR(\fIzip_t\ *archive\fR, \fIzip_source_callback\ fn\fR, \fIvoid\ *userdata\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_function_create\fR(\fIzip_source_callback\ fn\fR, \fIvoid\ *userdata\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_function\fR()
+and
+\fBzip_source_function_create\fR()
+creates a zip source from the user-provided function
+\fIfn\fR,
+which must be of the following type:
+.PP
+\fItypedef zip_int64_t\fR
+\fB\fR(*\fPzip_source_callback\fR)\fP\fR(\fIvoid\ *userdata\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR, \fIzip_source_cmd_t\ cmd\fR)
+.PP
+\fIarchive\fR
+or
+\fIerror\fR
+are used for reporting errors and can be
+\fRNULL\fR.
+.PP
+When called by the library, the first argument is the
+\fIuserdata\fR
+argument supplied to the function.
+The next two arguments are a buffer
+\fIdata\fR
+of size
+\fIlen\fR
+when data is passed in or expected to be returned, or else
+\fRNULL\fR
+and 0.
+The last argument,
+\fIcmd\fR,
+specifies which action the function should perform.
+.PP
+Depending on the uses, there are three useful sets of commands to be supported by a
+\fBzip_source_callback\fR():
+.TP 24n
+read source
+Providing streamed data (for file data added to archives).
+Must support
+\fRZIP_SOURCE_OPEN\fR,
+\fRZIP_SOURCE_READ\fR,
+\fRZIP_SOURCE_CLOSE\fR,
+\fRZIP_SOURCE_STAT\fR,
+and
+\fRZIP_SOURCE_ERROR\fR.
+.TP 24n
+seekable read source
+Same as previous, but from a source allowing reading from arbitrary
+offsets (also for read-only zip archive).
+Must additionally support
+\fRZIP_SOURCE_SEEK\fR,
+\fRZIP_SOURCE_TELL\fR,
+and
+\fRZIP_SOURCE_SUPPORTS\fR.
+.TP 24n
+read/write source
+Same as previous, but additionally allowing writing (also for writable
+zip archives).
+Must additionally support
+\fRZIP_SOURCE_BEGIN_WRITE\fR,
+\fRZIP_SOURCE_COMMIT_WRITE\fR,
+\fRZIP_SOURCE_ROLLBACK_WRITE\fR,
+\fRZIP_SOURCE_SEEK_WRITE\fR,
+\fRZIP_SOURCE_TELL_WRITE\fR,
+and
+\fRZIP_SOURCE_REMOVE\fR.
+.SS "\fRZIP_SOURCE_BEGIN_WRITE\fR"
+Prepare the source for writing.
+Use this to create any temporary file(s).
+.SS "\fRZIP_SOURCE_CLOSE\fR"
+Reading is done.
+.SS "\fRZIP_SOURCE_COMMIT_WRITE\fR"
+Finish writing to the source.
+Replace the original data with the newly written data.
+Clean up temporary files or internal buffers.
+Subsequently opening and reading from the source should return the
+newly written data.
+.SS "\fRZIP_SOURCE_ERROR\fR"
+Get error information.
+\fIdata\fR
+points to an array of two ints, which should be filled with the libzip
+error code and the corresponding system error code for the error that
+occurred.
+See
+zip_errors(3)
+for details on the error codes.
+If the source stores error information in a zip_error_t, use
+zip_error_to_data(3)
+and return its return value.
+Otherwise, return 2 * sizeof(int).
+.SS "\fRZIP_SOURCE_FREE\fR"
+Clean up and free all resources, including
+\fIuserdata\fR.
+The callback function will not be called again.
+.SS "\fRZIP_SOURCE_OPEN\fR"
+Prepare for reading.
+.SS "\fRZIP_SOURCE_READ\fR"
+Read data into the buffer
+\fIdata\fR
+of size
+\fIlen\fR.
+Return the number of bytes placed into
+\fIdata\fR
+on success, and zero for end-of-file.
+.SS "\fRZIP_SOURCE_REMOVE\fR"
+Remove the underlying file.
+This is called if a zip archive is empty when closed.
+.SS "\fRZIP_SOURCE_ROLLBACK_WRITE\fR"
+Abort writing to the source.
+Discard written data.
+Clean up temporary files or internal buffers.
+Subsequently opening and reading from the source should return the
+original data.
+.SS "\fRZIP_SOURCE_SEEK\fR"
+Specify position to read next byte from, like
+fseek(3).
+Use
+ZIP_SOURCE_GET_ARGS(3)
+to decode the arguments into the following struct:
+.nf
+.sp
+.RS 0n
+struct zip_source_args_seek {
+    zip_int64_t offset;
+    int whence;
+};
+.RE
+.fi
+.PP
+If the size of the source's data is known, use
+zip_source_seek_compute_offset(3)
+to validate the arguments and compute the new offset.
+.SS "\fRZIP_SOURCE_SEEK_WRITE\fR"
+Specify position to write next byte to, like
+fseek(3).
+See
+\fRZIP_SOURCE_SEEK\fR
+for details.
+.SS "\fRZIP_SOURCE_STAT\fR"
+Get meta information for the input data.
+\fIdata\fR
+points to an allocated
+\fIstruct zip_stat\fR,
+which should be initialized using
+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,
+\fRZIP_STAT_COMP_METHOD\fR,
+\fRZIP_STAT_SIZE\fR,
+and
+\fRZIP_STAT_CRC\fR
+must be filled in.
+.PP
+If the data is encrypted,
+\fRZIP_STAT_ENCRYPTION_METHOD\fR,
+\fRZIP_STAT_COMP_METHOD\fR,
+\fRZIP_STAT_SIZE\fR,
+and
+\fRZIP_STAT_CRC\fR
+must be filled in.
+.PP
+Information only available after the source has been read (e.g., size)
+can be omitted in an earlier call.
+\fINOTE\fR:
+\fBzip_source_function\fR()
+may be called with this argument even after being called with
+\fRZIP_SOURCE_CLOSE\fR.
+.PP
+Return sizeof(struct zip_stat) on success.
+.SS "\fRZIP_SOURCE_SUPPORTS\fR"
+Return bitmap specifying which commands are supported.
+Use
+zip_source_make_command_bitmap(3).
+If this command is not implemented, the source is assumed to be a
+read source without seek support.
+.SS "\fRZIP_SOURCE_TELL\fR"
+Return the current read offset in the source, like
+ftell(3).
+.SS "\fRZIP_SOURCE_TELL_WRITE\fR"
+Return the current write offset in the source, like
+ftell(3).
+.SS "\fRZIP_SOURCE_WRITE\fR"
+Write data to the source.
+Return number of bytes written.
+.SS "Return Values"
+Commands should return \-1 on error.
+\fRZIP_SOURCE_ERROR\fR
+will be called to retrieve the error code.
+On success, commands return 0, unless specified otherwise in the
+description above.
+.SS "Calling Conventions"
+The library will always issue
+\fRZIP_SOURCE_OPEN\fR
+before issuing
+\fRZIP_SOURCE_READ\fR,
+\fRZIP_SOURCE_SEEK\fR,
+or
+\fRZIP_SOURCE_TELL\fR.
+When it no longer wishes to read from this source, it will issue
+\fRZIP_SOURCE_CLOSE\fR.
+If the library wishes to read the data again, it will issue
+\fRZIP_SOURCE_OPEN\fR
+a second time.
+If the function is unable to provide the data again, it should
+return \-1.
+.PP
+\fRZIP_SOURCE_BEGIN_WRITE\fR
+will be called before
+\fRZIP_SOURCE_WRITE\fR,
+\fRZIP_SOURCE_SEEK_WRITE\fR,
+or
+\fRZIP_SOURCE_TELL_WRITE\fR.
+When writing is complete, either
+\fRZIP_SOURCE_COMMIT_WRITE\fR
+or
+\fRZIP_SOURCE_ROLLBACK_WRITE\fR
+will be called.
+.PP
+\fRZIP_SOURCE_STAT\fR
+can be issued at any time.
+.PP
+\fRZIP_SOURCE_ERROR\fR
+will only be issued in response to the function
+returning \-1.
+.PP
+\fRZIP_SOURCE_FREE\fR
+will be the last command issued;
+if
+\fRZIP_SOURCE_OPEN\fR
+was called and succeeded,
+\fRZIP_SOURCE_CLOSE\fR
+will be called before
+\fRZIP_SOURCE_FREE\fR,
+and similarly for
+\fRZIP_SOURCE_BEGIN_WRITE\fR
+and
+\fRZIP_SOURCE_COMMIT_WRITE\fR
+or
+\fRZIP_SOURCE_ROLLBACK_WRITE\fR.
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error (unless
+it is
+\fRNULL\fR).
+.SH "ERRORS"
+\fBzip_source_function\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3),
+zip_stat_init(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_is_deleted.man b/man/zip_source_is_deleted.man
new file mode 100644
index 0000000..6313d81
--- /dev/null
+++ b/man/zip_source_is_deleted.man
@@ -0,0 +1,31 @@
+.TH "ZIP_SOURCE_IS_DELETED" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_is_deleted\fR
+\- check if zip_source is deleted
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_is_deleted\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_is_deleted\fR()
+returns whether the zip_source was deleted.
+This can for example happen when all entries are removed from a zip archive.
+.SH "RETURN VALUES"
+\fBzip_source_is_deleted\fR()
+returns 1 if the zip_source is deleted and 0 otherwise.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_keep.man b/man/zip_source_keep.man
new file mode 100644
index 0000000..b952cfe
--- /dev/null
+++ b/man/zip_source_keep.man
@@ -0,0 +1,29 @@
+.TH "ZIP_SOURCE_KEEP" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_keep\fR
+\- increment reference count of zip data source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_source_keep\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_keep\fR()
+increments the reference count of
+\fIsource\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_free(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_make_command_bitmap.man b/man/zip_source_make_command_bitmap.man
new file mode 100644
index 0000000..a90ffd3
--- /dev/null
+++ b/man/zip_source_make_command_bitmap.man
@@ -0,0 +1,31 @@
+.TH "ZIP_SOURCE_MAKE_COMMAND_BITMAP" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_make_command_bitmap\fR
+\- create bitmap of supported source operations
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_make_command_bitmap\fR(\fIzip_source_cmd_t\ command\fR, \fI...\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_source_make_command_bitmap\fR()
+function returns a bitmap of source commands suitable as return value
+for
+\fRZIP_SOURCE_SUPPORTS\fR.
+It includes all the commands from the argument list, which must be
+terminated by \-1.
+.SH "SEE ALSO"
+libzip(3),
+zip_source_function(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_open.man b/man/zip_source_open.man
new file mode 100644
index 0000000..b42761b
--- /dev/null
+++ b/man/zip_source_open.man
@@ -0,0 +1,39 @@
+.TH "ZIP_SOURCE_OPEN" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_open\fR
+\- open zip_source for reading
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_open\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_open\fR()
+opens
+\fIsource\fR
+for reading.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_begin_write(3),
+zip_source_close(3),
+zip_source_read(3),
+zip_source_seek(3),
+zip_source_tell(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_read.man b/man/zip_source_read.man
new file mode 100644
index 0000000..4bc83a3
--- /dev/null
+++ b/man/zip_source_read.man
@@ -0,0 +1,47 @@
+.TH "ZIP_SOURCE_READ" "3" "December 16, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_read\fR
+\- read data from zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_read\fR(\fIzip_source_t\ *source\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ len\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_read\fR()
+reads up to
+\fIlen\fR
+bytes of data from
+\fIsource\fR
+at the current read offset into the buffer
+\fIdata\fR.
+.PP
+The zip source
+\fIsource\fR
+has to be opened for reading by calling
+zip_source_open(3)
+first.
+.SH "RETURN VALUES"
+Upon successful completion the number of bytes read is returned.
+Upon reading end-of-file, zero is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_seek(3),
+zip_source_tell(3),
+zip_source_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_rollback_write.man b/man/zip_source_rollback_write.man
new file mode 100644
index 0000000..0f4af58
--- /dev/null
+++ b/man/zip_source_rollback_write.man
@@ -0,0 +1,42 @@
+.TH "ZIP_SOURCE_ROLLBACK_WRITE" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_rollback_write\fR
+\- undo changes to zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_source_rollback_write\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_rollback_write\fR()
+reverts changes written to
+\fIsource\fR,
+restoring the data before
+zip_source_begin_write(3)
+was called.
+Usually this removes temporary files or frees buffers.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_begin_write(3),
+zip_source_commit_write(3),
+zip_source_seek_write(3),
+zip_source_tell_write(3),
+zip_source_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_seek.man b/man/zip_source_seek.man
new file mode 100644
index 0000000..1224021
--- /dev/null
+++ b/man/zip_source_seek.man
@@ -0,0 +1,53 @@
+.TH "ZIP_SOURCE_SEEK" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_seek\fR
+\- set read offset in zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_seek\fR(\fIzip_source_t\ *source\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_seek\fR()
+sets the current read offset for
+\fIsource\fR.
+Just like in
+fseek(3),
+depending on the
+\fIwhence\fR
+argument, the
+\fIoffset\fR
+is counted relative from:
+.RS 6n
+.TP 12n
+\fRSEEK_SET\fR
+start of file
+.TP 12n
+\fRSEEK_CUR\fR
+current read offset in file
+.TP 12n
+\fRSEEK_END\fR
+end of file
+.RE
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_read(3),
+zip_source_tell(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_seek_compute_offset.man b/man/zip_source_seek_compute_offset.man
new file mode 100644
index 0000000..5e772fb
--- /dev/null
+++ b/man/zip_source_seek_compute_offset.man
@@ -0,0 +1,49 @@
+.TH "ZIP_SOURCE_SEEK_COMPUTE_OFFSET" "3" "November 13, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_seek_compute_offset\fR
+\- validate arguments and compute offset
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_seek_compute_offset\fR(\fIzip_uint64_t\ offset\fR, \fIzip_uint64_t\ length\fR, \fIvoid\ *data\fR, \fIzip_uint64_t\ data_length\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+Use this function to compute the offset for a
+\fRZIP_SOURCE_SEEK\fR
+or
+\fRZIP_SOURCE_SEEK_WRITE\fR
+command.
+\fIdata\fR
+and
+\fIdata_length\fR
+are the arguments to the source callback,
+\fIoffset\fR
+is the current offset and
+\fIlength\fR
+is the length of the source data or, for
+\fRZIP_SOURCE_SEEK_WRITE\fR,
+the amount of data written.
+.SH "RETURN VALUES"
+On success, it returns the new offset, on error it returns \-1 and
+sets
+\fIerror\fR.
+.SH "ERRORS"
+\fBzip_source_seek_compute_offset\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+One of the arguments is invalid or the seek would place the offset
+outside the data.
+.SH "SEE ALSO"
+zip_source_function(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_seek_write.man b/man/zip_source_seek_write.man
new file mode 100644
index 0000000..0ba3192
--- /dev/null
+++ b/man/zip_source_seek_write.man
@@ -0,0 +1,56 @@
+.TH "ZIP_SOURCE_SEEK_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_seek_write\fR
+\- set write offset in zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_seek_write\fR(\fIzip_source_t\ *source\fR, \fIzip_int64_t\ offset\fR, \fIint\ whence\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_seek_write\fR()
+sets the current write offset for
+\fIsource\fR.
+Just like in
+fseek(3),
+depending on the
+\fIwhence\fR
+argument, the
+\fIoffset\fR
+is counted relative from:
+.RS 6n
+.TP 12n
+\fRSEEK_SET\fR
+start of file
+.TP 12n
+\fRSEEK_CUR\fR
+current write offset in file
+.TP 12n
+\fRSEEK_END\fR
+end of file
+.RE
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_begin_write(3),
+zip_source_commit_write(3),
+zip_source_rollback_write(3),
+zip_source_tell_write(3),
+zip_source_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_stat.man b/man/zip_source_stat.man
new file mode 100644
index 0000000..24411ff
--- /dev/null
+++ b/man/zip_source_stat.man
@@ -0,0 +1,108 @@
+.TH "ZIP_SOURCE_STAT" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_stat\fR
+\- get information about zip_source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_source_stat\fR(\fIzip_source_t\ *source\fR, \fIzip_stat_t\ *sb\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_source_stat\fR()
+function obtains information about the zip source
+\fIsource\fR
+.PP
+The
+\fIsb\fR
+argument is a pointer to a
+\fIstruct zip_source_stat\fR
+(shown below), into which information about the zip source is placed.
+.nf
+.sp
+.RS 0n
+struct zip_source_stat {
+    zip_uint64_t valid;                 /* which fields have valid values */
+    const char *name;                   /* name of the file */
+    zip_uint64_t index;                 /* index within archive */
+    zip_uint64_t size;                  /* size of file (uncompressed) */
+    zip_uint64_t comp_size;             /* size of file (compressed) */
+    time_t mtime;                       /* modification time */
+    zip_uint32_t crc;                   /* crc of file data */
+    zip_uint16_t comp_method;           /* compression method used */
+    zip_uint16_t encryption_method;     /* encryption method used */
+    zip_uint32_t flags;                 /* reserved for future use */
+};
+.RE
+.fi
+The structure pointed to by
+\fIsb\fR
+must be initialized with
+\fBzip_stat_init\fR(\fI3\fR)
+before calling
+\fBzip_source_stat\fR().
+.PP
+The
+\fIvalid\fR
+field of the structure specifies which other fields are valid.
+Check if the flag defined by the following defines are in
+\fIvalid\fR
+before accessing the fields:
+.RS 6n
+.PD 0
+.TP 37n
+\fRZIP_SOURCE_STAT_NAME\fR
+\fIname\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_INDEX\fR
+\fIindex\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_SIZE\fR
+\fIsize\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_COMP_SIZE\fR
+\fIcomp_size\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_MTIME\fR
+\fImtime\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_CRC\fR
+\fIcrc\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_COMP_METHOD\fR
+\fIcomp_method\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_ENCRYPTION_METHOD\fR
+\fIencryption_method\fR
+.TP 37n
+\fRZIP_SOURCE_STAT_FLAGS\fR
+\fIflags\fR
+.RE
+.PD
+.PP
+\fINOTE\fR:
+Some fields may only be filled out after all data has been read from
+the source, for example the
+\fIcrc\fR
+or
+\fIsize\fR
+fields.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_tell.man b/man/zip_source_tell.man
new file mode 100644
index 0000000..283871e
--- /dev/null
+++ b/man/zip_source_tell.man
@@ -0,0 +1,43 @@
+.TH "ZIP_SOURCE_TELL" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_tell\fR
+\- report current read offset in zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_tell\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_tell\fR()
+returns the current read offset
+for
+\fIsource\fR.
+The return value can be passed to
+zip_source_seek(3)
+with
+\fIwhence\fR
+set to
+\fRSEEK_SET\fR
+to return to the same location in the source.
+.SH "RETURN VALUES"
+Upon successful completion the current read offset is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_read(3),
+zip_source_tell_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_tell_write.man b/man/zip_source_tell_write.man
new file mode 100644
index 0000000..d3e9f72
--- /dev/null
+++ b/man/zip_source_tell_write.man
@@ -0,0 +1,46 @@
+.TH "ZIP_SOURCE_TELL_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_tell_write\fR
+\- report current write offset in zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_tell_write\fR(\fIzip_source_t\ *source\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_tell_write\fR()
+returns the current write offset
+for
+\fIsource\fR.
+The return value can be passed to
+zip_source_seek_write(3)
+with
+\fIwhence\fR
+set to
+\fRSEEK_SET\fR
+to return to the same location in the source.
+.SH "RETURN VALUES"
+Upon successful completion the current write offset is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_begin_write(3),
+zip_source_commit_write(3),
+zip_source_rollback_write(3),
+zip_source_tell(3),
+zip_source_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_win32a.man b/man/zip_source_win32a.man
new file mode 100644
index 0000000..fe0f5c7
--- /dev/null
+++ b/man/zip_source_win32a.man
@@ -0,0 +1,88 @@
+.TH "ZIP_SOURCE_WIN32A" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_win32a\fR,
+\fBzip_source_win32a_create\fR
+\- create data source from a Windows ANSI file name
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32a\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32a_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_win32a\fR()
+and
+\fBzip_source_win32a_create\fR()
+create a zip source on Windows using a Windows ANSI name.
+They open
+\fIfname\fR
+and read
+\fIlen\fR
+bytes from offset
+\fIstart\fR
+from it.
+If
+\fIlen\fR
+is 0 or \-1, the whole file (starting from
+\fIstart\fR)
+is used.
+.PP
+If the file supports seek, the source can be used to open a zip archive from.
+.PP
+The file is opened and read when the data from the source is used, usually by
+\fBzip_close\fR()
+or
+\fBzip_open_from_source\fR().
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_win32a\fR()
+and
+\fBzip_source_win32a_create\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
+or
+\fIlen\fR
+are invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
+Opening
+\fIfname\fR
+failed.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3),
+zip_source_win32handle(3),
+zip_source_win32w(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_win32handle.man b/man/zip_source_win32handle.man
new file mode 100644
index 0000000..f0b21a3
--- /dev/null
+++ b/man/zip_source_win32handle.man
@@ -0,0 +1,88 @@
+.TH "ZIP_SOURCE_WIN32HANDLE" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_win32handle\fR,
+\fBzip_source_win32handle_create\fR
+\- create data source from a Windows file handle
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32handle\fR(\fIzip_t\ *archive\fR, \fIHANDLE\ h\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32handle_create\fR(\fIHANDLE\ h\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_win32handle\fR()
+and
+\fBzip_source_win32handle_create\fR()
+create a zip source from a Windows file handle.
+They open
+\fIfname\fR
+and read
+\fIlen\fR
+bytes from offset
+\fIstart\fR
+from it.
+If
+\fIlen\fR
+is 0 or \-1, the whole file (starting from
+\fIstart\fR)
+is used.
+.PP
+If the file supports seek, the source can be used to open a zip archive from.
+.PP
+The file is opened and read when the data from the source is used, usually by
+\fBzip_close\fR()
+or
+\fBzip_open_from_source\fR().
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_w32handle\fR()
+and
+\fBzip_source_w32handle_create\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
+or
+\fIlen\fR
+are invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
+Opening
+\fIfname\fR
+failed.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3),
+zip_source_win32a(3),
+zip_source_win32w(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_win32w.man b/man/zip_source_win32w.man
new file mode 100644
index 0000000..740e820
--- /dev/null
+++ b/man/zip_source_win32w.man
@@ -0,0 +1,88 @@
+.TH "ZIP_SOURCE_WIN32W" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_win32w\fR,
+\fBzip_source_win32w_create\fR
+\- create data source from a Windows Unicode file name
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32w\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.PP
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_win32w_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
+.PD
+.SH "DESCRIPTION"
+The functions
+\fBzip_source_win32w\fR()
+and
+\fBzip_source_win32w_create\fR()
+create a zip source on Windows using a Windows Unicode name.
+They open
+\fIfname\fR
+and read
+\fIlen\fR
+bytes from offset
+\fIstart\fR
+from it.
+If
+\fIlen\fR
+is 0 or \-1, the whole file (starting from
+\fIstart\fR)
+is used.
+.PP
+If the file supports seek, the source can be used to open a zip archive from.
+.PP
+The file is opened and read when the data from the source is used, usually by
+\fBzip_close\fR()
+or
+\fBzip_open_from_source\fR().
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+or
+\fIerror\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_win32w\fR()
+and
+\fBzip_source_win32w_create\fR()
+fail if:
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIfname\fR,
+\fIstart\fR,
+or
+\fIlen\fR
+are invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.TP 19n
+[\fRZIP_ER_OPEN\fR]
+Opening
+\fIfname\fR
+failed.
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3),
+zip_source_win32a(3),
+zip_source_win32handle(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_write.man b/man/zip_source_write.man
new file mode 100644
index 0000000..1c029b9
--- /dev/null
+++ b/man/zip_source_write.man
@@ -0,0 +1,49 @@
+.TH "ZIP_SOURCE_WRITE" "3" "November 18, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_write\fR
+\- write data to zip source
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_int64_t\fR
+.PD 0
+.HP 4n
+\fBzip_source_write\fR(\fIzip_source_t\ *source\fR, \fIconst\ void\ *data\fR, \fIzip_uint64_t\ len\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_write\fR()
+writes
+\fIlen\fR
+bytes from the buffer
+\fIdata\fR
+to the zip source
+\fIsource\fR
+at the current write offset.
+.PP
+The zip source
+\fIsource\fR
+has to be prepared for writing by calling
+zip_source_begin_write(3)
+first.
+.SH "RETURN VALUES"
+Upon successful completion the number of bytes written is returned.
+Otherwise, \-1 is returned and the error information in
+\fIsource\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_source(3),
+zip_source_begin_write(3),
+zip_source_commit_write(3),
+zip_source_rollback_write(3),
+zip_source_seek_write(3),
+zip_source_tell_write(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_source_zip.man b/man/zip_source_zip.man
new file mode 100644
index 0000000..a088036
--- /dev/null
+++ b/man/zip_source_zip.man
@@ -0,0 +1,93 @@
+.TH "ZIP_SOURCE_ZIP" "3" "August 2, 2014" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_source_zip\fR
+\- create data source from zip file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIzip_source_t *\fR
+.PD 0
+.HP 4n
+\fBzip_source_zip\fR(\fIzip_t\ *archive\fR, \fIzip_t\ *srcarchive\fR, \fIzip_uint64_t\ srcidx\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
+.PD
+.SH "DESCRIPTION"
+The function
+\fBzip_source_zip\fR()
+creates a zip source from a file in a zip archive.
+The
+\fIsrcarchive\fR
+argument is the (open) zip archive containing the source zip file
+at index
+\fIsrcidx\fR.
+\fIlen\fR
+bytes from offset
+\fIstart\fR
+will be used in the zip_source.
+If
+\fIlen\fR
+is 0 or \-1, the rest of the file, starting from
+\fIstart\fR,
+is used.
+If
+\fIstart\fR
+is zero and
+\fIlen\fR
+is \-1, the whole file will be copied without decompressing it.
+.PP
+Supported flags are:
+.TP 23n
+\fRZIP_FL_UNCHANGED\fR
+Try to get the original data without any changes that may have been
+made to
+\fIsrcarchive\fR
+after opening it.
+.TP 23n
+\fRZIP_FL_RECOMPRESS\fR
+When adding the data from
+\fIsrcarchive\fR,
+re-compress it using the current settings instead of copying the
+compressed data.
+.SH "RETURN VALUES"
+Upon successful completion, the created source is returned.
+Otherwise,
+\fRNULL\fR
+is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_source_zip\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_CHANGED\fR]
+Unchanged data was requested, but it is not available.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIsrcarchive\fR,
+\fIsrcidx\fR,
+\fIstart\fR,
+or
+\fIlen\fR
+are invalid.
+.TP 19n
+[\fRZIP_ER_MEMORY\fR]
+Required memory could not be allocated.
+.PD 0
+.PP
+Additionally, it can return all error codes from
+\fBzip_stat_index\fR()
+and
+\fBzip_fopen_index\fR().
+.PD
+.SH "SEE ALSO"
+libzip(3),
+zip_add(3),
+zip_replace(3),
+zip_source(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_stat.man b/man/zip_stat.man
new file mode 100644
index 0000000..c7ce057
--- /dev/null
+++ b/man/zip_stat.man
@@ -0,0 +1,145 @@
+.TH "ZIP_STAT" "3" "December 29, 2016" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_stat\fR,
+\fBzip_stat_index\fR
+\- get information about file
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_stat\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_flags_t\ flags\fR, \fIzip_stat_t\ *sb\fR);
+.PD
+.PP
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_stat_index\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIzip_flags_t\ flags\fR, \fIzip_stat_t\ *sb\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_stat\fR()
+function obtains information about the file named
+\fIfname\fR
+in
+\fIarchive\fR.
+The
+\fIflags\fR
+argument specifies how the name lookup should be done.
+Its values are described in
+zip_name_locate(3).
+Also,
+\fRZIP_FL_UNCHANGED\fR
+may be
+\fIor\fR'ed
+to it to request information about the original file in the archive,
+ignoring any changes made.
+.PP
+The
+\fBzip_stat_index\fR()
+function obtains information about the file at position
+\fIindex\fR.
+.PP
+The
+\fIsb\fR
+argument is a pointer to a
+\fIstruct zip_stat\fR
+(shown below), into which information about the file is placed.
+.nf
+.sp
+.RS 0n
+struct zip_stat {
+    zip_uint64_t valid;                 /* which fields have valid values */
+    const char *name;                   /* name of the file */
+    zip_uint64_t index;                 /* index within archive */
+    zip_uint64_t size;                  /* size of file (uncompressed) */
+    zip_uint64_t comp_size;             /* size of file (compressed) */
+    time_t mtime;                       /* modification time */
+    zip_uint32_t crc;                   /* crc of file data */
+    zip_uint16_t comp_method;           /* compression method used */
+    zip_uint16_t encryption_method;     /* encryption method used */
+    zip_uint32_t flags;                 /* reserved for future use */
+};
+.RE
+.fi
+The structure pointed to by
+\fIsb\fR
+must be allocated before calling
+\fBzip_stat\fR()
+or
+\fBzip_stat_index\fR().
+.PP
+The
+\fIvalid\fR
+field of the structure specifies which other fields are valid.
+Check if the flag defined by the following defines are in
+\fIvalid\fR
+before accessing the fields:
+.RS 6n
+.PD 0
+.TP 30n
+\fRZIP_STAT_NAME\fR
+\fIname\fR
+.TP 30n
+\fRZIP_STAT_INDEX\fR
+\fIindex\fR
+.TP 30n
+\fRZIP_STAT_SIZE\fR
+\fIsize\fR
+.TP 30n
+\fRZIP_STAT_COMP_SIZE\fR
+\fIcomp_size\fR
+.TP 30n
+\fRZIP_STAT_MTIME\fR
+\fImtime\fR
+.TP 30n
+\fRZIP_STAT_CRC\fR
+\fIcrc\fR
+.TP 30n
+\fRZIP_STAT_COMP_METHOD\fR
+\fIcomp_method\fR
+.TP 30n
+\fRZIP_STAT_ENCRYPTION_METHOD\fR
+\fIencryption_method\fR
+.TP 30n
+\fRZIP_STAT_FLAGS\fR
+\fIflags\fR
+.RE
+.PD
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error information in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+The function
+\fBzip_stat\fR()
+can fail for any of the errors specified for the routine
+zip_name_locate(3).
+.PP
+The function
+\fBzip_stat_index\fR()
+fails and sets the error information to
+\fRZIP_ER_INVAL\fR
+if
+\fIindex\fR
+is invalid.
+If
+\fRZIP_FL_UNCHANGED\fR
+is not set and no information can be obtained from the source
+callback, the error information is set to
+\fRZIP_ER_CHANGED\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_get_num_entries(3),
+zip_name_locate(3),
+zip_stat_init(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_stat_init.man b/man/zip_stat_init.man
new file mode 100644
index 0000000..142a74e
--- /dev/null
+++ b/man/zip_stat_init.man
@@ -0,0 +1,45 @@
+.TH "ZIP_STAT_INIT" "3" "September 22, 2013" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_stat_init\fR
+\- initialize zip_stat structure
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIvoid\fR
+.PD 0
+.HP 4n
+\fBzip_stat_init\fR(\fIzip_stat_t\ *sb\fR);
+.PD
+.SH "DESCRIPTION"
+The
+\fBzip_stat_init\fR()
+function initializes the members of a struct zip_stat.
+The current members are described in
+zip_stat(3),
+but this function should be used to initialize it to
+make sure none are missed.
+The structure pointed to by
+\fIsb\fR
+must be allocated before calling
+\fBzip_stat_init\fR().
+.PP
+This function should be used by functions provided to
+zip_source_function(3)
+when returning
+\fRZIP_SOURCE_STAT\fR
+information to make sure all fields are initialized.
+.SH "RETURN VALUES"
+If
+\fIsb\fR
+is valid, the function is always successful.
+.SH "SEE ALSO"
+libzip(3),
+zip_stat(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_unchange.man b/man/zip_unchange.man
new file mode 100644
index 0000000..38a2474
--- /dev/null
+++ b/man/zip_unchange.man
@@ -0,0 +1,44 @@
+.TH "ZIP_UNCHANGE" "3" "April 23, 2006" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_unchange\fR
+\- undo changes to file in zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_unchange\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR);
+.PD
+.SH "DESCRIPTION"
+Changes to the file at position
+\fIindex\fR
+are reverted.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "ERRORS"
+\fBzip_unchange\fR()
+fails if:
+.TP 19n
+[\fRZIP_ER_EXISTS\fR]
+Unchanging the name would result in a duplicate name in the archive.
+.TP 19n
+[\fRZIP_ER_INVAL\fR]
+\fIindex\fR
+is not a valid file index in
+\fIzip\fR.
+.SH "SEE ALSO"
+libzip(3),
+zip_unchange_all(3),
+zip_unchange_archive(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_unchange_all.man b/man/zip_unchange_all.man
new file mode 100644
index 0000000..9cf0381
--- /dev/null
+++ b/man/zip_unchange_all.man
@@ -0,0 +1,33 @@
+.TH "ZIP_UNCHANGE_ALL" "3" "April 23, 2006" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_unchange_all\fR
+\- undo all changes in a zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_unchange_all\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+All changes to files and global information in
+\fIarchive\fR
+are reverted.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_unchange(3),
+zip_unchange_archive(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zip_unchange_archive.man b/man/zip_unchange_archive.man
new file mode 100644
index 0000000..9b71cfa
--- /dev/null
+++ b/man/zip_unchange_archive.man
@@ -0,0 +1,33 @@
+.TH "ZIP_UNCHANGE_ARCHIVE" "3" "May 14, 2008" "NiH" "Library Functions Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzip_unchange_archive\fR
+\- undo global changes to zip archive
+.SH "LIBRARY"
+libzip (-lzip)
+.SH "SYNOPSIS"
+\fB#include <zip.h>\fR
+.sp
+\fIint\fR
+.PD 0
+.HP 4n
+\fBzip_unchange_archive\fR(\fIzip_t\ *archive\fR);
+.PD
+.SH "DESCRIPTION"
+Revert all global changes to the archive
+\fIarchive\fR.
+This reverts changes to the archive comment and global flags.
+.SH "RETURN VALUES"
+Upon successful completion 0 is returned.
+Otherwise, \-1 is returned and the error code in
+\fIarchive\fR
+is set to indicate the error.
+.SH "SEE ALSO"
+libzip(3),
+zip_unchange(3),
+zip_unchange_all(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zipcmp.man b/man/zipcmp.man
new file mode 100644
index 0000000..3278029
--- /dev/null
+++ b/man/zipcmp.man
@@ -0,0 +1,61 @@
+.TH "ZIPCMP" "1" "January 19, 2016" "NiH" "General Commands Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzipcmp\fR
+\- compare contents of zip archives
+.SH "SYNOPSIS"
+.HP 7n
+\fBzipcmp\fR
+[\fB\-hipqtVv\fR]
+\fIarchive1\ archive2\fR
+.SH "DESCRIPTION"
+\fBzipcmp\fR
+compares the zip archives or directories
+\fIarchive1\fR
+and
+\fIarchive2\fR
+and checks if they contain the same files, comparing their names,
+uncompressed sizes, and CRCs.
+File order and compressed size differences are ignored.
+.PP
+Supported options:
+.TP 5n
+\fB\-h\fR
+Display a short help message and exit.
+.TP 5n
+\fB\-i\fR
+Compare names ignoring case distinctions.
+.TP 5n
+\fB\-p\fR
+Enable paranoid checks.
+Compares extra fields and other meta data.
+(Automatically disabled if one of the archives is a directory.)
+.TP 5n
+\fB\-q\fR
+Quiet mode.
+Compare
+\fB\-v\fR.
+.TP 5n
+\fB\-t\fR
+Test zip files by comparing the contents to their checksums.
+.TP 5n
+\fB\-V\fR
+Display version information and exit.
+.TP 5n
+\fB\-v\fR
+Verbose mode.
+Print details about differences to stdout.
+(This is the default.)
+.SH "EXIT STATUS"
+\fBzipcmp\fR
+exits 0 if the two archives contain the same files, 1 if they differ,
+and >1 if an error occurred.
+.SH "SEE ALSO"
+zipmerge(1),
+ziptool(1),
+libzip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/zipmerge.man b/man/zipmerge.man
new file mode 100644
index 0000000..3e7e7f3
--- /dev/null
+++ b/man/zipmerge.man
@@ -0,0 +1,62 @@
+.TH "ZIPMERGE" "1" "April 25, 2017" "NiH" "General Commands Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBzipmerge\fR
+\- merge zip archives
+.SH "SYNOPSIS"
+.HP 9n
+\fBzipmerge\fR
+[\fB\-DhIiSsV\fR]
+\fItarget-zip\fR
+\fIsource-zip\fR\ [\fIsource-zip\ ...\fR]
+.SH "DESCRIPTION"
+\fBzipmerge\fR
+merges the source zip archives
+\fIsource-zip\fR
+into the target zip archive
+\fItarget-zip\fR.
+By default, files in the source zip archives overwrite
+existing files of the same name in the target zip archive.
+.PP
+Supported options:
+.TP 5n
+\fB\-D\fR
+Ignore directory components in file name comparisons.
+This option is slow for archives with many files.
+.TP 5n
+\fB\-h\fR
+Display a short help message and exit.
+.TP 5n
+\fB\-I\fR
+Ignore case in file name comparisons
+This option is slow for archives with many files.
+.TP 5n
+\fB\-i\fR
+Ask before overwriting files.
+See also
+\fB\-s\fR.
+.TP 5n
+\fB\-S\fR
+Do not overwrite files that have the same size and
+CRC32 in both the source and target archives.
+.TP 5n
+\fB\-s\fR
+When
+\fB\-i\fR
+is given, do not before overwriting files that have the same size
+and CRC32.
+.TP 5n
+\fB\-V\fR
+Display version information and exit.
+.SH "EXIT STATUS"
+\fBzipmerge\fR
+exits 0 on success and >1 if an error occurred.
+.SH "SEE ALSO"
+zipcmp(1),
+ziptool(1),
+libzip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>
diff --git a/man/ziptool.man b/man/ziptool.man
new file mode 100644
index 0000000..83e585d
--- /dev/null
+++ b/man/ziptool.man
@@ -0,0 +1,354 @@
+.TH "ZIPTOOL" "1" "December 4, 2017" "NiH" "General Commands Manual"
+.nh
+.if n .ad l
+.SH "NAME"
+\fBziptool\fR
+\- modify zip archives
+.SH "SYNOPSIS"
+.HP 8n
+\fBziptool\fR
+[\fB\-ceghnrst\fR]
+[\fB\-l\fR\ \fIlength\fR]
+[\fB\-o\fR\ \fIoffset\fR]
+\fIzip-archive\fR
+\fBcommand\fR\ [\fIcommand-args\ ...\fR]
+[\fBcommand\fR\ [\fIcommand-args\ ...\fR]\ ...]
+.SH "DESCRIPTION"
+\fBziptool\fR
+modifies the zip archive
+\fIzip-archive\fR
+according to the
+\fIcommands\fR
+given.
+.PP
+Supported options:
+.TP 13n
+\fB\-c\fR
+Check zip archive consistency when opening it.
+.TP 13n
+\fB\-e\fR
+Error if archive already exists (only useful with
+\fB\-n\fR).
+.TP 13n
+\fB\-g\fR
+Guess file name encoding (for
+\fBstat\fR
+command).
+.TP 13n
+\fB\-h\fR
+Display help.
+.TP 13n
+\fB\-l\fR \fIlength\fR
+Only read
+\fIlength\fR
+bytes of archive.
+See also
+\fB\-o\fR.
+.TP 13n
+\fB\-n\fR
+Create archive if it doesn't exist.
+See also
+\fB\-e\fR.
+.TP 13n
+\fB\-o\fR \fIoffset\fR
+Start reading input archive from
+\fIoffset\fR.
+See also
+\fB\-l\fR.
+.TP 13n
+\fB\-r\fR
+Print raw file name encoding without translation (for
+\fBstat\fR
+command).
+.TP 13n
+\fB\-s\fR
+Follow file name convention strictly (for
+\fBstat\fR
+command).
+.TP 13n
+\fB\-t\fR
+Disregard current file contents, if any.
+\fINote\fR:
+use this with care, it deletes all existing file contents when
+you modify the archive.
+.SS "Commands"
+For all commands below, the index is zero-based.
+In other words, the first entry in the zip archive has index 0.
+.PP
+Supported commands and arguments are:
+.TP 12n
+\fBadd\fR \fIname content\fR
+Add file called
+\fIname\fR
+using the string
+\fIcontent\fR
+from the command line as data.
+.TP 12n
+\fBadd_dir\fR \fIname\fR
+Add directory
+\fIname\fR.
+.TP 12n
+\fBadd_file\fR \fIname file_to_add offset len\fR
+Add file
+\fIname\fR
+to archive, using
+\fIlen\fR
+bytes from the file
+\fIfile_to_add\fR
+as input data, starting at
+\fIoffset\fR.
+.TP 12n
+\fBadd_from_zip\fR \fIname archivename index offset len\fR
+Add file called
+\fIname\fR
+to archive using data from another zip archive
+\fIarchivename\fR
+using the entry with index
+\fIindex\fR
+and reading
+\fIlen\fR
+bytes from
+\fIoffset\fR.
+.TP 12n
+\fBcat\fR \fIindex\fR
+Output file contents for entry
+\fIindex\fR
+to stdout.
+.TP 12n
+\fBcount_extra\fR \fIindex flags\fR
+Print the number of extra fields for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBcount_extra_by_id\fR \fIindex extra_id flags\fR
+Print number of extra fields of type
+\fIextra_id\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBdelete\fR \fIindex\fR
+Remove entry at
+\fIindex\fR
+from zip archive.
+.TP 12n
+\fBdelete_extra\fR \fIindex extra_idx flags\fR
+Remove extra field number
+\fIextra_idx\fR
+from archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBdelete_extra_by_id\fR \fIindex extra_id extra_index flags\fR
+Remove extra field number
+\fIextra_index\fR
+of type
+\fIextra_id\fR
+from archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBget_archive_comment\fR
+Print archive comment.
+.TP 12n
+\fBget_extra\fR \fIindex extra_index flags\fR
+Print extra field
+\fIextra_index\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBget_extra_by_id\fR \fIindex extra_id extra_index flags\fR
+Print extra field
+\fIextra_index\fR
+of type
+\fIextra_id\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR.
+.TP 12n
+\fBget_file_comment\fR \fIindex\fR
+Get file comment for archive entry
+\fIindex\fR.
+.TP 12n
+\fBget_num_entries\fR \fIflags\fR
+Print number of entries in archive using
+\fIflags\fR.
+.TP 12n
+\fBname_locate\fR \fIname flags\fR
+Find entry in archive with the filename
+\fIname\fR
+using
+\fIflags\fR
+and print its index.
+.TP 12n
+\fBrename\fR \fIindex name\fR
+Rename archive entry
+\fIindex\fR
+to
+\fIname\fR.
+.TP 12n
+\fBreplace_file_contents\fR \fIindex data\fR
+Replace file contents for archive entry
+\fIindex\fR
+with the string
+\fIdata\fR.
+.TP 12n
+\fBset_archive_comment\fR \fIcomment\fR
+Set archive comment to
+\fIcomment\fR.
+.TP 12n
+\fBset_extra\fR \fIindex extra_id extra_index flags value\fR
+Set extra field number
+\fIextra_index\fR
+of type
+\fIextra_id\fR
+for archive entry
+\fIindex\fR
+using
+\fIflags\fR
+to
+\fIvalue\fR.
+.TP 12n
+\fBset_file_comment\fR \fIindex comment\fR
+Set file comment for archive entry
+\fIindex\fR
+to string
+\fIcomment\fR.
+.TP 12n
+\fBset_file_compression\fR \fIindex method compression_flags\fR
+Set file compression method for archive entry
+\fIindex\fR
+to
+\fImethod\fR
+using
+\fIcompression_flags\fR.
+\fINote\fR:
+Currently,
+\fIcompression_flags\fR
+are ignored.
+.TP 12n
+\fBset_file_encryption\fR \fIindex method password\fR
+Set file encryption method for archive entry
+\fIindex\fR
+to
+\fImethod\fR
+with password
+\fIpassword\fR.
+.TP 12n
+\fBset_file_mtime\fR \fIindex timestamp\fR
+Set file modification time for archive entry
+\fIindex\fR
+to UNIX mtime
+\fItimestamp\fR.
+.TP 12n
+\fBset_file_mtime_all\fR \fItimestamp\fR
+Set file modification time for all archive entries to UNIX mtime
+\fItimestamp\fR.
+.TP 12n
+\fBset_password\fR \fIpassword\fR
+Set default password for encryption/decryption to
+\fIpassword\fR.
+.TP 12n
+\fBstat\fR \fIindex\fR
+Print information about archive entry
+\fIindex\fR.
+.SS "Flags"
+Some commands take flag arguments.
+Supported flags are:
+.RS 6n
+.PD 0
+.TP 5n
+\fIC\fR
+\fRZIP_FL_NOCASE\fR
+.TP 5n
+\fIc\fR
+\fRZIP_FL_CENTRAL\fR
+.TP 5n
+\fId\fR
+\fRZIP_FL_NODIR\fR
+.TP 5n
+\fIl\fR
+\fRZIP_FL_LOCAL\fR
+.TP 5n
+\fIu\fR
+\fRZIP_FL_UNCHANGED\fR
+.RE
+.PD
+.SS "Compression Methods"
+Some commands take compression method arguments.
+Supported methods are:
+.RS 6n
+.PD 0
+.TP 4n
+\fB\(bu\fR
+\fRdefault\fR
+.TP 4n
+\fB\(bu\fR
+\fRdeflate\fR
+.TP 4n
+\fB\(bu\fR
+\fRstore\fR
+.RE
+.PD
+.SS "Encryption Methods"
+Some commands take encryption method arguments.
+Supported methods are:
+.RS 6n
+.PD 0
+.TP 4n
+\fB\(bu\fR
+\fRnone\fR
+.TP 4n
+\fB\(bu\fR
+\fRAES-128\fR
+.TP 4n
+\fB\(bu\fR
+\fRAES-192\fR
+.TP 4n
+\fB\(bu\fR
+\fRAES-256\fR
+.RE
+.PD
+.SH "EXIT STATUS"
+.br
+The \fBziptool\fR utility exits\~0 on success, and\~>0 if an error occurs.
+.SH "EXAMPLES"
+Add a file called
+\fIteststring.txt\fR
+to the zip archive
+\fItestbuffer.zip\fR
+with data
+\(LqThis is a test.\en\(Rq
+where
+\(Lq\en\(Rq
+is replaced with a newline character:
+.nf
+.sp
+.RS 6n
+ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
+.RE
+.fi
+.PP
+Delete the first file from the zip archive
+\fItestfile.zip\fR:
+.nf
+.sp
+.RS 6n
+ziptool testfile.zip delete 0
+.RE
+.fi
+.SH "SEE ALSO"
+zipcmp(1),
+zipmerge(1),
+libzip(3)
+.SH "AUTHORS"
+Dieter Baron <\fIdillo@nih.at\fR>
+and
+Thomas Klausner <\fItk@giga.or.at\fR>