1ZIP_FILE_EXTRA_FIELD_... BSD Library Functions Manual ZIP_FILE_EXTRA_FIELD_...
2

NAME

4     zip_file_extra_field_get, zip_file_extra_field_get_by_id — get extra
5     field for file in zip
6

LIBRARY

8     libzip (-lzip)
9

SYNOPSIS

11     #include <zip.h>
12
13     const zip_uint8_t *
14     zip_file_extra_field_get(zip_t *archive, zip_uint64_t index,
15         zip_uint16_t extra_field_index, zip_uint16_t *idp,
16         zip_uint16_t *lenp, zip_flags_t flags);
17
18     const zip_uint8_t *
19     zip_file_extra_field_get_by_id(zip_t *archive, zip_uint64_t index,
20         zip_uint16_t extra_field_id, zip_uint16_t extra_field_index,
21         zip_uint16_t *lenp, zip_flags_t flags);
22

DESCRIPTION

24     The zip_file_extra_field_get() function returns the extra field with
25     index extra_field_index for the file at position index in the zip ar‐
26     chive.  This pointer should not be modified or free(3)'d, and becomes
27     invalid when archive is closed.  If idp is not NULL, the integer to which
28     it points will be set to the ID (two-byte signature) of the selected
29     extra field.  If lenp is not NULL, the integer to which it points will be
30     set to the length of the extra field.  Generally speaking, lenp and idp
31     should be passed since only the extra field data is returned (i.e., nei‐
32     ther the ID nor the length, if the idp and lenp arguments are not pro‐
33     vided).
34
35     The following flags are supported:
36
37           ZIP_FL_CENTRAL      Return extra fields from the archive's central
38                               directory.
39
40           ZIP_FL_LOCAL        Return extra fields from the local file head‐
41                               ers.
42
43           ZIP_FL_UNCHANGED    Return the original unchanged extra fields,
44                               ignoring any changes made.
45
46     The zip_file_extra_field_get_by_id() function returns the extra field
47     with ID (two-byte signature) extra_field_id and index extra_field_index
48     (in other words, the extra_field_index'th extra field with ID
49     extra_field_id) The other arguments are the same as for
50     zip_file_extra_field_get().
51

RETURN VALUES

53     Upon successful completion, a pointer to an extra field is returned, or
54     NULL if there is no extra field with that extra_field_index for the file
55     with index index.  In case of an error, NULL is returned and the error
56     code in archive is set to indicate the error.
57

ERRORS

59     zip_file_extra_field_get() and zip_file_extra_field_get_by_id() fail if:
60
61     [ZIP_ER_NOENT]     index is not a valid file index in archive, or
62                        extra_field_index is not a valid extra file index (for
63                        ID extra_field_id).
64

SEE ALSO

66     libzip(3), zip_file_extra_field_delete(3), zip_file_extra_field_set(3),
67     zip_file_extra_fields_count(3)
68

HISTORY

70     zip_file_extra_field_get() and zip_file_extra_field_get_by_id() were
71     added in libzip 0.11.
72

AUTHORS

74     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
75

CAVEATS

77     Please note that the extra field IDs 0x0001 (ZIP64 extension), 0x6375
78     (Infozip UTF-8 comment), and 0x7075 (Infozip UTF-8 file name) can not be
79     read using zip_file_extra_field_get() since they are used by libzip(3)
80     internally.
81
82BSD                            December 18, 2017                           BSD
Impressum