blob: f7c96f95e7624e42220f0a9c9c13b14bcba65d6c [file] [log] [blame]
Thomas Klausner0001d262018-04-14 22:34:06 +02001.\" Automatically generated from an mdoc input file. Do not edit.
2.\" zip_source_filep.mdoc -- create data source from a file stream
Thomas Klausner8c8c26f2021-06-18 11:33:49 +02003.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
Thomas Klausner0001d262018-04-14 22:34:06 +02004.\"
5.\" This file is part of libzip, a library to manipulate ZIP archives.
6.\" The authors can be contacted at <libzip@nih.at>
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in
15.\" the documentation and/or other materials provided with the
16.\" distribution.
17.\" 3. The names of the authors may not be used to endorse or promote
18.\" products derived from this software without specific prior
19.\" written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
22.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
25.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32.\"
Thomas Klausner7da02272017-12-18 21:50:15 +010033.TH "ZIP_SOURCE_FILEP" "3" "December 18, 2017" "NiH" "Library Functions Manual"
Thomas Klausner4edcedc2017-12-06 12:43:04 +010034.nh
35.if n .ad l
36.SH "NAME"
Thomas Klausner7da02272017-12-18 21:50:15 +010037\fBzip_source_filep\fR,
38\fBzip_source_filep_create\fR
Thomas Klausner4edcedc2017-12-06 12:43:04 +010039\- create data source from FILE *
40.SH "LIBRARY"
41libzip (-lzip)
42.SH "SYNOPSIS"
43\fB#include <zip.h>\fR
44.sp
45\fIzip_source_t *\fR
Thomas Klausner7da02272017-12-18 21:50:15 +010046.br
Thomas Klausner4edcedc2017-12-06 12:43:04 +010047.PD 0
48.HP 4n
49\fBzip_source_filep\fR(\fIzip_t\ *archive\fR, \fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
50.PD
51.PP
52\fIzip_source_t *\fR
Thomas Klausner7da02272017-12-18 21:50:15 +010053.br
Thomas Klausner4edcedc2017-12-06 12:43:04 +010054.PD 0
55.HP 4n
56\fBzip_source_filep_create\fR(\fIFILE\ *file\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
57.PD
58.SH "DESCRIPTION"
59The functions
60\fBzip_source_filep\fR()
61and
62\fBzip_source_filep_create\fR()
63create a zip source from a file stream.
64They read
65\fIlen\fR
66bytes from offset
67\fIstart\fR
68from the open file stream
69\fIfile\fR.
70If
71\fIlen\fR
72is 0 or \-1, the whole file (starting from
73\fIstart\fR)
74is used.
75.PP
76If the file stream supports seeking, the source can be used to open
77a read-only zip archive from.
78.PP
79The file stream is closed when the source is being freed, usually
80by
81zip_close(3).
82.SH "RETURN VALUES"
83Upon successful completion, the created source is returned.
84Otherwise,
85\fRNULL\fR
86is returned and the error code in
87\fIarchive\fR
88or
89\fIerror\fR
90is set to indicate the error.
91.SH "ERRORS"
92\fBzip_source_filep\fR()
93fails if:
94.TP 19n
95[\fRZIP_ER_INVAL\fR]
96\fIfile\fR,
97\fIstart\fR,
98or
99\fIlen\fR
100are invalid.
101.TP 19n
102[\fRZIP_ER_MEMORY\fR]
103Required memory could not be allocated.
104.SH "SEE ALSO"
105libzip(3),
Thomas Klausner4c612cb2018-06-28 08:12:54 +0200106zip_file_add(3),
107zip_file_replace(3),
Thomas Klausner4edcedc2017-12-06 12:43:04 +0100108zip_source(3)
Thomas Klausner7da02272017-12-18 21:50:15 +0100109.SH "HISTORY"
110\fBzip_source_filep\fR()
111and
112\fBzip_source_filep_create\fR()
113were added in libzip 1.0.
Thomas Klausner4edcedc2017-12-06 12:43:04 +0100114.SH "AUTHORS"
115Dieter Baron <\fIdillo@nih.at\fR>
116and
117Thomas Klausner <\fItk@giga.or.at\fR>