Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

zip_file_extra_field_set (3)

Name

zip_file_extra_field_set - set extra field for file in zip

Synopsis

#include <zip.h>

int
zip_file_extra_field_set(zip_t *archive, zip_uint64_t index,
zip_uint16_t extra_field_id, zip_uint16_t extra_field_index,
const zip_uint8_t *extra_field_data, zip_uint16_t len,
zip_flags_t flags);

Description

ZIP_FILE_EXTRA_FIELD_... BSD Library Functions Manual ZIP_FILE_EXTRA_FIELD_...

NAME
     zip_file_extra_field_set -- set extra field for file in zip

LIBRARY
     libzip (-lzip)

SYNOPSIS
     #include <zip.h>

     int
     zip_file_extra_field_set(zip_t *archive, zip_uint64_t index,
         zip_uint16_t extra_field_id, zip_uint16_t extra_field_index,
         const zip_uint8_t *extra_field_data, zip_uint16_t len,
         zip_flags_t flags);

DESCRIPTION
     The zip_file_extra_field_set() function sets the extra field with ID
     (two-byte signature) extra_field_id and index extra_field_index for the
     file at position index in the zip archive.  The extra field's data will
     be set to extra_field_data and length len.  If a new entry shall be
     appended, set extra_field_index to ZIP_EXTRA_FIELD_NEW.

     At least one of the following flags must be set:

           ZIP_FL_CENTRAL    Set extra field in the archive's central direc-
                             tory.

           ZIP_FL_LOCAL      Set extra field in the local file headers.

     Please note that the extra field IDs 0x0001 (ZIP64 extension), 0x6375
     (Infozip UTF-8 comment), and 0x7075 (Infozip UTF-8 file name) can not be
     set using zip_file_extra_field_set() since they are set by libzip(3)
     automatically when needed.

RETURN VALUES
     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
     the error code in archive is set to indicate the error.

ERRORS
     zip_file_extra_field_set() fails if:

     [ZIP_ER_INVAL]     The extra field size is too large (ID and length need
                        4 bytes; the maximum length of all extra fields for
                        one file combined is 65536 bytes).  This error also
                        occurs if extra_field_index is too large.

     [ZIP_ER_MEMORY]    Required memory could not be allocated.

     [ZIP_ER_NOENT]     index is not a valid file index in archive.


ATTRIBUTES
     See attributes(7) for descriptions of the following attributes:

     +---------------+------------------+
     |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
     +---------------+------------------+
     |Availability   | compress/libzip  |
     +---------------+------------------+
     |Stability      | Volatile         |
     +---------------+------------------+

SEE ALSO
     libzip(3), zip_file_extra_field_delete(3), zip_file_extra_field_get(3),
     zip_file_extra_fields_count(3)

HISTORY
     zip_file_extra_field_set() was added in libzip 0.11.

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



NOTES
     Source code for open source software components in Oracle Solaris can be
     found at https://www.oracle.com/downloads/opensource/solaris-source-code-
     downloads.html.

     This software was built from source available at https://github.com/ora-
     cle/solaris-userland.  The original community source was downloaded from
     https://libzip.org/download/libzip-1.7.3.tar.gz.

     Further information about this software can be found on the open source
     community website at https://libzip.org/.

BSD                            December 18, 2017                           BSD