1.\" Copyright (c) 2003-2007 Tim Kientzle 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD: src/lib/libarchive/archive_util.3,v 1.8 2008/03/10 14:44:40 jkoshy Exp $ 26.\" 27.Dd January 8, 2005 28.Dt archive_util 3 29.Os 30.Sh NAME 31.Nm archive_clear_error , 32.Nm archive_compression , 33.Nm archive_compression_name , 34.Nm archive_copy_error , 35.Nm archive_errno , 36.Nm archive_error_string , 37.Nm archive_format , 38.Nm archive_format_name , 39.Nm archive_set_error 40.Nd libarchive utility functions 41.Sh SYNOPSIS 42.In archive.h 43.Ft void 44.Fn archive_clear_error "struct archive *" 45.Ft int 46.Fn archive_compression "struct archive *" 47.Ft const char * 48.Fn archive_compression_name "struct archive *" 49.Ft void 50.Fn archive_copy_error "struct archive *" "struct archive *" 51.Ft int 52.Fn archive_errno "struct archive *" 53.Ft const char * 54.Fn archive_error_string "struct archive *" 55.Ft int 56.Fn archive_format "struct archive *" 57.Ft const char * 58.Fn archive_format_name "struct archive *" 59.Ft void 60.Fo archive_set_error 61.Fa "struct archive *" 62.Fa "int error_code" 63.Fa "const char *fmt" 64.Fa "..." 65.Fc 66.Sh DESCRIPTION 67These functions provide access to various information about the 68.Tn struct archive 69object used in the 70.Xr libarchive 3 71library. 72.Bl -tag -compact -width indent 73.It Fn archive_clear_error 74Clears any error information left over from a previous call. 75Not generally used in client code. 76.It Fn archive_compression 77Returns a numeric code indicating the current compression. 78This value is set by 79.Fn archive_read_open . 80.It Fn archive_compression_name 81Returns a text description of the current compression suitable for display. 82.It Fn archive_copy_error 83Copies error information from one archive to another. 84.It Fn archive_errno 85Returns a numeric error code (see 86.Xr errno 2 ) 87indicating the reason for the most recent error return. 88.It Fn archive_error_string 89Returns a textual error message suitable for display. 90The error message here is usually more specific than that 91obtained from passing the result of 92.Fn archive_errno 93to 94.Xr strerror 3 . 95.It Fn archive_format 96Returns a numeric code indicating the format of the current 97archive entry. 98This value is set by a successful call to 99.Fn archive_read_next_header . 100Note that it is common for this value to change from 101entry to entry. 102For example, a tar archive might have several entries that 103utilize GNU tar extensions and several entries that do not. 104These entries will have different format codes. 105.It Fn archive_format_name 106A textual description of the format of the current entry. 107.It Fn archive_set_error 108Sets the numeric error code and error description that will be returned 109by 110.Fn archive_errno 111and 112.Fn archive_error_string . 113This function should be used within I/O callbacks to set system-specific 114error codes and error descriptions. 115This function accepts a printf-like format string and arguments. 116However, you should be careful to use only the following printf 117format specifiers: 118.Dq %c , 119.Dq %d , 120.Dq %jd , 121.Dq %jo , 122.Dq %ju , 123.Dq %jx , 124.Dq %ld , 125.Dq %lo , 126.Dq %lu , 127.Dq %lx , 128.Dq %o , 129.Dq %u , 130.Dq %s , 131.Dq %x , 132.Dq %% . 133Field-width specifiers and other printf features are 134not uniformly supported and should not be used. 135.El 136.Sh SEE ALSO 137.Xr archive_read 3 , 138.Xr archive_write 3 , 139.Xr libarchive 3 , 140.Xr printf 3 141.Sh HISTORY 142The 143.Nm libarchive 144library first appeared in 145.Fx 5.3 . 146.Sh AUTHORS 147.An -nosplit 148The 149.Nm libarchive 150library was written by 151.An Tim Kientzle Aq kientzle@acm.org . 152