1<!-- Creator : groff version 1.22.4 --> 2<!-- CreationDate: Sun Aug 22 23:03:26 2021 --> 3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 4"http://www.w3.org/TR/html4/loose.dtd"> 5<html> 6<head> 7<meta name="generator" content="groff -Thtml, see www.gnu.org"> 8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 9<meta name="Content-Style" content="text/css"> 10<style type="text/css"> 11 p { margin-top: 0; margin-bottom: 0; vertical-align: top } 12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top } 13 table { margin-top: 0; margin-bottom: 0; vertical-align: top } 14 h1 { text-align: center } 15</style> 16<title></title> 17</head> 18<body> 19 20<hr> 21 22 23<p>ARCHIVE_UTIL(3) BSD Library Functions Manual 24ARCHIVE_UTIL(3)</p> 25 26<p style="margin-top: 1em"><b>NAME</b></p> 27 28<p style="margin-left:6%;"><b>archive_clear_error</b>, 29<b>archive_compression</b>, <b>archive_compression_name</b>, 30<b>archive_copy_error</b>, <b>archive_errno</b>, 31<b>archive_error_string</b>, <b>archive_file_count</b>, 32<b>archive_filter_code</b>, <b>archive_filter_count</b>, 33<b>archive_filter_name</b>, <b>archive_format</b>, 34<b>archive_format_name</b>, <b>archive_position</b>, 35<b>archive_set_error</b> — libarchive utility 36functions</p> 37 38<p style="margin-top: 1em"><b>LIBRARY</b></p> 39 40<p style="margin-left:6%;">Streaming Archive Library 41(libarchive, -larchive)</p> 42 43<p style="margin-top: 1em"><b>SYNOPSIS</b></p> 44 45<p style="margin-left:6%;"><b>#include 46<archive.h></b></p> 47 48<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 49 50 51<p style="margin-left:12%;"><b>archive_clear_error</b>(<i>struct archive *</i>);</p> 52 53<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 54 55 56<p style="margin-left:12%;"><b>archive_compression</b>(<i>struct archive *</i>);</p> 57 58<p style="margin-left:6%; margin-top: 1em"><i>const char 59*</i></p> 60 61 62<p style="margin-left:12%;"><b>archive_compression_name</b>(<i>struct archive *</i>);</p> 63 64<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 65 66 67<p style="margin-left:12%;"><b>archive_copy_error</b>(<i>struct archive *</i>, 68<i>struct archive *</i>);</p> 69 70<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 71 72 73<p style="margin-left:12%;"><b>archive_errno</b>(<i>struct archive *</i>);</p> 74 75<p style="margin-left:6%; margin-top: 1em"><i>const char 76*</i></p> 77 78 79<p style="margin-left:12%;"><b>archive_error_string</b>(<i>struct archive *</i>);</p> 80 81<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 82 83 84<p style="margin-left:12%;"><b>archive_file_count</b>(<i>struct archive *</i>);</p> 85 86<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 87 88 89<p style="margin-left:12%;"><b>archive_filter_code</b>(<i>struct archive *</i>, 90<i>int</i>);</p> 91 92<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 93 94 95<p style="margin-left:12%;"><b>archive_filter_count</b>(<i>struct archive *</i>, 96<i>int</i>);</p> 97 98<p style="margin-left:6%; margin-top: 1em"><i>const char 99*</i></p> 100 101 102<p style="margin-left:12%;"><b>archive_filter_name</b>(<i>struct archive *</i>, 103<i>int</i>);</p> 104 105<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 106 107 108<p style="margin-left:12%;"><b>archive_format</b>(<i>struct archive *</i>);</p> 109 110<p style="margin-left:6%; margin-top: 1em"><i>const char 111*</i></p> 112 113 114<p style="margin-left:12%;"><b>archive_format_name</b>(<i>struct archive *</i>);</p> 115 116 117<p style="margin-left:6%; margin-top: 1em"><i>int64_t</i></p> 118 119 120<p style="margin-left:12%;"><b>archive_position</b>(<i>struct archive *</i>, 121<i>int</i>);</p> 122 123<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 124 125 126<p><b>archive_set_error</b>(<i>struct archive *</i>, 127<i>int error_code</i>, 128<i>const char *fmt</i>, <i>...</i>);</p> 129 130<p style="margin-top: 1em"><b>DESCRIPTION</b></p> 131 132<p style="margin-left:6%;">These functions provide access 133to various information about the struct archive object used 134in the libarchive(3) library.</p> 135 136<p><b>archive_clear_error</b>()</p> 137 138<p style="margin-left:17%;">Clears any error information 139left over from a previous call. Not generally used in client 140code.</p> 141 142<p><b>archive_compression</b>()</p> 143 144<p style="margin-left:17%;">Synonym for 145<b>archive_filter_code</b>(<i>a</i>, <i>0</i>).</p> 146 147<p><b>archive_compression_name</b>()</p> 148 149<p style="margin-left:17%;">Synonym for 150<b>archive_filter_name</b>(<i>a</i>, <i>0</i>).</p> 151 152<p><b>archive_copy_error</b>()</p> 153 154<p style="margin-left:17%;">Copies error information from 155one archive to another.</p> 156 157<p><b>archive_errno</b>()</p> 158 159<p style="margin-left:17%;">Returns a numeric error code 160(see errno(2)) indicating the reason for the most recent 161error return. Note that this can not be reliably used to 162detect whether an error has occurred. It should be used only 163after another libarchive function has returned an error 164status.</p> 165 166<p><b>archive_error_string</b>()</p> 167 168<p style="margin-left:17%;">Returns a textual error message 169suitable for display. The error message here is usually more 170specific than that obtained from passing the result of 171<b>archive_errno</b>() to strerror(3).</p> 172 173<p><b>archive_file_count</b>()</p> 174 175<p style="margin-left:17%;">Returns a count of the number 176of files processed by this archive object. The count is 177incremented by calls to archive_write_header(3) or 178archive_read_next_header(3).</p> 179 180<p><b>archive_filter_code</b>()</p> 181 182<p style="margin-left:17%;">Returns a numeric code 183identifying the indicated filter. See 184<b>archive_filter_count</b>() for details of the 185numbering.</p> 186 187<p><b>archive_filter_count</b>()</p> 188 189<p style="margin-left:17%;">Returns the number of filters 190in the current pipeline. For read archive handles, these 191filters are added automatically by the automatic format 192detection. For write archive handles, these filters are 193added by calls to the various 194<b>archive_write_add_filter_XXX</b>() functions. Filters in 195the resulting pipeline are numbered so that filter 0 is the 196filter closest to the format handler. As a convenience, 197functions that expect a filter number will accept -1 as a 198synonym for the highest-numbered filter.</p> 199 200<p style="margin-left:17%; margin-top: 1em">For example, 201when reading a uuencoded gzipped tar archive, there are 202three filters: filter 0 is the gunzip filter, filter 1 is 203the uudecode filter, and filter 2 is the pseudo-filter that 204wraps the archive read functions. In this case, requesting 205<b>archive_position</b>(<i>a</i>, <i>-1</i>) would be a 206synonym for <b>archive_position</b>(<i>a</i>, <i>2</i>) 207which would return the number of bytes currently read from 208the archive, while <b>archive_position</b>(<i>a</i>, 209<i>1</i>) would return the number of bytes after uudecoding, 210and <b>archive_position</b>(<i>a</i>, <i>0</i>) would return 211the number of bytes after decompression.</p> 212 213<p><b>archive_filter_name</b>()</p> 214 215<p style="margin-left:17%;">Returns a textual name 216identifying the indicated filter. See 217<b>archive_filter_count</b>() for details of the 218numbering.</p> 219 220<p><b>archive_format</b>()</p> 221 222<p style="margin-left:17%;">Returns a numeric code 223indicating the format of the current archive entry. This 224value is set by a successful call to 225<b>archive_read_next_header</b>(). Note that it is common 226for this value to change from entry to entry. For example, a 227tar archive might have several entries that utilize GNU tar 228extensions and several entries that do not. These entries 229will have different format codes.</p> 230 231<p><b>archive_format_name</b>()</p> 232 233<p style="margin-left:17%;">A textual description of the 234format of the current entry.</p> 235 236<p><b>archive_position</b>()</p> 237 238<p style="margin-left:17%;">Returns the number of bytes 239read from or written to the indicated filter. In particular, 240<b>archive_position</b>(<i>a</i>, <i>0</i>) returns the 241number of bytes read or written by the format handler, while 242<b>archive_position</b>(<i>a</i>, <i>-1</i>) returns the 243number of bytes read or written to the archive. See 244<b>archive_filter_count</b>() for details of the numbering 245here.</p> 246 247<p><b>archive_set_error</b>()</p> 248 249<p style="margin-left:17%;">Sets the numeric error code and 250error description that will be returned by 251<b>archive_errno</b>() and <b>archive_error_string</b>(). 252This function should be used within I/O callbacks to set 253system-specific error codes and error descriptions. This 254function accepts a printf-like format string and arguments. 255However, you should be careful to use only the following 256printf format specifiers: “%c”, 257“%d”, “%jd”, “%jo”, 258“%ju”, “%jx”, “%ld”, 259“%lo”, “%lu”, “%lx”, 260“%o”, “%u”, “%s”, 261“%x”, “%%”. Field-width specifiers 262and other printf features are not uniformly supported and 263should not be used.</p> 264 265<p style="margin-top: 1em"><b>SEE ALSO</b></p> 266 267<p style="margin-left:6%;">archive_read(3), 268archive_write(3), libarchive(3), printf(3)</p> 269 270<p style="margin-top: 1em"><b>HISTORY</b></p> 271 272<p style="margin-left:6%;">The <b>libarchive</b> library 273first appeared in FreeBSD 5.3.</p> 274 275<p style="margin-top: 1em"><b>AUTHORS</b></p> 276 277<p style="margin-left:6%;">The <b>libarchive</b> library 278was written by Tim Kientzle <kientzle@acm.org>.</p> 279 280<p style="margin-left:6%; margin-top: 1em">BSD 281February 2, 2012 BSD</p> 282<hr> 283</body> 284</html> 285