1 .\" zip_fopen.mdoc -- open file in zip archive for reading
2 .\" Copyright (C) 2003-2016 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.
32 .Dd September 12, 2016
38 .Nd open file in zip archive for reading
44 .Fn zip_fopen "zip_t *archive" "const char *fname" "zip_flags_t flags"
46 .Fn zip_fopen_index "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags"
50 function opens the file name
56 argument specifies how the name lookup should be done, according to
57 the values are described in
58 .Xr zip_name_locate 3 .
59 Also, the following values may be
62 .Bl -tag -offset indent -width ZIP_FL_COMPRESSED
63 .It Dv ZIP_FL_COMPRESSED
64 Read the compressed data.
65 Otherwise the data is uncompressed by
67 .It Dv ZIP_FL_UNCHANGED
68 Read the original data from the zip archive, ignoring any changes made
74 function opens the file at position
77 If encrypted data is encountered, the functions call
78 .Xr zip_fopen_encrypted 3
80 .Xr zip_fopen_index_encrypted 3
81 respectively, using the default password set with
82 .Xr zip_set_default_password 3 .
84 Upon successful completion, a
89 is returned and the error code in
91 is set to indicate the error.
94 .It Bq Er ZIP_ER_CHANGED
95 The file data has been changed.
96 .It Bq Er ZIP_ER_COMPNOTSUPP
97 The compression method used is not supported.
98 .It Bq Er ZIP_ER_ENCRNOTSUPP
99 The encryption method used is not supported.
100 .It Bq Er ZIP_ER_MEMORY
101 Required memory could not be allocated.
102 .It Bq Er ZIP_ER_NOPASSWD
103 The file is encrypted, but no password has been provided.
104 .It Bq Er ZIP_ER_READ
105 A file read error occurred.
106 .It Bq Er ZIP_ER_SEEK
107 A file seek error occurred.
108 .It Bq Er ZIP_ER_WRONGPASSWD
109 The provided password does not match the password used for encryption.
110 Note that some incorrect passwords are not detected by the check done by
112 .It Bq Er ZIP_ER_ZLIB
113 Initializing the zlib stream failed.
118 may also fail and set
120 for any of the errors specified for the routine
121 .Xr zip_name_locate 3 .
135 .Xr zip_get_num_entries 3 ,
136 .Xr zip_name_locate 3 ,
137 .Xr zip_set_default_password 3
140 .An Dieter Baron Aq Mt dillo@nih.at
142 .An Thomas Klausner Aq Mt tk@giga.or.at