Imported Upstream version 0.10.1
[platform/upstream/libzip.git] / man / zip_open.mdoc
1 .\" zip_open.mdoc -- open zip archive
2 .\" Copyright (C) 2003-2009 Dieter Baron and Thomas Klausner
3 .\"
4 .\" This file is part of libzip, a library to manipulate ZIP archives.
5 .\" The authors can be contacted at <libzip@nih.at>
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
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
15 .\"    distribution.
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.
19 .\"
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.
31 .\"
32 .Dd February 15, 2009
33 .Dt ZIP_OPEN 3
34 .Os
35 .Sh NAME
36 .Nm zip_open
37 .Nd open zip archive
38 .Sh LIBRARY
39 libzip (-lzip)
40 .Sh SYNOPSIS
41 .In zip.h
42 .Ft struct zip *
43 .Fn zip_open "const char *path" "int flags" "int *errorp"
44 .Sh DESCRIPTION
45 The zip archive specified by
46 .Ar path
47 is opened and a pointer to a
48 .Ft struct zip ,
49 used to manipulate the archive, is returned.
50 The
51 .Fa flags
52 are specified by
53 .Em or Ns No 'ing
54 the following values, or 0 for none of them.
55 .Bl -tag -offset indent -width ZIP_CHECKCONS
56 .It Dv ZIP_CREATE
57 Create the archive if it does not exist.
58 .It Dv ZIP_EXCL
59 Error if archive already exists.
60 .It Dv ZIP_CHECKCONS
61 Perform additional consistency checks on the archive, and error if
62 they fail.
63 .El
64 .Pp
65 If an error occurs and
66 .Ar errorp
67 is non-NULL, it will be set to the corresponding error code.
68 .Sh RETURN VALUES
69 Upon successful completion
70 .Fn zip_open
71 returns a
72 .Ft struct zip
73 pointer.
74 Otherwise,
75 .Dv NULL
76 is returned and
77 .Ar *errorp
78 is set to indicate the error.
79 .Sh ERRORS
80 The archive specified by
81 .Ar path
82 is opened unless:
83 .Bl -tag -width Er
84 .It Bq Er ZIP_ER_EXISTS
85 The file specified by
86 .Ar path
87 exists and
88 .Dv ZIP_EXCL
89 is set.
90 .It Bq Er ZIP_ER_INCONS
91 Inconsistencies were found in the file specified by
92 .Ar path
93 and
94 .Dv ZIP_CHECKCONS
95 was specified.
96 .It Bq Er ZIP_ER_INVAL
97 The
98 .Ar path
99 argument is
100 .Dv NULL .
101 .It Bq Er ZIP_ER_MEMORY
102 Required memory could not be allocated.
103 .It Bq Er ZIP_ER_NOENT
104 The file specified by
105 .Ar path
106 does not exist and
107 .Dv ZIP_CREATE
108 is not set.
109 .It Bq Er ZIP_ER_NOZIP
110 The file specified by
111 .Ar path
112 is not a zip archive.
113 .It Bq Er ZIP_ER_OPEN
114 The file specified by
115 .Ar path
116 could not be opened.
117 .It Bq Er ZIP_ER_READ
118 A read error occurred; see
119 .Va errno
120 for details.
121 .It Bq Er ZIP_ER_SEEK
122 The file specified by
123 .Ar path
124 does not allow seeks.
125 .El
126 .Sh SEE ALSO
127 .Xr libzip 3 ,
128 .Xr zip_close 3 ,
129 .Xr zip_error_to_str 3 ,
130 .Xr zip_fdopen 3
131 .Sh AUTHORS
132 .An -nosplit
133 .An Dieter Baron Aq dillo@giga.or.at
134 and
135 .An Thomas Klausner Aq tk@giga.or.at