blob: d52ebfe548420cf2b5425116efb7d26ace780057 [file] [log] [blame]
Thomas Klausner41f77502005-05-20 22:01:09 +00001.\" Converted with mdoc2man 0.2
Thomas Klausnerc0735562005-07-20 17:18:13 +00002.\" from NiH: zip_source_zip.mdoc,v 1.7 2005/07/20 17:18:04 wiz Exp
3.\" $NiH: zip_source_zip.mdoc,v 1.7 2005/07/20 17:18:04 wiz Exp $
Thomas Klausner41f77502005-05-20 22:01:09 +00004.\"
5.\" zip_source_zip.mdoc \-- create data source from zip file
Thomas Klausnere8b26942005-06-09 19:52:49 +00006.\" Copyright (C) 2004, 2005 Dieter Baron and Thomas Klausner
Thomas Klausner41f77502005-05-20 22:01:09 +00007.\"
8.\" This file is part of libzip, a library to manipulate ZIP archives.
9.\" The authors can be contacted at <nih@giga.or.at>
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\" notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\" notice, this list of conditions and the following disclaimer in
18.\" the documentation and/or other materials provided with the
19.\" distribution.
20.\" 3. The names of the authors may not be used to endorse or promote
21.\" products derived from this software without specific prior
22.\" written permission.
23.\"
24.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
25.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
28.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
32.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\"
Thomas Klausnerc0735562005-07-20 17:18:13 +000036.TH ZIP_SOURCE_ZIP 3 "July 20, 2005" NiH
Thomas Klausner41f77502005-05-20 22:01:09 +000037.SH "NAME"
38zip_source_zip \- create data source from zip file
39.SH "LIBRARY"
40libzip (-lzip)
41.SH "SYNOPSIS"
42.In zip.h
Thomas Klausnerc0735562005-07-20 17:18:13 +000043.Ft struct zip_source *
Thomas Klausner41f77502005-05-20 22:01:09 +000044.Fn zip_source_zip "struct zip *archive" "struct zip *srcarchive" \
45"int srcidx" "int flags" "off_t start" "off_t len"
46.SH "DESCRIPTION"
47The function
48.Fn zip_source_zip
49creates a zip source from a file in a zip archive.
50The
51\fBsrcarchive\fR
52argument is the (open) zip archive containing the source zip file
53at index
54\fBsrcidx.\fR
55\fBlen\fR
56bytes from offset
57\fBstart\fR
58will be used in the zip_source.
59If
60\fBlen\fR
61is 0 or \-1, the whole file (starting from
62\fBstart )\fR
63is used.
64If
65\fBstart\fR
66is zero and
67\fBlen\fR
68is \-1, the whole file will be copied without decompressing it.
69If
70\fBflags\fR
71is
72\fBZIP_FL_UNCHANGED,\fR
73.Fn zip_source_zip
74will try to get the original data without any changes that may
75have been made to
76\fBsrcarchive\fR
77after opening it.
78.SH "RETURN VALUES"
79Upon successful completion, the created source is returned.
80Otherwise,
81\fBNULL\fR
82is returned and the error code in
83\fBarchive\fR
84is set to indicate the error.
85.SH "ERRORS"
86.Fn zip_source_zip
87fails if:
88.RS
89.TP 4
90Bq Er ZIP_ER_CHANGED
91Unchanged data was requested, but it is not available.
92.TP 4
93Bq Er ZIP_ER_INVAL
94\fBsrcarchive,\fR
95\fBsrcidx,\fR
96\fBstart,\fR
97or
98\fBlen\fR
99are invalid.
100.TP 4
101Bq Er ZIP_ER_MEMORY
102Required memory could not be allocated.
103.RE
104Additionally, it can return all error codes from
105.Fn zip_stat_index
106and
107.Fn zip_fopen_index.
108.SH "SEE ALSO"
Thomas Klausner3dd81d82005-06-09 19:01:53 +0000109libzip(3),
Thomas Klausner41f77502005-05-20 22:01:09 +0000110zip_add(3),
111zip_replace(3),
112zip_source_buffer(3),
113zip_source_file(3),
114zip_source_filep(3),
115zip_source_free(3),
116zip_source_function(3)
Thomas Klausner75330132005-06-17 12:59:06 +0000117.SH "AUTHORS"
118
119Dieter Baron <dillo@giga.or.at>
120and
121Thomas Klausner <tk@giga.or.at>