summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/doc/html/archive_util.3.html
blob: be632ffbe9271fc0272df7e5aa9bc549bfeaa48d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!-- Creator     : groff version 1.22.3 -->
<!-- CreationDate: Mon Sep  3 22:55:08 2018 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
       h1      { text-align: center }
</style>
<title></title>
</head>
<body>

<hr>


<p>ARCHIVE_UTIL(3) BSD Library Functions Manual
ARCHIVE_UTIL(3)</p>

<p style="margin-top: 1em"><b>NAME</b></p>

<p style="margin-left:6%;"><b>archive_clear_error</b>,
<b>archive_compression</b>, <b>archive_compression_name</b>,
<b>archive_copy_error</b>, <b>archive_errno</b>,
<b>archive_error_string</b>, <b>archive_file_count</b>,
<b>archive_filter_code</b>, <b>archive_filter_count</b>,
<b>archive_filter_name</b>, <b>archive_format</b>,
<b>archive_format_name</b>, <b>archive_position</b>,
<b>archive_set_error</b> &mdash; libarchive utility
functions</p>

<p style="margin-top: 1em"><b>LIBRARY</b></p>

<p style="margin-left:6%;">Streaming Archive Library
(libarchive, -larchive)</p>

<p style="margin-top: 1em"><b>SYNOPSIS</b></p>

<p style="margin-left:6%;"><b>#include
&lt;archive.h&gt;</b></p>

<p style="margin-left:6%; margin-top: 1em"><i>void</i></p>


<p style="margin-left:12%;"><b>archive_clear_error</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>


<p style="margin-left:12%;"><b>archive_compression</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>const char
*</i></p>


<p style="margin-left:12%;"><b>archive_compression_name</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>void</i></p>


<p style="margin-left:12%;"><b>archive_copy_error</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>


<p style="margin-left:12%;"><b>archive_errno</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>const char
*</i></p>


<p style="margin-left:12%;"><b>archive_error_string</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>


<p style="margin-left:12%;"><b>archive_file_count</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>


<p style="margin-left:12%;"><b>archive_filter_code</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>


<p style="margin-left:12%;"><b>archive_filter_count</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>const char
*</i></p>


<p style="margin-left:12%;"><b>archive_filter_name</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>int</i></p>


<p style="margin-left:12%;"><b>archive_format</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>const char
*</i></p>


<p style="margin-left:12%;"><b>archive_format_name</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>


<p style="margin-left:6%; margin-top: 1em"><i>int64_t</i></p>


<p style="margin-left:12%;"><b>archive_position</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int</i>);</p>

<p style="margin-left:6%; margin-top: 1em"><i>void</i></p>


<p><b>archive_set_error</b>(<i>struct&nbsp;archive&nbsp;*</i>,
<i>int&nbsp;error_code</i>,
<i>const&nbsp;char&nbsp;*fmt</i>, <i>...</i>);</p>

<p style="margin-top: 1em"><b>DESCRIPTION</b></p>

<p style="margin-left:6%;">These functions provide access
to various information about the struct archive object used
in the libarchive(3) library.</p>

<p><b>archive_clear_error</b>()</p>

<p style="margin-left:17%;">Clears any error information
left over from a previous call. Not generally used in client
code.</p>

<p><b>archive_compression</b>()</p>

<p style="margin-left:17%;">Synonym for
<b>archive_filter_code(a,</b>(<i>0)</i>).</p>

<p><b>archive_compression_name</b>()</p>

<p style="margin-left:17%;">Synonym for
<b>archive_filter_name(a,</b>(<i>0)</i>).</p>

<p><b>archive_copy_error</b>()</p>

<p style="margin-left:17%;">Copies error information from
one archive to another.</p>

<p><b>archive_errno</b>()</p>

<p style="margin-left:17%;">Returns a numeric error code
(see errno(2)) indicating the reason for the most recent
error return. Note that this can not be reliably used to
detect whether an error has occurred. It should be used only
after another libarchive function has returned an error
status.</p>

<p><b>archive_error_string</b>()</p>

<p style="margin-left:17%;">Returns a textual error message
suitable for display. The error message here is usually more
specific than that obtained from passing the result of
<b>archive_errno</b>() to strerror(3).</p>

<p><b>archive_file_count</b>()</p>

<p style="margin-left:17%;">Returns a count of the number
of files processed by this archive object. The count is
incremented by calls to archive_write_header(3) or
archive_read_next_header(3).</p>

<p><b>archive_filter_code</b>()</p>

<p style="margin-left:17%;">Returns a numeric code
identifying the indicated filter. See
<b>archive_filter_count</b>() for details of the
numbering.</p>

<p><b>archive_filter_count</b>()</p>

<p style="margin-left:17%;">Returns the number of filters
in the current pipeline. For read archive handles, these
filters are added automatically by the automatic format
detection. For write archive handles, these filters are
added by calls to the various
<b>archive_write_add_filter_XXX</b>() functions. Filters in
the resulting pipeline are numbered so that filter 0 is the
filter closest to the format handler. As a convenience,
functions that expect a filter number will accept -1 as a
synonym for the highest-numbered filter.</p>

<p style="margin-left:17%; margin-top: 1em">For example,
when reading a uuencoded gzipped tar archive, there are
three filters: filter 0 is the gunzip filter, filter 1 is
the uudecode filter, and filter 2 is the pseudo-filter that
wraps the archive read functions. In this case, requesting
<b>archive_position(a,</b>(<i>-1)</i>) would be a synonym
for <b>archive_position(a,</b>(<i>2)</i>) which would return
the number of bytes currently read from the archive, while
<b>archive_position(a,</b>(<i>1)</i>) would return the
number of bytes after uudecoding, and
<b>archive_position(a,</b>(<i>0)</i>) would return the
number of bytes after decompression.</p>

<p><b>archive_filter_name</b>()</p>

<p style="margin-left:17%;">Returns a textual name
identifying the indicated filter. See
<b>archive_filter_count</b>() for details of the
numbering.</p>

<p><b>archive_format</b>()</p>

<p style="margin-left:17%;">Returns a numeric code
indicating the format of the current archive entry. This
value is set by a successful call to
<b>archive_read_next_header</b>(). 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.</p>

<p><b>archive_format_name</b>()</p>

<p style="margin-left:17%;">A textual description of the
format of the current entry.</p>

<p><b>archive_position</b>()</p>

<p style="margin-left:17%;">Returns the number of bytes
read from or written to the indicated filter. In particular,
<b>archive_position(a,</b>(<i>0)</i>) returns the number of
bytes read or written by the format handler, while
<b>archive_position(a,</b>(<i>-1)</i>) returns the number of
bytes read or written to the archive. See
<b>archive_filter_count</b>() for details of the numbering
here.</p>

<p><b>archive_set_error</b>()</p>

<p style="margin-left:17%;">Sets the numeric error code and
error description that will be returned by
<b>archive_errno</b>() and <b>archive_error_string</b>().
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: &rsquo;&rsquo;%c&rsquo;&rsquo;,
&rsquo;&rsquo;%d&rsquo;&rsquo;,
&rsquo;&rsquo;%jd&rsquo;&rsquo;,
&rsquo;&rsquo;%jo&rsquo;&rsquo;,
&rsquo;&rsquo;%ju&rsquo;&rsquo;,
&rsquo;&rsquo;%jx&rsquo;&rsquo;,
&rsquo;&rsquo;%ld&rsquo;&rsquo;,
&rsquo;&rsquo;%lo&rsquo;&rsquo;,
&rsquo;&rsquo;%lu&rsquo;&rsquo;,
&rsquo;&rsquo;%lx&rsquo;&rsquo;,
&rsquo;&rsquo;%o&rsquo;&rsquo;,
&rsquo;&rsquo;%u&rsquo;&rsquo;,
&rsquo;&rsquo;%s&rsquo;&rsquo;,
&rsquo;&rsquo;%x&rsquo;&rsquo;,
&rsquo;&rsquo;%%&rsquo;&rsquo;. Field-width specifiers and
other printf features are not uniformly supported and should
not be used.</p>

<p style="margin-top: 1em"><b>SEE ALSO</b></p>

<p style="margin-left:6%;">archive_read(3),
archive_write(3), libarchive(3), printf(3)</p>

<p style="margin-top: 1em"><b>HISTORY</b></p>

<p style="margin-left:6%;">The <b>libarchive</b> library
first appeared in FreeBSD&nbsp;5.3.</p>

<p style="margin-top: 1em"><b>AUTHORS</b></p>

<p style="margin-left:6%;">The <b>libarchive</b> library
was written by Tim Kientzle &lt;kientzle@acm.org&gt;.</p>

<p style="margin-left:6%; margin-top: 1em">BSD
February&nbsp;2, 2012 BSD</p>
<hr>
</body>
</html>