Import libarchive-3.3.3
[dragonfly.git] / contrib / libarchive / libarchive / archive_read_format.3
1 .\" Copyright (c) 2003-2011 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$
26 .\"
27 .Dd February 2, 2012
28 .Dt ARCHIVE_READ_FORMAT 3
29 .Os
30 .Sh NAME
31 .Nm archive_read_support_format_7zip ,
32 .Nm archive_read_support_format_all ,
33 .Nm archive_read_support_format_ar ,
34 .Nm archive_read_support_format_by_code ,
35 .Nm archive_read_support_format_cab ,
36 .Nm archive_read_support_format_cpio ,
37 .Nm archive_read_support_format_empty ,
38 .Nm archive_read_support_format_iso9660 ,
39 .Nm archive_read_support_format_lha ,
40 .Nm archive_read_support_format_mtree ,
41 .Nm archive_read_support_format_rar ,
42 .Nm archive_read_support_format_raw ,
43 .Nm archive_read_support_format_tar ,
44 .Nm archive_read_support_format_xar ,
45 .Nm archive_read_support_format_zip
46 .Nd functions for reading streaming archives
47 .\"
48 .Sh LIBRARY
49 Streaming Archive Library (libarchive, -larchive)
50 .Sh SYNOPSIS
51 .In archive.h
52 .Ft int
53 .Fn archive_read_support_format_7zip "struct archive *"
54 .Ft int
55 .Fn archive_read_support_format_all "struct archive *"
56 .Ft int
57 .Fn archive_read_support_format_ar "struct archive *"
58 .Ft int
59 .Fn archive_read_support_format_by_code "struct archive *" "int"
60 .Ft int
61 .Fn archive_read_support_format_cab "struct archive *"
62 .Ft int
63 .Fn archive_read_support_format_cpio "struct archive *"
64 .Ft int
65 .Fn archive_read_support_format_empty "struct archive *"
66 .Ft int
67 .Fn archive_read_support_format_iso9660 "struct archive *"
68 .Ft int
69 .Fn archive_read_support_format_lha "struct archive *"
70 .Ft int
71 .Fn archive_read_support_format_mtree "struct archive *"
72 .Ft int
73 .Fn archive_read_support_format_rar "struct archive *"
74 .Ft int
75 .Fn archive_read_support_format_raw "struct archive *"
76 .Ft int
77 .Fn archive_read_support_format_tar "struct archive *"
78 .Ft int
79 .Fn archive_read_support_format_xar "struct archive *"
80 .Ft int
81 .Fn archive_read_support_format_zip "struct archive *"
82 .\"
83 .Sh DESCRIPTION
84 .Bl -tag -compact -width indent
85 .It Xo
86 .Fn archive_read_support_format_7zip ,
87 .Fn archive_read_support_format_ar ,
88 .Fn archive_read_support_format_cab ,
89 .Fn archive_read_support_format_cpio ,
90 .Fn archive_read_support_format_iso9660 ,
91 .Fn archive_read_support_format_lha ,
92 .Fn archive_read_support_format_mtree ,
93 .Fn archive_read_support_format_rar ,
94 .Fn archive_read_support_format_raw ,
95 .Fn archive_read_support_format_tar ,
96 .Fn archive_read_support_format_xar ,
97 .Fn archive_read_support_format_zip
98 .Xc
99 Enables support---including auto-detection code---for the
100 specified archive format.
101 For example,
102 .Fn archive_read_support_format_tar
103 enables support for a variety of standard tar formats, old-style tar,
104 ustar, pax interchange format, and many common variants.
105 .It Fn archive_read_support_format_all 
106 Enables support for all available formats except the
107 .Dq raw
108 format (see below).
109 .It Fn archive_read_support_format_by_code
110 Enables a single format specified by the format code.
111 This can be useful when reading a single archive twice;
112 use
113 .Fn archive_format
114 after reading the first time and pass the resulting code
115 to this function to selectively enable only the necessary
116 format support.
117 Note:  In statically-linked executables, this will cause
118 your program to include support for every format.
119 If executable size is a concern, you may wish to avoid
120 using this function.
121 .It Fn archive_read_support_format_empty
122 Enables support for treating empty files as empty archives.
123 Because empty files are valid for several different formats,
124 it is not possible to accurately determine a format for
125 an empty file based purely on contents.
126 So empty files are treated by libarchive as a distinct
127 format.
128 .It Fn archive_read_support_format_raw 
129 The
130 .Dq raw
131 format handler allows libarchive to be used to read arbitrary data.
132 It treats any data stream as an archive with a single entry.
133 The pathname of this entry is
134 .Dq data ;
135 all other entry fields are unset.
136 This is not enabled by
137 .Fn archive_read_support_format_all
138 in order to avoid erroneous handling of damaged archives.
139 .El
140 .\" .Sh EXAMPLE
141 .Sh RETURN VALUES
142 These functions return
143 .Cm ARCHIVE_OK
144 on success, or
145 .Cm ARCHIVE_FATAL .
146 .\"
147 .Sh ERRORS
148 Detailed error codes and textual descriptions are available from the
149 .Fn archive_errno
150 and
151 .Fn archive_error_string
152 functions.
153 .\"
154 .Sh SEE ALSO
155 .Xr tar 1 ,
156 .Xr libarchive 3 ,
157 .Xr archive_read_data 3 ,
158 .Xr archive_read_filter 3 ,
159 .Xr archive_read_set_options 3 ,
160 .Xr archive_util 3 ,
161 .Xr tar 5
162 .Sh BUGS
163 Many traditional archiver programs treat
164 empty files as valid empty archives.
165 For example, many implementations of
166 .Xr tar 1
167 allow you to append entries to an empty file.
168 Of course, it is impossible to determine the format of an empty file
169 by inspecting the contents, so this library treats empty files as
170 having a special
171 .Dq empty
172 format.
173 .Pp
174 Using the
175 .Dq raw
176 handler together with any other handler will often work
177 but can produce surprising results.