Deleted Added
full compact
archive_write.3 (228763) archive_write.3 (228773)
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.

--- 8 unchanged lines hidden (view full) ---

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.\"
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.

--- 8 unchanged lines hidden (view full) ---

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: head/contrib/libarchive/libarchive/archive_write.3 228763 2011-12-21 11:13:29Z mm $
25.\" $FreeBSD: head/contrib/libarchive/libarchive/archive_write.3 228773 2011-12-21 15:18:52Z mm $
26.\"
27.Dd May 11, 2008
26.\"
27.Dd May 11, 2008
28.Dt archive_write 3
28.Dt ARCHIVE_WRITE 3
29.Os
30.Sh NAME
31.Nm archive_write_new ,
32.Nm archive_write_set_format_cpio ,
33.Nm archive_write_set_format_pax ,
34.Nm archive_write_set_format_pax_restricted ,
35.Nm archive_write_set_format_shar ,
36.Nm archive_write_set_format_shar_binary ,

--- 13 unchanged lines hidden (view full) ---

50.Nm archive_write_open_fd ,
51.Nm archive_write_open_FILE ,
52.Nm archive_write_open_filename ,
53.Nm archive_write_open_memory ,
54.Nm archive_write_header ,
55.Nm archive_write_data ,
56.Nm archive_write_finish_entry ,
57.Nm archive_write_close ,
29.Os
30.Sh NAME
31.Nm archive_write_new ,
32.Nm archive_write_set_format_cpio ,
33.Nm archive_write_set_format_pax ,
34.Nm archive_write_set_format_pax_restricted ,
35.Nm archive_write_set_format_shar ,
36.Nm archive_write_set_format_shar_binary ,

--- 13 unchanged lines hidden (view full) ---

50.Nm archive_write_open_fd ,
51.Nm archive_write_open_FILE ,
52.Nm archive_write_open_filename ,
53.Nm archive_write_open_memory ,
54.Nm archive_write_header ,
55.Nm archive_write_data ,
56.Nm archive_write_finish_entry ,
57.Nm archive_write_close ,
58.Nm archive_write_finish
58.Nm archive_write_free
59.Nd functions for creating archives
60.Sh SYNOPSIS
61.In archive.h
62.Ft struct archive *
63.Fn archive_write_new "void"
64.Ft int
65.Fn archive_write_get_bytes_per_block "struct archive *"
66.Ft int

--- 53 unchanged lines hidden (view full) ---

120.Fn archive_write_header "struct archive *" "struct archive_entry *"
121.Ft ssize_t
122.Fn archive_write_data "struct archive *" "const void *" "size_t"
123.Ft int
124.Fn archive_write_finish_entry "struct archive *"
125.Ft int
126.Fn archive_write_close "struct archive *"
127.Ft int
59.Nd functions for creating archives
60.Sh SYNOPSIS
61.In archive.h
62.Ft struct archive *
63.Fn archive_write_new "void"
64.Ft int
65.Fn archive_write_get_bytes_per_block "struct archive *"
66.Ft int

--- 53 unchanged lines hidden (view full) ---

120.Fn archive_write_header "struct archive *" "struct archive_entry *"
121.Ft ssize_t
122.Fn archive_write_data "struct archive *" "const void *" "size_t"
123.Ft int
124.Fn archive_write_finish_entry "struct archive *"
125.Ft int
126.Fn archive_write_close "struct archive *"
127.Ft int
128.Fn archive_write_finish "struct archive *"
128.Fn archive_write_free "struct archive *"
129.Sh DESCRIPTION
130These functions provide a complete API for creating streaming
131archive files.
132The general process is to first create the
133.Tn struct archive
134object, set any desired options, initialize the archive, append entries, then
135close the archive and release all resources.
136The following summary describes the functions in approximately

--- 221 unchanged lines hidden (view full) ---

358Ordinarily, clients never need to call this, as it
359is called automatically by
360.Fn archive_write_next_header
361and
362.Fn archive_write_close
363as needed.
364.It Fn archive_write_close
365Complete the archive and invoke the close callback.
129.Sh DESCRIPTION
130These functions provide a complete API for creating streaming
131archive files.
132The general process is to first create the
133.Tn struct archive
134object, set any desired options, initialize the archive, append entries, then
135close the archive and release all resources.
136The following summary describes the functions in approximately

--- 221 unchanged lines hidden (view full) ---

358Ordinarily, clients never need to call this, as it
359is called automatically by
360.Fn archive_write_next_header
361and
362.Fn archive_write_close
363as needed.
364.It Fn archive_write_close
365Complete the archive and invoke the close callback.
366.It Fn archive_write_finish
366.It Fn archive_write_free
367Invokes
368.Fn archive_write_close
367Invokes
368.Fn archive_write_close
369if it was not invoked manually, then releases all resources.
370Note that this function was declared to return
371.Ft void
372in libarchive 1.x, which made it impossible to detect errors when
369if necessary, then releases all resources.
370If you need detailed information about
373.Fn archive_write_close
371.Fn archive_write_close
374was invoked implicitly from this function.
375This is corrected beginning with libarchive 2.0.
372failures, you should be careful to call it separately, as
373you cannot obtain error information after
374.Fn archive_write_free
375returns.
376.El
377More information about the
378.Va struct archive
379object and the overall design of the library can be found in the
380.Xr libarchive 3
381overview.
382.Sh IMPLEMENTATION
383Compression support is built-in to libarchive, which uses zlib and bzlib

--- 140 unchanged lines hidden (view full) ---

524 len = read(fd, buff, sizeof(buff));
525 while ( len > 0 ) {
526 archive_write_data(a, buff, len);
527 len = read(fd, buff, sizeof(buff));
528 }
529 archive_entry_free(entry);
530 filename++;
531 }
376.El
377More information about the
378.Va struct archive
379object and the overall design of the library can be found in the
380.Xr libarchive 3
381overview.
382.Sh IMPLEMENTATION
383Compression support is built-in to libarchive, which uses zlib and bzlib

--- 140 unchanged lines hidden (view full) ---

524 len = read(fd, buff, sizeof(buff));
525 while ( len > 0 ) {
526 archive_write_data(a, buff, len);
527 len = read(fd, buff, sizeof(buff));
528 }
529 archive_entry_free(entry);
530 filename++;
531 }
532 archive_write_finish(a);
532 archive_write_free(a);
533}
534
535int main(int argc, const char **argv)
536{
537 const char *outname;
538 argv++;
539 outname = argv++;
540 write_archive(outname, argv);

--- 34 unchanged lines hidden (view full) ---

575Note that if the client-provided write callback function
576returns a non-zero value, that error will be propagated back to the caller
577through whatever API function resulted in that call, which
578may include
579.Fn archive_write_header ,
580.Fn archive_write_data ,
581.Fn archive_write_close ,
582or
533}
534
535int main(int argc, const char **argv)
536{
537 const char *outname;
538 argv++;
539 outname = argv++;
540 write_archive(outname, argv);

--- 34 unchanged lines hidden (view full) ---

575Note that if the client-provided write callback function
576returns a non-zero value, that error will be propagated back to the caller
577through whatever API function resulted in that call, which
578may include
579.Fn archive_write_header ,
580.Fn archive_write_data ,
581.Fn archive_write_close ,
582or
583.Fn archive_write_finish .
583.Fn archive_write_free .
584The client callback can call
585.Fn archive_set_error
586to provide values that can then be retrieved by
587.Fn archive_errno
588and
589.Fn archive_error_string .
590.Sh SEE ALSO
591.Xr tar 1 ,

--- 38 unchanged lines hidden ---
584The client callback can call
585.Fn archive_set_error
586to provide values that can then be retrieved by
587.Fn archive_errno
588and
589.Fn archive_error_string .
590.Sh SEE ALSO
591.Xr tar 1 ,

--- 38 unchanged lines hidden ---