archive_util.3 6.4 KB

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