blob: 7fad9d40c4a54a48a14e6c51da4f13295d91970d [file] [log] [blame]
Thomas Klausner0f831222012-06-24 02:26:17 +02001.\" zip_file_extra_field_delete.mdoc -- delete extra field for file in zip
Thomas Klausnerdf77dc62016-12-31 13:40:32 +01002.\" Copyright (C) 2012-2016 Dieter Baron and Thomas Klausner
Thomas Klausner0f831222012-06-24 02:26:17 +02003.\"
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 Klausner4fc78812013-07-31 16:43:17 +020032.Dd July 31, 2013
Thomas Klausner0f831222012-06-24 02:26:17 +020033.Dt ZIP_FILE_EXTRA_FIELD_DELETE 3
34.Os
35.Sh NAME
36.Nm zip_file_extra_field_delete ,
37.Nm zip_file_extra_field_delete_by_id
38.Nd delete extra field for file in zip
39.Sh LIBRARY
40libzip (-lzip)
41.Sh SYNOPSIS
42.In zip.h
43.Ft int
Thomas Klausner9874efb2016-12-30 01:32:09 +010044.Fn zip_file_extra_field_delete "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_index" "zip_flags_t flags"
Thomas Klausner0f831222012-06-24 02:26:17 +020045.Ft int
Thomas Klausner9874efb2016-12-30 01:32:09 +010046.Fn zip_file_extra_field_delete_by_id "zip_t *archive" "zip_uint64_t index" "zip_uint16_t extra_field_id" "zip_uint16_t extra_field_index" "zip_flags_t flags"
Thomas Klausner0f831222012-06-24 02:26:17 +020047.Sh DESCRIPTION
48The
49.Fn zip_file_extra_field_delete
50function deletes the extra field with index
51.Ar extra_field_index
52for the file at position
53.Ar index
54in the zip archive.
55.Pp
Thomas Klausner35d5a582012-06-25 12:20:30 +020056If
Thomas Klausner4fc78812013-07-31 16:43:17 +020057.Ar extra_field_index
Thomas Klausner35d5a582012-06-25 12:20:30 +020058is
59.Dv ZIP_EXTRA_FIELD_ALL ,
60then all extra fields will be deleted.
61.Pp
Thomas Klausner23c30322013-02-20 12:32:39 +010062The following
63.Ar flags
64are supported:
Thomas Klausner954d5912012-06-25 12:18:19 +020065.Bl -tag -width ZIP_FL_CENTRALXX -offset indent
66.It Dv ZIP_FL_CENTRAL
Thomas Klausner23c30322013-02-20 12:32:39 +010067Delete extra fields from the archive's central directory.
Thomas Klausner954d5912012-06-25 12:18:19 +020068.It Dv ZIP_FL_LOCAL
Thomas Klausner23c30322013-02-20 12:32:39 +010069Delete extra fields from the local file headers.
Thomas Klausner0f831222012-06-24 02:26:17 +020070.El
71.Pp
72The
73.Fn zip_file_extra_field_delete_by_id
74function deletes the extra field with ID (two-byte signature)
75.Ar extra_field_id
76and index
77.Ar extra_field_index
78(in other words, the
79.Ar extra_field_index Ns No 'th
80extra field with ID
81.Ar extra_field_id )
82The other arguments are the same as for
Thomas Klausner35d5a582012-06-25 12:20:30 +020083.Fn zip_file_extra_field_delete
84.Dv ( ZIP_EXTRA_FIELD_ALL
Thomas Klausner4fc78812013-07-31 16:43:17 +020085will delete all extra fields of the specified ID).
86.Pp
87Please note that due to the library design, the index of an extra
88field may be different between central directory and local file
89headers.
90For this reason, it is not allowed to specify both
91.Dv ZIP_FL_CENTRAL
92and
93.Dv ZIP_FL_LOCAL
94in
95.Ar flags ,
96except when deleting all extra fields (i.e.,
97.Ar extra_field_index
98being
99.Dv ZIP_EXTRA_FIELD_ALL ) .
Thomas Klausner0f831222012-06-24 02:26:17 +0200100.Sh RETURN VALUES
101Upon successful completion 0 is returned.
102Otherwise, \-1 is returned and the error code in
103.Ar archive
104is set to indicate the error.
105.Sh ERRORS
106.Fn zip_file_extra_field_delete
107and
108.Fn zip_file_extra_field_delete_by_id
109fail if:
110.Bl -tag -width Er
111.It Bq Er ZIP_ER_NOENT
112.Ar index
113is not a valid file index in
114.Ar archive .
115.El
116.Sh SEE ALSO
117.Xr libzip 3 ,
118.Xr zip_file_extra_field_get 3 ,
119.Xr zip_file_extra_field_set 3 ,
120.Xr zip_file_extra_fields_count 3
121.Sh AUTHORS
122.An -nosplit
Thomas Klausner0acbab42013-07-28 23:29:08 +0200123.An Dieter Baron Aq Mt dillo@nih.at
Thomas Klausner0f831222012-06-24 02:26:17 +0200124and
Thomas Klausner0acbab42013-07-28 23:29:08 +0200125.An Thomas Klausner Aq Mt tk@giga.or.at