archive_util.3 4.9 KB

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