ManPageArchiveUtil3.wiki 6.6 KB

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