Dieter Baron | bb1453e | 2003-10-02 14:20:53 +0000 | [diff] [blame] | 1 | .\" zip_open.mdoc -- open zip archive |
Thomas Klausner | ea8ba49 | 2014-09-23 16:54:47 +0200 | [diff] [blame] | 2 | .\" Copyright (C) 2003-2014 Dieter Baron and Thomas Klausner |
Dieter Baron | bb1453e | 2003-10-02 14:20:53 +0000 | [diff] [blame] | 3 | .\" |
| 4 | .\" This file is part of libzip, a library to manipulate ZIP archives. |
Dieter Baron | b86c433 | 2007-11-07 14:35:13 +0100 | [diff] [blame] | 5 | .\" The authors can be contacted at <libzip@nih.at> |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 6 | .\" |
Dieter Baron | bb1453e | 2003-10-02 14:20:53 +0000 | [diff] [blame] | 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. |
Thomas Klausner | e9faec4 | 2003-10-02 15:52:56 +0000 | [diff] [blame] | 19 | .\" |
Dieter Baron | bb1453e | 2003-10-02 14:20:53 +0000 | [diff] [blame] | 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 | .\" |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 32 | .Dd November 9, 2014 |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 33 | .Dt ZIP_OPEN 3 |
| 34 | .Os |
| 35 | .Sh NAME |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 36 | .Nm zip_open , |
| 37 | .Nm zip_open_from_source |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 38 | .Nd open zip archive |
| 39 | .Sh LIBRARY |
Dieter Baron | ff551f1 | 2003-10-03 12:04:09 +0000 | [diff] [blame] | 40 | libzip (-lzip) |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 41 | .Sh SYNOPSIS |
Thomas Klausner | 680c87b | 2003-10-02 15:32:02 +0000 | [diff] [blame] | 42 | .In zip.h |
Dieter Baron | 1d9dfeb | 2014-09-28 23:02:54 +0200 | [diff] [blame] | 43 | .Ft zip_t * |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 44 | .Fn zip_open "const char *path" "int flags" "int *errorp" |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 45 | .Ft zip_t * |
| 46 | .Fn zip_open_from_source "zip_source_t *zs" "int flags" "zip_error_t *ze" |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 47 | .Sh DESCRIPTION |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 48 | The |
| 49 | .Fn zip_open |
| 50 | function opens the zip archive specified by |
Thomas Klausner | e9faec4 | 2003-10-02 15:52:56 +0000 | [diff] [blame] | 51 | .Ar path |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 52 | and returns a pointer to a |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 53 | .Ft struct zip , |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 54 | used to manipulate the archive. |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 55 | The |
| 56 | .Fa flags |
| 57 | are specified by |
Thomas Klausner | 680c87b | 2003-10-02 15:32:02 +0000 | [diff] [blame] | 58 | .Em or Ns No 'ing |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 59 | the following values, or 0 for none of them. |
| 60 | .Bl -tag -offset indent -width ZIP_CHECKCONS |
Thomas Klausner | 05f950f | 2012-02-13 23:11:35 +0100 | [diff] [blame] | 61 | .It Dv ZIP_CHECKCONS |
| 62 | Perform additional stricter consistency checks on the archive, and |
| 63 | error if they fail. |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 64 | .It Dv ZIP_CREATE |
| 65 | Create the archive if it does not exist. |
| 66 | .It Dv ZIP_EXCL |
| 67 | Error if archive already exists. |
Thomas Klausner | 05f950f | 2012-02-13 23:11:35 +0100 | [diff] [blame] | 68 | .It Dv ZIP_TRUNCATE |
| 69 | If archive exists, ignore its current contents. |
| 70 | In other words, handle it the same way as an empty archive. |
Thomas Klausner | ea8ba49 | 2014-09-23 16:54:47 +0200 | [diff] [blame] | 71 | .It Dv ZIP_RDONLY |
| 72 | Open archive in read-only mode. |
Thomas Klausner | b9148ee | 2003-12-28 00:51:51 +0000 | [diff] [blame] | 73 | .El |
Thomas Klausner | 81225ec | 2003-10-06 17:02:07 +0000 | [diff] [blame] | 74 | .Pp |
| 75 | If an error occurs and |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 76 | .Ar errorp |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 77 | is |
| 78 | .Pf non- Dv NULL , |
| 79 | it will be set to the corresponding error code. |
| 80 | .Pp |
| 81 | The |
| 82 | .Fn zip_open_from_source |
| 83 | function opens a zip archive encapsulated by the zip_source |
| 84 | .Fa zs |
| 85 | using the provided |
| 86 | .Fa flags . |
| 87 | In case of error, the zip_error |
| 88 | .Fa ze |
| 89 | is filled in. |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 90 | .Sh RETURN VALUES |
| 91 | Upon successful completion |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 92 | .Fn zip_open |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 93 | and |
| 94 | .Fn zip_open_from_source |
| 95 | return a |
Thomas Klausner | 680c87b | 2003-10-02 15:32:02 +0000 | [diff] [blame] | 96 | .Ft struct zip |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 97 | pointer. |
| 98 | Otherwise, |
| 99 | .Dv NULL |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 100 | is returned and |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 101 | .Fn zip_open |
| 102 | sets |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 103 | .Ar *errorp |
Thomas Klausner | 2305181 | 2014-11-09 18:14:18 +0100 | [diff] [blame] | 104 | to indicate the error, while |
| 105 | .Fn zip_open_from source |
| 106 | sets |
| 107 | .Ar ze |
| 108 | to indicate the error. |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 109 | .Sh ERRORS |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 110 | The archive specified by |
| 111 | .Ar path |
| 112 | is opened unless: |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 113 | .Bl -tag -width Er |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 114 | .It Bq Er ZIP_ER_EXISTS |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 115 | The file specified by |
| 116 | .Ar path |
| 117 | exists and |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 118 | .Dv ZIP_EXCL |
| 119 | is set. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 120 | .It Bq Er ZIP_ER_INCONS |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 121 | Inconsistencies were found in the file specified by |
Thomas Klausner | e373e6b | 2012-02-13 14:53:55 +0100 | [diff] [blame] | 122 | .Ar path . |
| 123 | This error is often caused by specifying |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 124 | .Dv ZIP_CHECKCONS |
Thomas Klausner | e373e6b | 2012-02-13 14:53:55 +0100 | [diff] [blame] | 125 | but can also happen without it. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 126 | .It Bq Er ZIP_ER_INVAL |
Thomas Klausner | e9faec4 | 2003-10-02 15:52:56 +0000 | [diff] [blame] | 127 | The |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 128 | .Ar path |
| 129 | argument is |
| 130 | .Dv NULL . |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 131 | .It Bq Er ZIP_ER_MEMORY |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 132 | Required memory could not be allocated. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 133 | .It Bq Er ZIP_ER_NOENT |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 134 | The file specified by |
| 135 | .Ar path |
| 136 | does not exist and |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 137 | .Dv ZIP_CREATE |
| 138 | is not set. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 139 | .It Bq Er ZIP_ER_NOZIP |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 140 | The file specified by |
| 141 | .Ar path |
| 142 | is not a zip archive. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 143 | .It Bq Er ZIP_ER_OPEN |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 144 | The file specified by |
| 145 | .Ar path |
| 146 | could not be opened. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 147 | .It Bq Er ZIP_ER_READ |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 148 | A read error occurred; see |
| 149 | .Va errno |
| 150 | for details. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 151 | .It Bq Er ZIP_ER_SEEK |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 152 | The file specified by |
| 153 | .Ar path |
| 154 | does not allow seeks. |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 155 | .El |
| 156 | .Sh SEE ALSO |
Thomas Klausner | bec1cfe | 2005-06-09 18:50:27 +0000 | [diff] [blame] | 157 | .Xr libzip 3 , |
Thomas Klausner | c2995a5 | 2003-12-27 22:37:34 +0000 | [diff] [blame] | 158 | .Xr zip_close 3 , |
Thomas Klausner | 89d3318 | 2009-02-15 00:53:58 +0100 | [diff] [blame] | 159 | .Xr zip_error_to_str 3 , |
| 160 | .Xr zip_fdopen 3 |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 161 | .Sh AUTHORS |
| 162 | .An -nosplit |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 163 | .An Dieter Baron Aq Mt dillo@nih.at |
Thomas Klausner | 39b5f9e | 2005-06-09 21:14:54 +0000 | [diff] [blame] | 164 | and |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 165 | .An Thomas Klausner Aq Mt tk@giga.or.at |