Dieter Baron | bb1453e | 2003-10-02 14:20:53 +0000 | [diff] [blame] | 1 | .\" zip_open.mdoc -- open zip archive |
Thomas Klausner | 89d3318 | 2009-02-15 00:53:58 +0100 | [diff] [blame^] | 2 | .\" Copyright (C) 2003-2009 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 | 89d3318 | 2009-02-15 00:53:58 +0100 | [diff] [blame^] | 32 | .Dd February 15, 2009 |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 33 | .Dt ZIP_OPEN 3 |
| 34 | .Os |
| 35 | .Sh NAME |
| 36 | .Nm zip_open |
| 37 | .Nd open zip archive |
| 38 | .Sh LIBRARY |
Dieter Baron | ff551f1 | 2003-10-03 12:04:09 +0000 | [diff] [blame] | 39 | libzip (-lzip) |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 40 | .Sh SYNOPSIS |
Thomas Klausner | 680c87b | 2003-10-02 15:32:02 +0000 | [diff] [blame] | 41 | .In zip.h |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 42 | .Ft struct zip * |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 43 | .Fn zip_open "const char *path" "int flags" "int *errorp" |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 44 | .Sh DESCRIPTION |
Thomas Klausner | e9faec4 | 2003-10-02 15:52:56 +0000 | [diff] [blame] | 45 | The zip archive specified by |
| 46 | .Ar path |
| 47 | is opened and a pointer to a |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 48 | .Ft struct zip , |
Dieter Baron | 7c43a82 | 2003-10-02 16:00:55 +0000 | [diff] [blame] | 49 | used to manipulate the archive, is returned. |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 50 | The |
| 51 | .Fa flags |
| 52 | are specified by |
Thomas Klausner | 680c87b | 2003-10-02 15:32:02 +0000 | [diff] [blame] | 53 | .Em or Ns No 'ing |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 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. |
Thomas Klausner | b9148ee | 2003-12-28 00:51:51 +0000 | [diff] [blame] | 63 | .El |
Thomas Klausner | 81225ec | 2003-10-06 17:02:07 +0000 | [diff] [blame] | 64 | .Pp |
| 65 | If an error occurs and |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 66 | .Ar errorp |
| 67 | is non-NULL, it will be set to the corresponding error code. |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 68 | .Sh RETURN VALUES |
| 69 | Upon successful completion |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 70 | .Fn zip_open |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 71 | returns a |
Thomas Klausner | 680c87b | 2003-10-02 15:32:02 +0000 | [diff] [blame] | 72 | .Ft struct zip |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 73 | pointer. |
| 74 | Otherwise, |
| 75 | .Dv NULL |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 76 | is returned and |
| 77 | .Ar *errorp |
Dieter Baron | 9028826 | 2003-10-01 18:28:10 +0000 | [diff] [blame] | 78 | is set to indicate the error. |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 79 | .Sh ERRORS |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 80 | The archive specified by |
| 81 | .Ar path |
| 82 | is opened unless: |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 83 | .Bl -tag -width Er |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 84 | .It Bq Er ZIP_ER_EXISTS |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 85 | The file specified by |
| 86 | .Ar path |
| 87 | exists and |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 88 | .Dv ZIP_EXCL |
| 89 | is set. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 90 | .It Bq Er ZIP_ER_INCONS |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 91 | Inconsistencies were found in the file specified by |
Thomas Klausner | cdfa848 | 2003-10-09 13:39:08 +0000 | [diff] [blame] | 92 | .Ar path |
| 93 | and |
Dieter Baron | 321bc80 | 2003-10-06 16:36:54 +0000 | [diff] [blame] | 94 | .Dv ZIP_CHECKCONS |
| 95 | was specified. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 96 | .It Bq Er ZIP_ER_INVAL |
Thomas Klausner | e9faec4 | 2003-10-02 15:52:56 +0000 | [diff] [blame] | 97 | The |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 98 | .Ar path |
| 99 | argument is |
| 100 | .Dv NULL . |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 101 | .It Bq Er ZIP_ER_MEMORY |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 102 | Required memory could not be allocated. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 103 | .It Bq Er ZIP_ER_NOENT |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 104 | The file specified by |
| 105 | .Ar path |
| 106 | does not exist and |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 107 | .Dv ZIP_CREATE |
| 108 | is not set. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 109 | .It Bq Er ZIP_ER_NOZIP |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 110 | The file specified by |
| 111 | .Ar path |
| 112 | is not a zip archive. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 113 | .It Bq Er ZIP_ER_OPEN |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 114 | The file specified by |
| 115 | .Ar path |
| 116 | could not be opened. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 117 | .It Bq Er ZIP_ER_READ |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 118 | A read error occurred; see |
| 119 | .Va errno |
| 120 | for details. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 121 | .It Bq Er ZIP_ER_SEEK |
Dieter Baron | 99d3197 | 2003-10-07 11:54:17 +0000 | [diff] [blame] | 122 | The file specified by |
| 123 | .Ar path |
| 124 | does not allow seeks. |
Dieter Baron | 214922d | 2003-10-02 15:48:47 +0000 | [diff] [blame] | 125 | .El |
| 126 | .Sh SEE ALSO |
Thomas Klausner | bec1cfe | 2005-06-09 18:50:27 +0000 | [diff] [blame] | 127 | .Xr libzip 3 , |
Thomas Klausner | c2995a5 | 2003-12-27 22:37:34 +0000 | [diff] [blame] | 128 | .Xr zip_close 3 , |
Thomas Klausner | 89d3318 | 2009-02-15 00:53:58 +0100 | [diff] [blame^] | 129 | .Xr zip_error_to_str 3 , |
| 130 | .Xr zip_fdopen 3 |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 131 | .Sh AUTHORS |
| 132 | .An -nosplit |
| 133 | .An Dieter Baron Aq dillo@giga.or.at |
Thomas Klausner | 39b5f9e | 2005-06-09 21:14:54 +0000 | [diff] [blame] | 134 | and |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 135 | .An Thomas Klausner Aq tk@giga.or.at |