summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/doc/wiki/ManPageArchiveUtil3.wiki
blob: 48341524eac6219cc9544df40ec63ce64a285ff4 (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
ARCHIVE_UTIL(3) manual page 
== NAME == 
'''archive_clear_error''', 
'''archive_compression''', 
'''archive_compression_name''', 
'''archive_copy_error''', 
'''archive_errno''', 
'''archive_error_string''', 
'''archive_file_count''', 
'''archive_filter_code''', 
'''archive_filter_count''', 
'''archive_filter_name''', 
'''archive_format''', 
'''archive_format_name''', 
'''archive_position''', 
'''archive_set_error''' 
- libarchive utility functions 
== LIBRARY == 
Streaming Archive Library (libarchive, -larchive) 
== SYNOPSIS == 
'''<nowiki>#include <archive.h></nowiki>''' 
<br> 
''void'' 
<br> 
'''archive_clear_error'''(''struct archive *''); 
<br> 
''int'' 
<br> 
'''archive_compression'''(''struct archive *''); 
<br> 
''const char *'' 
<br> 
'''archive_compression_name'''(''struct archive *''); 
<br> 
''void'' 
<br> 
'''archive_copy_error'''(''struct archive *'', ''struct archive *''); 
<br> 
''int'' 
<br> 
'''archive_errno'''(''struct archive *''); 
<br> 
''const char *'' 
<br> 
'''archive_error_string'''(''struct archive *''); 
<br> 
''int'' 
<br> 
'''archive_file_count'''(''struct archive *''); 
<br> 
''int'' 
<br> 
'''archive_filter_code'''(''struct archive *'', ''int''); 
<br> 
''int'' 
<br> 
'''archive_filter_count'''(''struct archive *'', ''int''); 
<br> 
''const char *'' 
<br> 
'''archive_filter_name'''(''struct archive *'', ''int''); 
<br> 
''int'' 
<br> 
'''archive_format'''(''struct archive *''); 
<br> 
''const char *'' 
<br> 
'''archive_format_name'''(''struct archive *''); 
<br> 
''int64_t'' 
<br> 
'''archive_position'''(''struct archive *'', ''int''); 
<br> 
''void'' 
<br> 
'''archive_set_error'''(''struct archive *'', ''int error_code'', ''const char *fmt'', ''...''); 
== DESCRIPTION == 
These functions provide access to various information about the 
'''struct archive''' 
object used in the 
[[ManPageibarchive3]] 
library. 
<dl> 
<dt>'''archive_clear_error'''()</dt><dd> 
Clears any error information left over from a previous call. 
Not generally used in client code. 
</dd><dt>'''archive_compression'''()</dt><dd> 
Synonym for 
'''archive_filter_code(a,'''(''0)''). 
</dd><dt>'''archive_compression_name'''()</dt><dd> 
Synonym for 
'''archive_filter_name(a,'''(''0)''). 
</dd><dt>'''archive_copy_error'''()</dt><dd> 
Copies error information from one archive to another. 
</dd><dt>'''archive_errno'''()</dt><dd> 
Returns a numeric error code (see 
[[errno(2)|http://www.freebsd.org/cgi/man.cgi?query=errno&sektion=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. 
</dd><dt>'''archive_error_string'''()</dt><dd> 
Returns a textual error message suitable for display. 
The error message here is usually more specific than that 
obtained from passing the result of 
'''archive_errno'''() 
to 
[[strerror(3)|http://www.freebsd.org/cgi/man.cgi?query=strerror&sektion=3]]. 
</dd><dt>'''archive_file_count'''()</dt><dd> 
Returns a count of the number of files processed by this archive object. 
The count is incremented by calls to 
[[ManPagerchiveriteeader3]] 
or 
[[ManPagerchiveeadexteader3]]. 
</dd><dt>'''archive_filter_code'''()</dt><dd> 
Returns a numeric code identifying the indicated filter. 
See 
'''archive_filter_count'''() 
for details of the numbering. 
</dd><dt>'''archive_filter_count'''()</dt><dd> 
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 
'''archive_write_add_filter_XXX'''() 
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. 

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 
'''archive_position(a,'''(''-1)'') 
would be a synonym for 
'''archive_position(a,'''(''2)'') 
which would return the number of bytes currently read from the archive, while 
'''archive_position(a,'''(''1)'') 
would return the number of bytes after uudecoding, and 
'''archive_position(a,'''(''0)'') 
would return the number of bytes after decompression. 
</dd><dt>'''archive_filter_name'''()</dt><dd> 
Returns a textual name identifying the indicated filter. 
See 
'''archive_filter_count'''() 
for details of the numbering. 
</dd><dt>'''archive_format'''()</dt><dd> 
Returns a numeric code indicating the format of the current 
archive entry. 
This value is set by a successful call to 
'''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. 
</dd><dt>'''archive_format_name'''()</dt><dd> 
A textual description of the format of the current entry. 
</dd><dt>'''archive_position'''()</dt><dd> 
Returns the number of bytes read from or written to the indicated filter. 
In particular, 
'''archive_position(a,'''(''0)'') 
returns the number of bytes read or written by the format handler, while 
'''archive_position(a,'''(''-1)'') 
returns the number of bytes read or written to the archive. 
See 
'''archive_filter_count'''() 
for details of the numbering here. 
</dd><dt>'''archive_set_error'''()</dt><dd> 
Sets the numeric error code and error description that will be returned 
by 
'''archive_errno'''() 
and 
'''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: 
"%c", 
"%d", 
"%jd", 
"%jo", 
"%ju", 
"%jx", 
"%ld", 
"%lo", 
"%lu", 
"%lx", 
"%o", 
"%u", 
"%s", 
"%x", 
"%%". 
Field-width specifiers and other printf features are 
not uniformly supported and should not be used. 
</dd></dl> 
== SEE ALSO == 
[[ManPagerchiveead3]], 
[[ManPagerchiverite3]], 
[[ManPageibarchive3]], 
[[printf(3)|http://www.freebsd.org/cgi/man.cgi?query=printf&sektion=3]] 
== HISTORY == 
The 
'''libarchive''' 
library first appeared in 
FreeBSD 5.3. 
== AUTHORS == 
The 
'''libarchive''' 
library was written by 
Tim Kientzle  &lt;kientzle@acm.org.&gt;