Blame libarchive/archive_read_extract.3

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