Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 1 | .\" zip_file_extra_field_get.mdoc -- get extra field for file in zip |
Thomas Klausner | df77dc6 | 2016-12-31 13:40:32 +0100 | [diff] [blame] | 2 | .\" Copyright (C) 2012-2016 Dieter Baron and Thomas Klausner |
Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 3 | .\" |
| 4 | .\" This file is part of libzip, a library to manipulate ZIP files. |
| 5 | .\" The authors can be contacted at <libzip@nih.at> |
| 6 | .\" |
| 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. |
| 19 | .\" |
| 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 | 654157e | 2014-10-08 10:46:39 +0200 | [diff] [blame] | 32 | .Dd October 8, 2014 |
Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 33 | .Dt ZIP_FILE_EXTRA_FIELD_GET 3 |
| 34 | .Os |
| 35 | .Sh NAME |
| 36 | .Nm zip_file_extra_field_get , |
| 37 | .Nm zip_file_extra_field_get_by_id |
| 38 | .Nd get extra field for file in zip |
| 39 | .Sh LIBRARY |
| 40 | libzip (-lzip) |
| 41 | .Sh SYNOPSIS |
| 42 | .In zip.h |
| 43 | .Ft const zip_uint8_t * |
Thomas Klausner | 9874efb | 2016-12-30 01:32:09 +0100 | [diff] [blame] | 44 | .Fn zip_file_extra_field_get "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_uint16_t *idp" "zip_uint16_t *lenp" "zip_flags_t flags" |
Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 45 | .Ft const zip_uint8_t * |
Thomas Klausner | 9874efb | 2016-12-30 01:32:09 +0100 | [diff] [blame] | 46 | .Fn zip_file_extra_field_get_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_uint16_t *lenp" "zip_flags_t flags" |
Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 47 | .Sh DESCRIPTION |
| 48 | The |
| 49 | .Fn zip_file_extra_field_get |
| 50 | function returns the extra field with index |
| 51 | .Ar extra_field_index |
| 52 | for the file at position |
| 53 | .Ar index |
| 54 | in the zip archive. |
| 55 | This pointer should not be modified or |
| 56 | .Xr free 3 Ap d , |
| 57 | and becomes invalid when |
| 58 | .Ar archive |
| 59 | is closed. |
| 60 | If |
| 61 | .Ar idp |
| 62 | is not |
| 63 | .Dv NULL , |
| 64 | the integer to which it points will be set to the ID (two-byte |
| 65 | signature) of the selected extra field. |
| 66 | If |
| 67 | .Ar lenp |
| 68 | is not |
| 69 | .Dv NULL , |
| 70 | the integer to which it points will be set to the length of the |
| 71 | extra field. |
| 72 | Generally speaking, |
| 73 | .Ar lenp |
| 74 | and |
| 75 | .Ar idp |
| 76 | should be passed since only the extra field data is returned (i.e., |
| 77 | neither the ID nor the length, if the |
| 78 | .Ar idp |
| 79 | and |
| 80 | .Ar lenp |
| 81 | arguments are not provided). |
| 82 | .Pp |
Thomas Klausner | 23c3032 | 2013-02-20 12:32:39 +0100 | [diff] [blame] | 83 | The following |
| 84 | .Ar flags |
| 85 | are supported: |
| 86 | .Bl -tag -width ZIP_FL_UNCHANGEDXX -offset indent |
Thomas Klausner | 954d591 | 2012-06-25 12:18:19 +0200 | [diff] [blame] | 87 | .It Dv ZIP_FL_CENTRAL |
Thomas Klausner | 23c3032 | 2013-02-20 12:32:39 +0100 | [diff] [blame] | 88 | Return extra fields from the archive's central directory. |
Thomas Klausner | 954d591 | 2012-06-25 12:18:19 +0200 | [diff] [blame] | 89 | .It Dv ZIP_FL_LOCAL |
Thomas Klausner | 23c3032 | 2013-02-20 12:32:39 +0100 | [diff] [blame] | 90 | Return extra fields from the local file headers. |
Thomas Klausner | 03ead84 | 2012-06-25 12:35:35 +0200 | [diff] [blame] | 91 | .It Dv ZIP_FL_UNCHANGED |
Dieter Baron | a94f4ab | 2012-06-25 15:26:02 +0200 | [diff] [blame] | 92 | Return the original unchanged extra fields, ignoring any changes made. |
Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 93 | .El |
| 94 | .Pp |
| 95 | The |
| 96 | .Fn zip_file_extra_field_get_by_id |
| 97 | function returns the extra field with ID (two-byte signature) |
| 98 | .Ar extra_field_id |
| 99 | and index |
| 100 | .Ar extra_field_index |
| 101 | (in other words, the |
| 102 | .Ar extra_field_index Ns No 'th |
| 103 | extra field with ID |
| 104 | .Ar extra_field_id ) |
| 105 | The other arguments are the same as for |
| 106 | .Fn zip_file_extra_field_get . |
| 107 | .Sh RETURN VALUES |
| 108 | Upon successful completion, a pointer to an extra field is returned, |
| 109 | or |
| 110 | .Dv NULL |
| 111 | if there is no extra field with that |
| 112 | .Ar extra_field_index |
| 113 | for the file with index |
| 114 | .Ar index . |
| 115 | In case of an error, |
| 116 | .Dv NULL |
| 117 | is returned and the error code in |
| 118 | .Ar archive |
| 119 | is set to indicate the error. |
| 120 | .Sh ERRORS |
| 121 | .Fn zip_file_extra_field_get |
| 122 | and |
| 123 | .Fn zip_file_extra_field_get_by_id |
| 124 | fail if: |
| 125 | .Bl -tag -width Er |
| 126 | .It Bq Er ZIP_ER_NOENT |
| 127 | .Ar index |
| 128 | is not a valid file index in |
| 129 | .Ar archive , |
| 130 | or |
| 131 | .Ar extra_field_index |
| 132 | is not a valid extra file index (for ID |
| 133 | .Ar extra_field_id ) . |
| 134 | .El |
| 135 | .Sh SEE ALSO |
| 136 | .Xr libzip 3 , |
| 137 | .Xr zip_file_extra_field_delete 3 , |
| 138 | .Xr zip_file_extra_field_set 3 , |
| 139 | .Xr zip_file_extra_fields_count 3 |
| 140 | .Sh AUTHORS |
| 141 | .An -nosplit |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 142 | .An Dieter Baron Aq Mt dillo@nih.at |
Thomas Klausner | 9a0e7f5 | 2012-06-24 01:55:03 +0200 | [diff] [blame] | 143 | and |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 144 | .An Thomas Klausner Aq Mt tk@giga.or.at |
Thomas Klausner | 654157e | 2014-10-08 10:46:39 +0200 | [diff] [blame] | 145 | .Sh CAVEATS |
| 146 | Please note that the extra field IDs 0x0001 (ZIP64 extension), |
| 147 | 0x6375 (Infozip UTF-8 comment), and |
| 148 | 0x7075 (Infozip UTF-8 file name) can not be read using |
| 149 | .Fn zip_file_extra_field_get |
| 150 | since they are used by |
| 151 | .Xr libzip 3 |
| 152 | internally. |