archive_write_format.3 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. .\" Copyright (c) 2003-2011 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. .Dd February 14, 2013
  26. .Dt ARCHIVE_WRITE_FORMAT 3
  27. .Os
  28. .Sh NAME
  29. .Nm archive_write_set_format ,
  30. .Nm archive_write_set_format_7zip ,
  31. .Nm archive_write_set_format_ar ,
  32. .Nm archive_write_set_format_ar_bsd ,
  33. .Nm archive_write_set_format_ar_svr4 ,
  34. .Nm archive_write_set_format_by_name ,
  35. .Nm archive_write_set_format_cpio ,
  36. .Nm archive_write_set_format_cpio_bin ,
  37. .Nm archive_write_set_format_cpio_newc ,
  38. .Nm archive_write_set_format_cpio_odc ,
  39. .Nm archive_write_set_format_cpio_pwb ,
  40. .Nm archive_write_set_format_filter_by_ext ,
  41. .Nm archive_write_set_format_filter_by_ext_def ,
  42. .Nm archive_write_set_format_gnutar ,
  43. .Nm archive_write_set_format_iso9660 ,
  44. .Nm archive_write_set_format_mtree ,
  45. .Nm archive_write_set_format_mtree_classic ,
  46. .Nm archive_write_set_format_mtree_default ,
  47. .Nm archive_write_set_format_pax ,
  48. .Nm archive_write_set_format_pax_restricted ,
  49. .Nm archive_write_set_format_raw ,
  50. .Nm archive_write_set_format_shar ,
  51. .Nm archive_write_set_format_shar_dump ,
  52. .Nm archive_write_set_format_ustar ,
  53. .Nm archive_write_set_format_v7tar ,
  54. .Nm archive_write_set_format_warc ,
  55. .Nm archive_write_set_format_xar ,
  56. .Nm archive_write_set_format_zip
  57. .Nd functions for creating archives
  58. .Sh LIBRARY
  59. Streaming Archive Library (libarchive, -larchive)
  60. .Sh SYNOPSIS
  61. .In archive.h
  62. .Ft int
  63. .Fn archive_write_set_format "struct archive *" "int code"
  64. .Ft int
  65. .Fn archive_write_set_format_7zip "struct archive *"
  66. .Ft int
  67. .Fn archive_write_set_format_ar "struct archive *"
  68. .Ft int
  69. .Fn archive_write_set_format_ar_bsd "struct archive *"
  70. .Ft int
  71. .Fn archive_write_set_format_ar_svr4 "struct archive *"
  72. .Ft int
  73. .Fn archive_write_set_format_by_name "struct archive *" "const char *name"
  74. .Ft int
  75. .Fn archive_write_set_format_cpio "struct archive *"
  76. .Ft int
  77. .Fn archive_write_set_format_cpio_bin "struct archive *"
  78. .Ft int
  79. .Fn archive_write_set_format_cpio_newc "struct archive *"
  80. .Ft int
  81. .Fn archive_write_set_format_cpio_odc "struct archive *"
  82. .Ft int
  83. .Fn archive_write_set_format_cpio_pwb "struct archive *"
  84. .Ft int
  85. .Fn archive_write_set_format_filter_by_ext "struct archive *" "const char *filename"
  86. .Ft int
  87. .Fn archive_write_set_format_filter_by_ext_def "struct archive *" "const char *filename" "const char *def_ext"
  88. .Ft int
  89. .Fn archive_write_set_format_gnutar "struct archive *"
  90. .Ft int
  91. .Fn archive_write_set_format_iso9660 "struct archive *"
  92. .Ft int
  93. .Fn archive_write_set_format_mtree "struct archive *"
  94. .Ft int
  95. .Fn archive_write_set_format_pax "struct archive *"
  96. .Ft int
  97. .Fn archive_write_set_format_pax_restricted "struct archive *"
  98. .Ft int
  99. .Fn archive_write_set_format_raw "struct archive *"
  100. .Ft int
  101. .Fn archive_write_set_format_shar "struct archive *"
  102. .Ft int
  103. .Fn archive_write_set_format_shar_dump "struct archive *"
  104. .Ft int
  105. .Fn archive_write_set_format_ustar "struct archive *"
  106. .Ft int
  107. .Fn archive_write_set_format_v7tar "struct archive *"
  108. .Ft int
  109. .Fn archive_write_set_format_warc "struct archive *"
  110. .Ft int
  111. .Fn archive_write_set_format_xar "struct archive *"
  112. .Ft int
  113. .Fn archive_write_set_format_zip "struct archive *"
  114. .Sh DESCRIPTION
  115. These functions set the format that will be used for the archive.
  116. .Pp
  117. The library can write a variety of common archive formats.
  118. .Bl -tag -width indent
  119. .It Fn archive_write_set_format
  120. Sets the format based on the format code (see
  121. .Pa archive.h
  122. for the full list of format codes).
  123. In particular, this can be used in conjunction with
  124. .Fn archive_format
  125. to create a new archive with the same format as an existing archive.
  126. .It Fn archive_write_set_format_by_name
  127. Sets the corresponding format based on the common name.
  128. .It Xo
  129. .Fn archive_write_set_format_filter_by_ext
  130. .Fn archive_write_set_format_filter_by_ext_def
  131. .Xc
  132. Sets both filters and format based on the output filename.
  133. Supported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar, .tgz, .tar.gz, .tar.bz2, .tar.xz
  134. .It Xo
  135. .Fn archive_write_set_format_7zip
  136. .Fn archive_write_set_format_ar_bsd
  137. .Fn archive_write_set_format_ar_svr4
  138. .Fn archive_write_set_format_cpio
  139. .Fn archive_write_set_format_cpio_bin
  140. .Fn archive_write_set_format_cpio_newc
  141. .Fn archive_write_set_format_cpio_odc
  142. .Fn archive_write_set_format_cpio_pwb
  143. .Fn archive_write_set_format_gnutar
  144. .Fn archive_write_set_format_iso9660
  145. .Fn archive_write_set_format_mtree
  146. .Fn archive_write_set_format_mtree_classic
  147. .Fn archive_write_set_format_pax
  148. .Fn archive_write_set_format_pax_restricted
  149. .Fn archive_write_set_format_raw
  150. .Fn archive_write_set_format_shar
  151. .Fn archive_write_set_format_shar_dump
  152. .Fn archive_write_set_format_ustar
  153. .Fn archive_write_set_format_v7tar
  154. .Fn archive_write_set_format_warc
  155. .Fn archive_write_set_format_xar
  156. .Fn archive_write_set_format_zip
  157. .Xc
  158. Set the format as specified.
  159. More details on the formats supported by libarchive can be found in the
  160. .Xr libarchive-formats 5
  161. manual page.
  162. .El
  163. .\"
  164. .Sh RETURN VALUES
  165. These functions return
  166. .Cm ARCHIVE_OK
  167. on success, or
  168. .Cm ARCHIVE_FATAL .
  169. .\"
  170. .Sh ERRORS
  171. Detailed error codes and textual descriptions are available from the
  172. .Fn archive_errno
  173. and
  174. .Fn archive_error_string
  175. functions.
  176. .\"
  177. .Sh SEE ALSO
  178. .Xr tar 1 ,
  179. .Xr archive_write 3 ,
  180. .Xr archive_write_set_options 3 ,
  181. .Xr libarchive 3 ,
  182. .Xr cpio 5 ,
  183. .Xr libarchive-formats 5 ,
  184. .Xr mtree 5 ,
  185. .Xr tar 5