Blame libarchive/archive_read_extract.3

Packit Service 1d0348
.\" Copyright (c) 2003-2011 Tim Kientzle
Packit Service 1d0348
.\" All rights reserved.
Packit Service 1d0348
.\"
Packit Service 1d0348
.\" Redistribution and use in source and binary forms, with or without
Packit Service 1d0348
.\" modification, are permitted provided that the following conditions
Packit Service 1d0348
.\" are met:
Packit Service 1d0348
.\" 1. Redistributions of source code must retain the above copyright
Packit Service 1d0348
.\"    notice, this list of conditions and the following disclaimer.
Packit Service 1d0348
.\" 2. Redistributions in binary form must reproduce the above copyright
Packit Service 1d0348
.\"    notice, this list of conditions and the following disclaimer in the
Packit Service 1d0348
.\"    documentation and/or other materials provided with the distribution.
Packit Service 1d0348
.\"
Packit Service 1d0348
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
Packit Service 1d0348
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit Service 1d0348
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit Service 1d0348
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
Packit Service 1d0348
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit Service 1d0348
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit Service 1d0348
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit Service 1d0348
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit Service 1d0348
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit Service 1d0348
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit Service 1d0348
.\" SUCH DAMAGE.
Packit Service 1d0348
.\"
Packit Service 1d0348
.\" $FreeBSD$
Packit Service 1d0348
.\"
Packit Service 1d0348
.Dd February 2, 2012
Packit Service 1d0348
.Dt ARCHIVE_READ_EXTRACT 3
Packit Service 1d0348
.Os
Packit Service 1d0348
.Sh NAME
Packit Service 1d0348
.Nm archive_read_extract ,
Packit Service 1d0348
.Nm archive_read_extract2 ,
Packit Service 1d0348
.Nm archive_read_extract_set_progress_callback
Packit Service 1d0348
.Nd functions for reading streaming archives
Packit Service 1d0348
.Sh LIBRARY
Packit Service 1d0348
Streaming Archive Library (libarchive, -larchive)
Packit Service 1d0348
.Sh SYNOPSIS
Packit Service 1d0348
.In archive.h
Packit Service 1d0348
.Ft int
Packit Service 1d0348
.Fo archive_read_extract
Packit Service 1d0348
.Fa "struct archive *"
Packit Service 1d0348
.Fa "struct archive_entry *"
Packit Service 1d0348
.Fa "int flags"
Packit Service 1d0348
.Fc
Packit Service 1d0348
.Ft int
Packit Service 1d0348
.Fo archive_read_extract2
Packit Service 1d0348
.Fa "struct archive *src"
Packit Service 1d0348
.Fa "struct archive_entry *"
Packit Service 1d0348
.Fa "struct archive *dest"
Packit Service 1d0348
.Fc
Packit Service 1d0348
.Ft void
Packit Service 1d0348
.Fo archive_read_extract_set_progress_callback
Packit Service 1d0348
.Fa "struct archive *"
Packit Service 1d0348
.Fa "void (*func)(void *)"
Packit Service 1d0348
.Fa "void *user_data"
Packit Service 1d0348
.Fc
Packit Service 1d0348
.Sh DESCRIPTION
Packit Service 1d0348
.Bl -tag -compact -width indent
Packit Service 1d0348
.It Fn archive_read_extract , Fn archive_read_extract_set_skip_file
Packit Service 1d0348
A convenience function that wraps the corresponding
Packit Service 1d0348
.Xr archive_write_disk 3
Packit Service 1d0348
interfaces.
Packit Service 1d0348
The first call to
Packit Service 1d0348
.Fn archive_read_extract
Packit Service 1d0348
creates a restore object using
Packit Service 1d0348
.Xr archive_write_disk_new 3
Packit Service 1d0348
and
Packit Service 1d0348
.Xr archive_write_disk_set_standard_lookup 3 ,
Packit Service 1d0348
then transparently invokes
Packit Service 1d0348
.Xr archive_write_disk_set_options 3 ,
Packit Service 1d0348
.Xr archive_write_header 3 ,
Packit Service 1d0348
.Xr archive_write_data 3 ,
Packit Service 1d0348
and
Packit Service 1d0348
.Xr archive_write_finish_entry 3
Packit Service 1d0348
to create the entry on disk and copy data into it.
Packit Service 1d0348
The
Packit Service 1d0348
.Va flags
Packit Service 1d0348
argument is passed unmodified to
Packit Service 1d0348
.Xr archive_write_disk_set_options 3 .
Packit Service 1d0348
.It Fn archive_read_extract2
Packit Service 1d0348
This is another version of
Packit Service 1d0348
.Fn archive_read_extract
Packit Service 1d0348
that allows you to provide your own restore object.
Packit Service 1d0348
In particular, this allows you to override the standard lookup functions
Packit Service 1d0348
using
Packit Service 1d0348
.Xr archive_write_disk_set_group_lookup 3 ,
Packit Service 1d0348
and
Packit Service 1d0348
.Xr archive_write_disk_set_user_lookup 3 .
Packit Service 1d0348
Note that
Packit Service 1d0348
.Fn archive_read_extract2
Packit Service 1d0348
does not accept a
Packit Service 1d0348
.Va flags
Packit Service 1d0348
argument; you should use
Packit Service 1d0348
.Fn archive_write_disk_set_options
Packit Service 1d0348
to set the restore options yourself.
Packit Service 1d0348
.It Fn archive_read_extract_set_progress_callback
Packit Service 1d0348
Sets a pointer to a user-defined callback that can be used
Packit Service 1d0348
for updating progress displays during extraction.
Packit Service 1d0348
The progress function will be invoked during the extraction of large
Packit Service 1d0348
regular files.
Packit Service 1d0348
The progress function will be invoked with the pointer provided to this call.
Packit Service 1d0348
Generally, the data pointed to should include a reference to the archive
Packit Service 1d0348
object and the archive_entry object so that various statistics
Packit Service 1d0348
can be retrieved for the progress display.
Packit Service 1d0348
.El
Packit Service 1d0348
.\"
Packit Service 1d0348
.Sh RETURN VALUES
Packit Service 1d0348
Most functions return zero on success, non-zero on error.
Packit Service 1d0348
The possible return codes include:
Packit Service 1d0348
.Cm ARCHIVE_OK
Packit Service 1d0348
(the operation succeeded),
Packit Service 1d0348
.Cm ARCHIVE_WARN
Packit Service 1d0348
(the operation succeeded but a non-critical error was encountered),
Packit Service 1d0348
.Cm ARCHIVE_EOF
Packit Service 1d0348
(end-of-archive was encountered),
Packit Service 1d0348
.Cm ARCHIVE_RETRY
Packit Service 1d0348
(the operation failed but can be retried),
Packit Service 1d0348
and
Packit Service 1d0348
.Cm ARCHIVE_FATAL
Packit Service 1d0348
(there was a fatal error; the archive should be closed immediately).
Packit Service 1d0348
.Sh ERRORS
Packit Service 1d0348
Detailed error codes and textual descriptions are available from the
Packit Service 1d0348
.Fn archive_errno
Packit Service 1d0348
and
Packit Service 1d0348
.Fn archive_error_string
Packit Service 1d0348
functions.
Packit Service 1d0348
.Sh SEE ALSO
Packit Service 1d0348
.Xr tar 1 ,
Packit Service 1d0348
.Xr libarchive 3 ,
Packit Service 1d0348
.Xr archive_read 3 ,
Packit Service 1d0348
.Xr archive_read_data 3 ,
Packit Service 1d0348
.Xr archive_read_filter 3 ,
Packit Service 1d0348
.Xr archive_read_format 3 ,
Packit Service 1d0348
.Xr archive_read_open 3 ,
Packit Service 1d0348
.Xr archive_read_set_options 3 ,
Packit Service 1d0348
.Xr archive_util 3 ,
Packit Service 1d0348
.Xr tar 5