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