Thomas Klausner | 39b5f9e | 2005-06-09 21:14:54 +0000 | [diff] [blame] | 1 | .\" $NiH: zip_fopen.mdoc,v 1.13 2005/06/09 21:13:12 wiz Exp $ |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 2 | .\" |
Thomas Klausner | 596733b | 2005-01-11 18:38:17 +0000 | [diff] [blame] | 3 | .\" zip_fopen.mdoc -- open file in zip archive for reading |
Thomas Klausner | be31d74 | 2005-06-09 19:51:23 +0000 | [diff] [blame] | 4 | .\" Copyright (C) 2003, 2004, 2005 Dieter Baron and Thomas Klausner |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 5 | .\" |
| 6 | .\" This file is part of libzip, a library to manipulate ZIP archives. |
| 7 | .\" The authors can be contacted at <nih@giga.or.at> |
| 8 | .\" |
| 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. |
| 21 | .\" |
| 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 | .\" |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 34 | .Dd April 14, 2004 |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 35 | .Dt ZIP_FOPEN 3 |
| 36 | .Os |
| 37 | .Sh NAME |
| 38 | .Nm zip_fopen , |
| 39 | .Nm zip_fopen_index |
Thomas Klausner | a477cb9 | 2003-10-03 23:39:49 +0000 | [diff] [blame] | 40 | .Nd open file in zip archive for reading |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 41 | .Sh LIBRARY |
Dieter Baron | ff551f1 | 2003-10-03 12:04:09 +0000 | [diff] [blame] | 42 | libzip (-lzip) |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 43 | .Sh SYNOPSIS |
| 44 | .In zip.h |
| 45 | .Ft struct zip_file * |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 46 | .Fn zip_fopen "struct zip *archive" "const char *fname" "int flags" |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 47 | .Ft struct zip_file * |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 48 | .Fn zip_fopen_index "struct zip *archive" "int index" "int flags" |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 49 | .Sh DESCRIPTION |
| 50 | The |
| 51 | .Fn zip_fopen |
| 52 | function opens the file name |
| 53 | .Ar fname |
| 54 | in |
| 55 | .Ar archive . |
Dieter Baron | 6486c33 | 2003-10-06 16:37:07 +0000 | [diff] [blame] | 56 | The |
| 57 | .Ar flags |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 58 | argument specifies how the name lookup should be done, according to |
| 59 | the values are described in |
Dieter Baron | 6486c33 | 2003-10-06 16:37:07 +0000 | [diff] [blame] | 60 | .Xr zip_name_locate 3 . |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 61 | Also, the following values may be |
| 62 | .Em or Ns No 'ed |
| 63 | to it. |
| 64 | .Bl -tag -offset indent -width ZIP_FL_COMPRESSED |
| 65 | .It Dv ZIP_FL_COMPRESSED |
Thomas Klausner | 8d19d68 | 2005-06-09 18:54:24 +0000 | [diff] [blame] | 66 | Read the compressed data. |
| 67 | Otherwise the data is uncompressed by |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 68 | .Fn zip_fread . |
| 69 | .It Dv ZIP_FL_UNCHANGED |
| 70 | Read the original data from the zip archive, ignoring any changes made |
| 71 | to the file. |
| 72 | .El |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 73 | .Pp |
| 74 | The |
| 75 | .Fn zip_fopen_index |
| 76 | function opens the file at position |
| 77 | .Ar index . |
| 78 | .Sh RETURN VALUES |
| 79 | Upon successful completion, a |
| 80 | .Ft struct zip_file |
| 81 | pointer is returned. |
| 82 | Otherwise, |
| 83 | .Dv NULL |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 84 | is returned and the error code in |
| 85 | .Ar archive |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 86 | is set to indicate the error. |
| 87 | .Sh ERRORS |
| 88 | .Bl -tag -width Er |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 89 | .It Bq Er ZIP_ER_CHANGED |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 90 | The file data has been changed. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 91 | .It Bq Er ZIP_ER_COMPNOTSUPP |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 92 | The compression method used is not supported. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 93 | .It Bq Er ZIP_ER_MEMORY |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 94 | Required memory could not be allocated. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 95 | .It Bq Er ZIP_ER_READ |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 96 | A file read error occurred. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 97 | .It Bq Er ZIP_ER_SEEK |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 98 | A file seek error occurred. |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 99 | .It Bq Er ZIP_ER_ZLIB |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 100 | Initializing the zlib stream failed. |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 101 | .El |
| 102 | .Pp |
| 103 | The function |
| 104 | .Fn zip_fopen |
| 105 | may also fail and set |
| 106 | .Va zip_err |
| 107 | for any of the errors specified for the routine |
Thomas Klausner | f2938cc | 2003-10-03 23:36:10 +0000 | [diff] [blame] | 108 | .Xr zip_name_locate 3 . |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 109 | .Pp |
| 110 | The function |
| 111 | .Fn zip_fopen_index |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 112 | may also fail with |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 113 | .Er ZIP_ER_INVAL |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 114 | if |
| 115 | .Ar index |
| 116 | is invalid. |
| 117 | .Sh SEE ALSO |
Thomas Klausner | bec1cfe | 2005-06-09 18:50:27 +0000 | [diff] [blame] | 118 | .Xr libzip 3 , |
Dieter Baron | 68d238c | 2003-10-03 11:19:03 +0000 | [diff] [blame] | 119 | .Xr zip_fclose 3 , |
| 120 | .Xr zip_fread 3 , |
Thomas Klausner | f2938cc | 2003-10-03 23:36:10 +0000 | [diff] [blame] | 121 | .Xr zip_name_locate 3 |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 122 | .Sh AUTHORS |
| 123 | .An -nosplit |
| 124 | .An Dieter Baron Aq dillo@giga.or.at |
Thomas Klausner | 39b5f9e | 2005-06-09 21:14:54 +0000 | [diff] [blame] | 125 | and |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 126 | .An Thomas Klausner Aq tk@giga.or.at |