Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

archive_read_extract (3archive)

Name

archive_read_extract - archive_read_extract, archive_read_extract2, functions for reading streaming archives

Synopsis

#include <archive.h>
int
archive_read_extract(struct archive *, struct archive_entry *,
int flags);
int
archive_read_extract2(struct archive *src, struct archive_entry *,
struct archive *dest);
void
archive_read_extract_set_progress_callback(struct archive *,
void (*func)(void *), void *user_data);

Description

                                                ARCHIVE_READ_EXTRACT(3archive)



NAME
       archive_read_extract, archive_read_extract2,
       archive_read_extract_set_progress_callback - functions for reading
       streaming archives

LIBRARY
       Streaming Archive Library (libarchive, -larchive)

SYNOPSIS
       #include <archive.h>
       int
       archive_read_extract(struct archive *, struct archive_entry *,
       int flags);
       int
       archive_read_extract2(struct archive *src, struct archive_entry *,
       struct archive *dest);
       void
       archive_read_extract_set_progress_callback(struct archive *,
       void (*func)(void *), void *user_data);

DESCRIPTION
            archive_read_extract(), archive_read_extract_set_skip_file()
                   A convenience function that wraps the corresponding ar-
                   chive_write_disk(3) interfaces.  The first call to
                   archive_read_extract() creates a restore object using ar-
                   chive_write_disk_new(3) and archive_write_disk_set_stan-
                   dard_lookup(3), then transparently invokes ar-
                   chive_write_disk_set_options(3), archive_write_header(3),
                   archive_write_data(3), and archive_write_finish_entry(3) to
                   create the entry on disk and copy data into it.  The flags
                   argument is passed unmodified to ar-
                   chive_write_disk_set_options(3).

            archive_read_extract2()
                   This is another version of archive_read_extract() that
                   allows you to provide your own restore object.  In particu-
                   lar, this allows you to override the standard lookup func-
                   tions using archive_write_disk_set_group_lookup(3), and ar-
                   chive_write_disk_set_user_lookup(3).  Note that
                   archive_read_extract2() does not accept a flags argument;
                   you should use archive_write_disk_set_options() to set the
                   restore options yourself.

            archive_read_extract_set_progress_callback()
                   Sets a pointer to a user-defined callback that can be used
                   for updating progress displays during extraction.  The
                   progress function will be invoked during the extraction of
                   large regular files.  The progress function will be invoked
                   with the pointer provided to this call.  Generally, the
                   data pointed to should include a reference to the archive
                   object and the archive_entry object so that various statis-
                   tics can be retrieved for the progress display.

RETURN VALUES
       Most functions return zero on success, non-zero on error.  The possible
       return codes include: ARCHIVE_OK (the operation succeeded), AR-
       CHIVE_WARN (the operation succeeded but a non-critical error was
       encountered), ARCHIVE_EOF (end-of-archive was encountered), AR-
       CHIVE_RETRY (the operation failed but can be retried), and AR-
       CHIVE_FATAL (there was a fatal error; the archive should be closed
       immediately).

ERRORS
       Detailed error codes and textual descriptions are available from the
       archive_errno() and archive_error_string() functions.


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


       +---------------+--------------------+
       |ATTRIBUTE TYPE |  ATTRIBUTE VALUE   |
       +---------------+--------------------+
       |Availability   | library/libarchive |
       +---------------+--------------------+
       |Stability      | Uncommitted        |
       +---------------+--------------------+

SEE ALSO
       tar(1), archive_read(3), archive_read_data(3), archive_read_filter(3),
       archive_read_format(3), archive_read_open(3), ar-
       chive_read_set_options(3), archive_util(3), libarchive(3)



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/oracle/solaris-userland.  The original community
       source was downloaded from
       https://github.com/libarchive/libarchive/releases/down-
       load/v3.6.1/libarchive-3.6.1.tar.gz.

       Further information about this software can be found on the open source
       community website at http://www.libarchive.org/.



                               February 2, 2012
                                                ARCHIVE_READ_EXTRACT(3archive)