1 .\" zip_open.mdoc -- open zip archive
2 .\" Copyright (C) 2003-2022 Dieter Baron and Thomas Klausner
4 .\" This file is part of libzip, a library to manipulate ZIP archives.
5 .\" The authors can be contacted at <libzip@nih.at>
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in
14 .\" the documentation and/or other materials provided with the
16 .\" 3. The names of the authors may not be used to endorse or promote
17 .\" products derived from this software without specific prior
18 .\" written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
21 .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
24 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
28 .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 .Nm zip_open_from_source
44 .Fn zip_open "const char *path" "int flags" "int *errorp"
46 .Fn zip_open_from_source "zip_source_t *zs" "int flags" "zip_error_t *ze"
50 function opens the zip archive specified by
52 and returns a pointer to a
54 used to manipulate the archive.
59 the following values, or 0 for none of them.
60 .Bl -tag -offset indent -width ZIP_CHECKCONS
62 Perform additional stricter consistency checks on the archive, and
65 Create the archive if it does not exist.
67 Error if archive already exists.
69 If archive exists, ignore its current contents.
70 In other words, handle it the same way as an empty archive.
72 Open archive in read-only mode.
75 If an error occurs and
79 it will be set to the corresponding error code.
82 .Fn zip_open_from_source
83 function opens a zip archive encapsulated by the zip_source
87 In case of error, the zip_error
91 Upon successful completion
94 .Fn zip_open_from_source
104 to indicate the error, while
105 .Fn zip_open_from source
108 to indicate the error.
110 The archive specified by
114 .It Bq Er ZIP_ER_EXISTS
115 The file specified by
120 .It Bq Er ZIP_ER_INCONS
121 Inconsistencies were found in the file specified by
123 This error is often caused by specifying
125 but can also happen without it.
126 .It Bq Er ZIP_ER_INVAL
131 .It Bq Er ZIP_ER_MEMORY
132 Required memory could not be allocated.
133 .It Bq Er ZIP_ER_NOENT
134 The file specified by
139 .It Bq Er ZIP_ER_NOZIP
140 The file specified by
142 is not a zip archive.
143 .It Bq Er ZIP_ER_OPEN
144 The file specified by
147 .It Bq Er ZIP_ER_READ
148 A read error occurred; see
151 .It Bq Er ZIP_ER_SEEK
152 The file specified by
154 does not allow seeks.
156 For newly created archives,
158 does not try to create the file; this is done when calling
160 and any errors, like missing write permissions, will
165 .Xr zip_error_strerror 3 ,
170 .Fn zip_open_from_source
171 were added in libzip 1.0.
174 .An Dieter Baron Aq Mt dillo@nih.at
176 .An Thomas Klausner Aq Mt tk@giga.or.at