archive_util.3.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <!-- Creator : groff version 1.22.4 -->
  2. <!-- CreationDate: Tue Jul 18 07:11:05 2023 -->
  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. <hr>
  20. <p>ARCHIVE_UTIL(3) BSD Library Functions Manual
  21. ARCHIVE_UTIL(3)</p>
  22. <p style="margin-top: 1em"><b>NAME</b></p>
  23. <p style="margin-left:6%;"><b>archive_clear_error</b>,
  24. <b>archive_compression</b>, <b>archive_compression_name</b>,
  25. <b>archive_copy_error</b>, <b>archive_errno</b>,
  26. <b>archive_error_string</b>, <b>archive_file_count</b>,
  27. <b>archive_filter_code</b>, <b>archive_filter_count</b>,
  28. <b>archive_filter_name</b>, <b>archive_format</b>,
  29. <b>archive_format_name</b>, <b>archive_position</b>,
  30. <b>archive_set_error</b> &mdash; libarchive utility
  31. functions</p>
  32. <p style="margin-top: 1em"><b>LIBRARY</b></p>
  33. <p style="margin-left:6%;">Streaming Archive Library
  34. (libarchive, -larchive)</p>
  35. <p style="margin-top: 1em"><b>SYNOPSIS</b></p>
  36. <p style="margin-left:6%;"><b>#include
  37. &lt;archive.h&gt;</b></p>
  38. <p style="margin-left:6%; margin-top: 1em"><i>void</i></p>
  39. <p style="margin-left:12%;"><b>archive_clear_error</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  40. <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
  41. <p style="margin-left:12%;"><b>archive_compression</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  42. <p style="margin-left:6%; margin-top: 1em"><i>const char
  43. *</i></p>
  44. <p style="margin-left:12%;"><b>archive_compression_name</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  45. <p style="margin-left:6%; margin-top: 1em"><i>void</i></p>
  46. <p style="margin-left:12%;"><b>archive_copy_error</b>(<i>struct&nbsp;archive&nbsp;*</i>,
  47. <i>struct&nbsp;archive&nbsp;*</i>);</p>
  48. <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
  49. <p style="margin-left:12%;"><b>archive_errno</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  50. <p style="margin-left:6%; margin-top: 1em"><i>const char
  51. *</i></p>
  52. <p style="margin-left:12%;"><b>archive_error_string</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  53. <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
  54. <p style="margin-left:12%;"><b>archive_file_count</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  55. <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
  56. <p style="margin-left:12%;"><b>archive_filter_code</b>(<i>struct&nbsp;archive&nbsp;*</i>,
  57. <i>int</i>);</p>
  58. <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
  59. <p style="margin-left:12%;"><b>archive_filter_count</b>(<i>struct&nbsp;archive&nbsp;*</i>,
  60. <i>int</i>);</p>
  61. <p style="margin-left:6%; margin-top: 1em"><i>const char
  62. *</i></p>
  63. <p style="margin-left:12%;"><b>archive_filter_name</b>(<i>struct&nbsp;archive&nbsp;*</i>,
  64. <i>int</i>);</p>
  65. <p style="margin-left:6%; margin-top: 1em"><i>int</i></p>
  66. <p style="margin-left:12%;"><b>archive_format</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  67. <p style="margin-left:6%; margin-top: 1em"><i>const char
  68. *</i></p>
  69. <p style="margin-left:12%;"><b>archive_format_name</b>(<i>struct&nbsp;archive&nbsp;*</i>);</p>
  70. <p style="margin-left:6%; margin-top: 1em"><i>int64_t</i></p>
  71. <p style="margin-left:12%;"><b>archive_position</b>(<i>struct&nbsp;archive&nbsp;*</i>,
  72. <i>int</i>);</p>
  73. <p style="margin-left:6%; margin-top: 1em"><i>void</i></p>
  74. <p><b>archive_set_error</b>(<i>struct&nbsp;archive&nbsp;*</i>,
  75. <i>int&nbsp;error_code</i>,
  76. <i>const&nbsp;char&nbsp;*fmt</i>, <i>...</i>);</p>
  77. <p style="margin-top: 1em"><b>DESCRIPTION</b></p>
  78. <p style="margin-left:6%;">These functions provide access
  79. to various information about the struct archive object used
  80. in the libarchive(3) library.</p>
  81. <p><b>archive_clear_error</b>()</p>
  82. <p style="margin-left:17%;">Clears any error information
  83. left over from a previous call. Not generally used in client
  84. code.</p>
  85. <p><b>archive_compression</b>()</p>
  86. <p style="margin-left:17%;">Synonym for
  87. <b>archive_filter_code</b>(<i>a</i>, <i>0</i>).</p>
  88. <p><b>archive_compression_name</b>()</p>
  89. <p style="margin-left:17%;">Synonym for
  90. <b>archive_filter_name</b>(<i>a</i>, <i>0</i>).</p>
  91. <p><b>archive_copy_error</b>()</p>
  92. <p style="margin-left:17%;">Copies error information from
  93. one archive to another.</p>
  94. <p><b>archive_errno</b>()</p>
  95. <p style="margin-left:17%;">Returns a numeric error code
  96. (see errno(2)) indicating the reason for the most recent
  97. error return. Note that this can not be reliably used to
  98. detect whether an error has occurred. It should be used only
  99. after another libarchive function has returned an error
  100. status.</p>
  101. <p><b>archive_error_string</b>()</p>
  102. <p style="margin-left:17%;">Returns a textual error message
  103. suitable for display. The error message here is usually more
  104. specific than that obtained from passing the result of
  105. <b>archive_errno</b>() to strerror(3).</p>
  106. <p><b>archive_file_count</b>()</p>
  107. <p style="margin-left:17%;">Returns a count of the number
  108. of files processed by this archive object. The count is
  109. incremented by calls to archive_write_header(3) or
  110. archive_read_next_header(3).</p>
  111. <p><b>archive_filter_code</b>()</p>
  112. <p style="margin-left:17%;">Returns a numeric code
  113. identifying the indicated filter. See
  114. <b>archive_filter_count</b>() for details of the
  115. numbering.</p>
  116. <p><b>archive_filter_count</b>()</p>
  117. <p style="margin-left:17%;">Returns the number of filters
  118. in the current pipeline. For read archive handles, these
  119. filters are added automatically by the automatic format
  120. detection. For write archive handles, these filters are
  121. added by calls to the various
  122. <b>archive_write_add_filter_XXX</b>() functions. Filters in
  123. the resulting pipeline are numbered so that filter 0 is the
  124. filter closest to the format handler. As a convenience,
  125. functions that expect a filter number will accept -1 as a
  126. synonym for the highest-numbered filter.</p>
  127. <p style="margin-left:17%; margin-top: 1em">For example,
  128. when reading a uuencoded gzipped tar archive, there are
  129. three filters: filter 0 is the gunzip filter, filter 1 is
  130. the uudecode filter, and filter 2 is the pseudo-filter that
  131. wraps the archive read functions. In this case, requesting
  132. <b>archive_position</b>(<i>a</i>, <i>-1</i>) would be a
  133. synonym for <b>archive_position</b>(<i>a</i>, <i>2</i>)
  134. which would return the number of bytes currently read from
  135. the archive, while <b>archive_position</b>(<i>a</i>,
  136. <i>1</i>) would return the number of bytes after uudecoding,
  137. and <b>archive_position</b>(<i>a</i>, <i>0</i>) would return
  138. the number of bytes after decompression.</p>
  139. <p><b>archive_filter_name</b>()</p>
  140. <p style="margin-left:17%;">Returns a textual name
  141. identifying the indicated filter. See
  142. <b>archive_filter_count</b>() for details of the
  143. numbering.</p>
  144. <p><b>archive_format</b>()</p>
  145. <p style="margin-left:17%;">Returns a numeric code
  146. indicating the format of the current archive entry. This
  147. value is set by a successful call to
  148. <b>archive_read_next_header</b>(). Note that it is common
  149. for this value to change from entry to entry. For example, a
  150. tar archive might have several entries that utilize GNU tar
  151. extensions and several entries that do not. These entries
  152. will have different format codes.</p>
  153. <p><b>archive_format_name</b>()</p>
  154. <p style="margin-left:17%;">A textual description of the
  155. format of the current entry.</p>
  156. <p><b>archive_position</b>()</p>
  157. <p style="margin-left:17%;">Returns the number of bytes
  158. read from or written to the indicated filter. In particular,
  159. <b>archive_position</b>(<i>a</i>, <i>0</i>) returns the
  160. number of bytes read or written by the format handler, while
  161. <b>archive_position</b>(<i>a</i>, <i>-1</i>) returns the
  162. number of bytes read or written to the archive. See
  163. <b>archive_filter_count</b>() for details of the numbering
  164. here.</p>
  165. <p><b>archive_set_error</b>()</p>
  166. <p style="margin-left:17%;">Sets the numeric error code and
  167. error description that will be returned by
  168. <b>archive_errno</b>() and <b>archive_error_string</b>().
  169. This function should be used within I/O callbacks to set
  170. system-specific error codes and error descriptions. This
  171. function accepts a printf-like format string and arguments.
  172. However, you should be careful to use only the following
  173. printf format specifiers: &ldquo;%c&rdquo;,
  174. &ldquo;%d&rdquo;, &ldquo;%jd&rdquo;, &ldquo;%jo&rdquo;,
  175. &ldquo;%ju&rdquo;, &ldquo;%jx&rdquo;, &ldquo;%ld&rdquo;,
  176. &ldquo;%lo&rdquo;, &ldquo;%lu&rdquo;, &ldquo;%lx&rdquo;,
  177. &ldquo;%o&rdquo;, &ldquo;%u&rdquo;, &ldquo;%s&rdquo;,
  178. &ldquo;%x&rdquo;, &ldquo;%%&rdquo;. Field-width specifiers
  179. and other printf features are not uniformly supported and
  180. should not be used.</p>
  181. <p style="margin-top: 1em"><b>SEE ALSO</b></p>
  182. <p style="margin-left:6%;">archive_read(3),
  183. archive_write(3), libarchive(3), printf(3)</p>
  184. <p style="margin-top: 1em"><b>HISTORY</b></p>
  185. <p style="margin-left:6%;">The <b>libarchive</b> library
  186. first appeared in FreeBSD&nbsp;5.3.</p>
  187. <p style="margin-top: 1em"><b>AUTHORS</b></p>
  188. <p style="margin-left:6%;">The <b>libarchive</b> library
  189. was written by Tim Kientzle &lt;[email protected]&gt;.</p>
  190. <p style="margin-left:6%; margin-top: 1em">BSD
  191. February&nbsp;2, 2012 BSD</p>
  192. <hr>
  193. </body>
  194. </html>