blob: cabafb2a18a023d956a67ff23f816cc02e249ad6 [file] [log] [blame]
Thomas Klausner39b5f9e2005-06-09 21:14:54 +00001.\" $NiH: zip_open.mdoc,v 1.21 2005/06/09 21:13:12 wiz Exp $
Dieter Baron90288262003-10-01 18:28:10 +00002.\"
Dieter Baronbb1453e2003-10-02 14:20:53 +00003.\" zip_open.mdoc -- open zip archive
Thomas Klausnerbe31d742005-06-09 19:51:23 +00004.\" Copyright (C) 2003, 2005 Dieter Baron and Thomas Klausner
Dieter Baronbb1453e2003-10-02 14:20:53 +00005.\"
6.\" This file is part of libzip, a library to manipulate ZIP archives.
Dieter Baron90288262003-10-01 18:28:10 +00007.\" The authors can be contacted at <nih@giga.or.at>
8.\"
Dieter Baronbb1453e2003-10-02 14:20:53 +00009.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\" 3. The names of the authors may not be used to endorse or promote
19.\" products derived from this software without specific prior
20.\" written permission.
Thomas Klausnere9faec42003-10-02 15:52:56 +000021.\"
Dieter Baronbb1453e2003-10-02 14:20:53 +000022.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
23.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
26.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
30.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33.\"
Thomas Klausnerc2995a52003-12-27 22:37:34 +000034.Dd December 27, 2003
Dieter Baron90288262003-10-01 18:28:10 +000035.Dt ZIP_OPEN 3
36.Os
37.Sh NAME
38.Nm zip_open
39.Nd open zip archive
40.Sh LIBRARY
Dieter Baronff551f12003-10-03 12:04:09 +000041libzip (-lzip)
Dieter Baron90288262003-10-01 18:28:10 +000042.Sh SYNOPSIS
Thomas Klausner680c87b2003-10-02 15:32:02 +000043.In zip.h
Dieter Baron90288262003-10-01 18:28:10 +000044.Ft struct zip *
Dieter Baron321bc802003-10-06 16:36:54 +000045.Fn zip_open "const char *path" "int flags" "int *errorp"
Dieter Baron90288262003-10-01 18:28:10 +000046.Sh DESCRIPTION
Thomas Klausnere9faec42003-10-02 15:52:56 +000047The zip archive specified by
48.Ar path
49is opened and a pointer to a
Dieter Baron214922d2003-10-02 15:48:47 +000050.Ft struct zip ,
Dieter Baron7c43a822003-10-02 16:00:55 +000051used to manipulate the archive, is returned.
Dieter Barondd9afca2003-10-02 14:13:37 +000052The
53.Fa flags
54are specified by
Thomas Klausner680c87b2003-10-02 15:32:02 +000055.Em or Ns No 'ing
Dieter Barondd9afca2003-10-02 14:13:37 +000056the following values, or 0 for none of them.
57.Bl -tag -offset indent -width ZIP_CHECKCONS
58.It Dv ZIP_CREATE
59Create the archive if it does not exist.
60.It Dv ZIP_EXCL
61Error if archive already exists.
62.It Dv ZIP_CHECKCONS
63Perform additional consistency checks on the archive, and error if
64they fail.
Thomas Klausnerb9148ee2003-12-28 00:51:51 +000065.El
Thomas Klausner81225ec2003-10-06 17:02:07 +000066.Pp
67If an error occurs and
Dieter Baron321bc802003-10-06 16:36:54 +000068.Ar errorp
69is non-NULL, it will be set to the corresponding error code.
Dieter Baron90288262003-10-01 18:28:10 +000070.Sh RETURN VALUES
71Upon successful completion
Dieter Barondd9afca2003-10-02 14:13:37 +000072.Fn zip_open
Dieter Baron90288262003-10-01 18:28:10 +000073returns a
Thomas Klausner680c87b2003-10-02 15:32:02 +000074.Ft struct zip
Dieter Baron90288262003-10-01 18:28:10 +000075pointer.
76Otherwise,
77.Dv NULL
Dieter Baron321bc802003-10-06 16:36:54 +000078is returned and
79.Ar *errorp
Dieter Baron90288262003-10-01 18:28:10 +000080is set to indicate the error.
Dieter Baron214922d2003-10-02 15:48:47 +000081.Sh ERRORS
Dieter Baron99d31972003-10-07 11:54:17 +000082The archive specified by
83.Ar path
84is opened unless:
Dieter Baron214922d2003-10-02 15:48:47 +000085.Bl -tag -width Er
Thomas Klausnerd0147e92004-11-17 21:55:17 +000086.It Bq Er ZIP_ER_EXISTS
Dieter Baron99d31972003-10-07 11:54:17 +000087The file specified by
88.Ar path
89exists and
Dieter Baron68d238c2003-10-03 11:19:03 +000090.Dv ZIP_EXCL
91is set.
Thomas Klausnerd0147e92004-11-17 21:55:17 +000092.It Bq Er ZIP_ER_INCONS
Dieter Baron99d31972003-10-07 11:54:17 +000093Inconsistencies were found in the file specified by
Thomas Klausnercdfa8482003-10-09 13:39:08 +000094.Ar path
95and
Dieter Baron321bc802003-10-06 16:36:54 +000096.Dv ZIP_CHECKCONS
97was specified.
Thomas Klausnerd0147e92004-11-17 21:55:17 +000098.It Bq Er ZIP_ER_INVAL
Thomas Klausnere9faec42003-10-02 15:52:56 +000099The
Dieter Baron214922d2003-10-02 15:48:47 +0000100.Ar path
101argument is
102.Dv NULL .
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000103.It Bq Er ZIP_ER_MEMORY
Dieter Baron214922d2003-10-02 15:48:47 +0000104Required memory could not be allocated.
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000105.It Bq Er ZIP_ER_NOENT
Dieter Baron99d31972003-10-07 11:54:17 +0000106The file specified by
107.Ar path
108does not exist and
Dieter Baron214922d2003-10-02 15:48:47 +0000109.Dv ZIP_CREATE
110is not set.
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000111.It Bq Er ZIP_ER_NOZIP
Dieter Baron99d31972003-10-07 11:54:17 +0000112The file specified by
113.Ar path
114is not a zip archive.
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000115.It Bq Er ZIP_ER_OPEN
Dieter Baron99d31972003-10-07 11:54:17 +0000116The file specified by
117.Ar path
118could not be opened.
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000119.It Bq Er ZIP_ER_READ
Dieter Baron214922d2003-10-02 15:48:47 +0000120A read error occurred; see
121.Va errno
122for details.
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000123.It Bq Er ZIP_ER_SEEK
Dieter Baron99d31972003-10-07 11:54:17 +0000124The file specified by
125.Ar path
126does not allow seeks.
Dieter Baron214922d2003-10-02 15:48:47 +0000127.El
128.Sh SEE ALSO
Thomas Klausnerbec1cfe2005-06-09 18:50:27 +0000129.Xr libzip 3 ,
Thomas Klausnerc2995a52003-12-27 22:37:34 +0000130.Xr zip_close 3 ,
Thomas Klausner2e874fb2004-11-24 16:18:03 +0000131.Xr zip_error_to_str 3
Thomas Klausnera456cf52005-06-09 21:13:13 +0000132.Sh AUTHORS
133.An -nosplit
134.An Dieter Baron Aq dillo@giga.or.at
Thomas Klausner39b5f9e2005-06-09 21:14:54 +0000135and
Thomas Klausnera456cf52005-06-09 21:13:13 +0000136.An Thomas Klausner Aq tk@giga.or.at