Imported Upstream version 1.4.0
[platform/upstream/libzip.git] / man / zip_source_zip.man
1 .TH "ZIP_SOURCE_ZIP" "3" "December 18, 2017" "NiH" "Library Functions Manual"
2 .nh
3 .if n .ad l
4 .SH "NAME"
5 \fBzip_source_zip\fR
6 \- create data source from zip file
7 .SH "LIBRARY"
8 libzip (-lzip)
9 .SH "SYNOPSIS"
10 \fB#include <zip.h>\fR
11 .sp
12 \fIzip_source_t *\fR
13 .br
14 .PD 0
15 .HP 4n
16 \fBzip_source_zip\fR(\fIzip_t\ *archive\fR, \fIzip_t\ *srcarchive\fR, \fIzip_uint64_t\ srcidx\fR, \fIzip_flags_t\ flags\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
17 .PD
18 .SH "DESCRIPTION"
19 The function
20 \fBzip_source_zip\fR()
21 creates a zip source from a file in a zip archive.
22 The
23 \fIsrcarchive\fR
24 argument is the (open) zip archive containing the source zip file
25 at index
26 \fIsrcidx\fR.
27 \fIlen\fR
28 bytes from offset
29 \fIstart\fR
30 will be used in the zip_source.
31 If
32 \fIlen\fR
33 is 0 or \-1, the rest of the file, starting from
34 \fIstart\fR,
35 is used.
36 If
37 \fIstart\fR
38 is zero and
39 \fIlen\fR
40 is \-1, the whole file will be copied without decompressing it.
41 .PP
42 Supported flags are:
43 .TP 23n
44 \fRZIP_FL_UNCHANGED\fR
45 Try to get the original data without any changes that may have been
46 made to
47 \fIsrcarchive\fR
48 after opening it.
49 .TP 23n
50 \fRZIP_FL_RECOMPRESS\fR
51 When adding the data from
52 \fIsrcarchive\fR,
53 re-compress it using the current settings instead of copying the
54 compressed data.
55 .SH "RETURN VALUES"
56 Upon successful completion, the created source is returned.
57 Otherwise,
58 \fRNULL\fR
59 is returned and the error code in
60 \fIarchive\fR
61 is set to indicate the error.
62 .SH "ERRORS"
63 \fBzip_source_zip\fR()
64 fails if:
65 .TP 19n
66 [\fRZIP_ER_CHANGED\fR]
67 Unchanged data was requested, but it is not available.
68 .TP 19n
69 [\fRZIP_ER_INVAL\fR]
70 \fIsrcarchive\fR,
71 \fIsrcidx\fR,
72 \fIstart\fR,
73 or
74 \fIlen\fR
75 are invalid.
76 .TP 19n
77 [\fRZIP_ER_MEMORY\fR]
78 Required memory could not be allocated.
79 .PD 0
80 .PP
81 Additionally, it can return all error codes from
82 \fBzip_stat_index\fR()
83 and
84 \fBzip_fopen_index\fR().
85 .PD
86 .SH "SEE ALSO"
87 libzip(3),
88 zip_add(3),
89 zip_replace(3),
90 zip_source(3)
91 .SH "HISTORY"
92 \fBzip_source_zip\fR()
93 was added in libzip 1.0.
94 .SH "AUTHORS"
95 Dieter Baron <\fIdillo@nih.at\fR>
96 and
97 Thomas Klausner <\fItk@giga.or.at\fR>