archive_util.3.txt 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. ARCHIVE_UTIL(3) BSD Library Functions Manual ARCHIVE_UTIL(3)
  2. NAME
  3. archive_clear_error, archive_compression, archive_compression_name,
  4. archive_copy_error, archive_errno, archive_error_string,
  5. archive_file_count, archive_filter_code, archive_filter_count,
  6. archive_filter_name, archive_format, archive_format_name,
  7. archive_position, archive_set_error — libarchive utility functions
  8. LIBRARY
  9. Streaming Archive Library (libarchive, -larchive)
  10. SYNOPSIS
  11. #include <archive.h>
  12. void
  13. archive_clear_error(struct archive *);
  14. int
  15. archive_compression(struct archive *);
  16. const char *
  17. archive_compression_name(struct archive *);
  18. void
  19. archive_copy_error(struct archive *, struct archive *);
  20. int
  21. archive_errno(struct archive *);
  22. const char *
  23. archive_error_string(struct archive *);
  24. int
  25. archive_file_count(struct archive *);
  26. int
  27. archive_filter_code(struct archive *, int);
  28. int
  29. archive_filter_count(struct archive *, int);
  30. const char *
  31. archive_filter_name(struct archive *, int);
  32. int
  33. archive_format(struct archive *);
  34. const char *
  35. archive_format_name(struct archive *);
  36. int64_t
  37. archive_position(struct archive *, int);
  38. void
  39. archive_set_error(struct archive *, int error_code, const char *fmt,
  40. ...);
  41. DESCRIPTION
  42. These functions provide access to various information about the struct
  43. archive object used in the libarchive(3) library.
  44. archive_clear_error()
  45. Clears any error information left over from a previous call. Not
  46. generally used in client code.
  47. archive_compression()
  48. Synonym for archive_filter_code(a, 0).
  49. archive_compression_name()
  50. Synonym for archive_filter_name(a, 0).
  51. archive_copy_error()
  52. Copies error information from one archive to another.
  53. archive_errno()
  54. Returns a numeric error code (see errno(2)) indicating the reason
  55. for the most recent error return. Note that this can not be re‐
  56. liably used to detect whether an error has occurred. It should
  57. be used only after another libarchive function has returned an
  58. error status.
  59. archive_error_string()
  60. Returns a textual error message suitable for display. The error
  61. message here is usually more specific than that obtained from
  62. passing the result of archive_errno() to strerror(3).
  63. archive_file_count()
  64. Returns a count of the number of files processed by this archive
  65. object. The count is incremented by calls to
  66. archive_write_header(3) or archive_read_next_header(3).
  67. archive_filter_code()
  68. Returns a numeric code identifying the indicated filter. See
  69. archive_filter_count() for details of the numbering.
  70. archive_filter_count()
  71. Returns the number of filters in the current pipeline. For read
  72. archive handles, these filters are added automatically by the au‐
  73. tomatic format detection. For write archive handles, these fil‐
  74. ters are added by calls to the various
  75. archive_write_add_filter_XXX() functions. Filters in the result‐
  76. ing pipeline are numbered so that filter 0 is the filter closest
  77. to the format handler. As a convenience, functions that expect a
  78. filter number will accept -1 as a synonym for the highest-num‐
  79. bered filter.
  80. For example, when reading a uuencoded gzipped tar archive, there
  81. are three filters: filter 0 is the gunzip filter, filter 1 is the
  82. uudecode filter, and filter 2 is the pseudo-filter that wraps the
  83. archive read functions. In this case, requesting
  84. archive_position(a, -1) would be a synonym for
  85. archive_position(a, 2) which would return the number of bytes
  86. currently read from the archive, while archive_position(a, 1)
  87. would return the number of bytes after uudecoding, and
  88. archive_position(a, 0) would return the number of bytes after de‐
  89. compression.
  90. archive_filter_name()
  91. Returns a textual name identifying the indicated filter. See
  92. archive_filter_count() for details of the numbering.
  93. archive_format()
  94. Returns a numeric code indicating the format of the current ar‐
  95. chive entry. This value is set by a successful call to
  96. archive_read_next_header(). Note that it is common for this
  97. value to change from entry to entry. For example, a tar archive
  98. might have several entries that utilize GNU tar extensions and
  99. several entries that do not. These entries will have different
  100. format codes.
  101. archive_format_name()
  102. A textual description of the format of the current entry.
  103. archive_position()
  104. Returns the number of bytes read from or written to the indicated
  105. filter. In particular, archive_position(a, 0) returns the number
  106. of bytes read or written by the format handler, while
  107. archive_position(a, -1) returns the number of bytes read or writ‐
  108. ten to the archive. See archive_filter_count() for details of
  109. the numbering here.
  110. archive_set_error()
  111. Sets the numeric error code and error description that will be
  112. returned by archive_errno() and archive_error_string(). This
  113. function should be used within I/O callbacks to set system-spe‐
  114. cific error codes and error descriptions. This function accepts
  115. a printf-like format string and arguments. However, you should
  116. be careful to use only the following printf format specifiers:
  117. “%c”, “%d”, “%jd”, “%jo”, “%ju”, “%jx”, “%ld”, “%lo”, “%lu”,
  118. “%lx”, “%o”, “%u”, “%s”, “%x”, “%%”. Field-width specifiers and
  119. other printf features are not uniformly supported and should not
  120. be used.
  121. SEE ALSO
  122. archive_read(3), archive_write(3), libarchive(3), printf(3)
  123. HISTORY
  124. The libarchive library first appeared in FreeBSD 5.3.
  125. AUTHORS
  126. The libarchive library was written by Tim Kientzle <[email protected]>.
  127. BSD February 2, 2012 BSD