Import libarchive 2.1.9.
[dragonfly.git] / contrib / libarchive-2.1 / libarchive / archive_util.3
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.6 2007/03/03 07:37:36 kientzle 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_errno ,
35 .Nm archive_error_string ,
36 .Nm archive_format ,
37 .Nm archive_format_name ,
38 .Nm archive_set_error ,
39 .Nm archive_copy_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 int
50 .Fn archive_errno "struct archive *"
51 .Ft const char *
52 .Fn archive_error_string "struct archive *"
53 .Ft int
54 .Fn archive_format "struct archive *"
55 .Ft const char *
56 .Fn archive_format_name "struct archive *"
57 .Ft void
58 .Fn archive_set_error "struct archive *" "int error_code" "const char *fmt" "..."
59 .Ft void
60 .Fn archive_copy_error "struct archive *" "struct archive *"
61 .Sh DESCRIPTION
62 These functions provide access to various information about the
63 .Tn struct archive
64 object used in the
65 .Xr libarchive 3
66 library.
67 .Bl -tag -compact -width indent
68 .It Fn archive_clear_error
69 Clears any error information left over from a previous call.
70 Not generally used in client code.
71 .It Fn archive_compression
72 Returns a numeric code indicating the current compression.
73 This value is set by
74 .Fn archive_read_open .
75 .It Fn archive_compression_name
76 Returns a text description of the current compression suitable for display.
77 .It Fn archive_errno
78 Returns a numeric error code (see
79 .Xr errno 2 )
80 indicating the reason for the most recent error return.
81 .It Fn archive_error_string
82 Returns a textual error message suitable for display.
83 The error message here is usually more specific than that
84 obtained from passing the result of
85 .Fn archive_errno
86 to
87 .Xr strerror 3 .
88 .It Fn archive_format
89 Returns a numeric code indicating the format of the current
90 archive entry.
91 This value is set by a successful call to
92 .Fn archive_read_next_header .
93 Note that it is common for this value to change from
94 entry to entry.
95 For example, a tar archive might have several entries that
96 utilize GNU tar extensions and several entries that do not.
97 These entries will have different format codes.
98 .It Fn archive_format_name
99 A textual description of the format of the current entry.
100 .It Fn archive_set_error
101 Sets the numeric error code and error description that will be returned
102 by
103 .Fn archive_errno
104 and
105 .Fn archive_error_string .
106 This function should be used within I/O callbacks to set system-specific
107 error codes and error descriptions.
108 This function accepts a printf-like format string and arguments.
109 However, you should be careful to use only the following printf
110 format specifiers:
111 .Dq %c ,
112 .Dq %d ,
113 .Dq %jd ,
114 .Dq %jo ,
115 .Dq %ju ,
116 .Dq %jx ,
117 .Dq %ld ,
118 .Dq %lo ,
119 .Dq %lu ,
120 .Dq %lx ,
121 .Dq %o ,
122 .Dq %u ,
123 .Dq %s ,
124 .Dq %x ,
125 .Dq %% .
126 Field-width specifiers and other printf features are
127 not uniformly supported and should not be used.
128 .It Fn archive_copy_error
129 Copies error information from one archive to another.
130 .El
131 .Sh SEE ALSO
132 .Xr archive_read 3 ,
133 .Xr archive_write 3 ,
134 .Xr libarchive 3 ,
135 .Xr printf 3
136 .Sh HISTORY
137 The
138 .Nm libarchive
139 library first appeared in
140 .Fx 5.3 .
141 .Sh AUTHORS
142 .An -nosplit
143 The
144 .Nm libarchive
145 library was written by
146 .An Tim Kientzle Aq kientzle@acm.org .