freebsd-skq/lib/libarchive/archive_util.3
kientzle 013be331bc libarchive 2.2.3
* "compression_program" support uses an external program
  * Portability: no longer uses "struct stat" as a primary
    data interchange structure internally
  * Part of the above: refactor archive_entry to separate
    out copy_stat() and stat() functions
  * More complete tests for archive_entry
  * Finish archive_entry_clone()
  * Isolate major()/minor()/makedev() in archive_entry; remove
    these from everywhere else.
  * Bug fix: properly handle decompression look-ahead at end-of-data
  * Bug fixes to 'ar' support
  * Fix memory leak in ZIP reader
  * Portability: better timegm() emulation in iso9660 reader
  * New write_disk flags to suppress auto dir creation and not
    overwrite newer files (for future cpio front-end)
  * Simplify trailing-'/' fixup when writing tar and pax
  * Test enhancements:  fix various compiler warnings, improve
    portability, add lots of new tests.
  * Documentation: document new functions, first draft of
    libarchive_internals.3

MFC after: 14 days
Thanks to: Joerg Sonnenberger (compression_program)
Thanks to: Kai Wang (ar)
Thanks to: Colin Percival (many small fixes)
Thanks to: Many others who sent me various patches and problem reports.
2007-05-29 01:00:21 +00:00

147 lines
4.5 KiB
Groff

.\" Copyright (c) 2003-2007 Tim Kientzle
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 8, 2005
.Dt archive_util 3
.Os
.Sh NAME
.Nm archive_clear_error ,
.Nm archive_compression ,
.Nm archive_compression_name ,
.Nm archive_copy_error ,
.Nm archive_errno ,
.Nm archive_error_string ,
.Nm archive_format ,
.Nm archive_format_name ,
.Nm archive_set_error
.Nd libarchive utility functions
.Sh SYNOPSIS
.In archive.h
.Ft void
.Fn archive_clear_error "struct archive *"
.Ft int
.Fn archive_compression "struct archive *"
.Ft const char *
.Fn archive_compression_name "struct archive *"
.Ft void
.Fn archive_copy_error "struct archive *" "struct archive *"
.Ft int
.Fn archive_errno "struct archive *"
.Ft const char *
.Fn archive_error_string "struct archive *"
.Ft int
.Fn archive_format "struct archive *"
.Ft const char *
.Fn archive_format_name "struct archive *"
.Ft void
.Fn archive_set_error "struct archive *" "int error_code" "const char *fmt" "..."
.Sh DESCRIPTION
These functions provide access to various information about the
.Tn struct archive
object used in the
.Xr libarchive 3
library.
.Bl -tag -compact -width indent
.It Fn archive_clear_error
Clears any error information left over from a previous call.
Not generally used in client code.
.It Fn archive_compression
Returns a numeric code indicating the current compression.
This value is set by
.Fn archive_read_open .
.It Fn archive_compression_name
Returns a text description of the current compression suitable for display.
.It Fn archive_copy_error
Copies error information from one archive to another.
.It Fn archive_errno
Returns a numeric error code (see
.Xr errno 2 )
indicating the reason for the most recent error return.
.It Fn archive_error_string
Returns a textual error message suitable for display.
The error message here is usually more specific than that
obtained from passing the result of
.Fn archive_errno
to
.Xr strerror 3 .
.It Fn archive_format
Returns a numeric code indicating the format of the current
archive entry.
This value is set by a successful call to
.Fn archive_read_next_header .
Note that it is common for this value to change from
entry to entry.
For example, a tar archive might have several entries that
utilize GNU tar extensions and several entries that do not.
These entries will have different format codes.
.It Fn archive_format_name
A textual description of the format of the current entry.
.It Fn archive_set_error
Sets the numeric error code and error description that will be returned
by
.Fn archive_errno
and
.Fn archive_error_string .
This function should be used within I/O callbacks to set system-specific
error codes and error descriptions.
This function accepts a printf-like format string and arguments.
However, you should be careful to use only the following printf
format specifiers:
.Dq %c ,
.Dq %d ,
.Dq %jd ,
.Dq %jo ,
.Dq %ju ,
.Dq %jx ,
.Dq %ld ,
.Dq %lo ,
.Dq %lu ,
.Dq %lx ,
.Dq %o ,
.Dq %u ,
.Dq %s ,
.Dq %x ,
.Dq %% .
Field-width specifiers and other printf features are
not uniformly supported and should not be used.
.El
.Sh SEE ALSO
.Xr archive_read 3 ,
.Xr archive_write 3 ,
.Xr libarchive 3 ,
.Xr printf 3
.Sh HISTORY
The
.Nm libarchive
library first appeared in
.Fx 5.3 .
.Sh AUTHORS
.An -nosplit
The
.Nm libarchive
library was written by
.An Tim Kientzle Aq kientzle@acm.org .