blob: 6cb7a9f7e443429f1e3a5617c1e47cc79974ffc1 [file] [log] [blame]
Thomas Klausner37ca2c62018-04-10 12:40:44 +02001<!DOCTYPE html>
2<html>
Thomas Klausner0001d262018-04-14 22:34:06 +02003<!-- This is an automatically generated file. Do not edit.
4 zip_source_file.mdoc -- create data source from a file
Thomas Klausner8c8c26f2021-06-18 11:33:49 +02005 Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
Thomas Klausner0001d262018-04-14 22:34:06 +02006
7 This file is part of libzip, a library to manipulate ZIP archives.
8 The authors can be contacted at <libzip@nih.at>
9
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions
12 are met:
13 1. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in
17 the documentation and/or other materials provided with the
18 distribution.
19 3. The names of the authors may not be used to endorse or promote
20 products derived from this software without specific prior
21 written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
24 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
31 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 -->
Thomas Klausner37ca2c62018-04-10 12:40:44 +020035<head>
36 <meta charset="utf-8"/>
Thomas Klausner37ca2c62018-04-10 12:40:44 +020037 <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/>
38 <title>ZIP_SOURCE_FILE(3)</title>
39</head>
40<body>
41<table class="head">
42 <tr>
43 <td class="head-ltitle">ZIP_SOURCE_FILE(3)</td>
44 <td class="head-vol">Library Functions Manual</td>
45 <td class="head-rtitle">ZIP_SOURCE_FILE(3)</td>
46 </tr>
47</table>
48<div class="manual-text">
Thomas Klausner8fb14f92019-03-12 12:44:02 +010049<section class="Sh">
50<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
51<code class="Nm">zip_source_file</code>,
52 <code class="Nm">zip_source_file_create</code> &#x2014;
53<div class="Nd">create data source from a file</div>
54</section>
55<section class="Sh">
56<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
Thomas Klausner37ca2c62018-04-10 12:40:44 +020057libzip (-lzip)
Thomas Klausner8fb14f92019-03-12 12:44:02 +010058</section>
59<section class="Sh">
60<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
61<code class="In">#include &lt;<a class="In">zip.h</a>&gt;</code>
62<p class="Pp"><var class="Ft">zip_source_t *</var>
63 <br/>
64 <code class="Fn">zip_source_file</code>(<var class="Fa" style="white-space: nowrap;">zip_t
65 *archive</var>, <var class="Fa" style="white-space: nowrap;">const char
66 *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t
67 start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t
68 len</var>);</p>
69<p class="Pp"><var class="Ft">zip_source_t *</var>
70 <br/>
71 <code class="Fn">zip_source_file_create</code>(<var class="Fa" style="white-space: nowrap;">const
72 char *fname</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t
73 start</var>, <var class="Fa" style="white-space: nowrap;">zip_int64_t
74 len</var>, <var class="Fa" style="white-space: nowrap;">zip_error_t
75 *error</var>);</p>
76</section>
77<section class="Sh">
78<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
79The functions <code class="Fn">zip_source_file</code>() and
80 <code class="Fn">zip_source_file_create</code>() create a zip source from a
81 file. They open <var class="Ar">fname</var> and read <var class="Ar">len</var>
82 bytes from offset <var class="Ar">start</var> from it. If
83 <var class="Ar">len</var> is 0 or -1, the whole file (starting from
84 <var class="Ar">start</var>) is used.
85<p class="Pp">If the file supports seek, the source can be used to open a zip
86 archive from.</p>
87<p class="Pp">The file is opened and read when the data from the source is used,
88 usually by <code class="Fn">zip_close</code>() or
89 <code class="Fn">zip_open_from_source</code>().</p>
90</section>
91<section class="Sh">
92<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
Thomas Klausner0001d262018-04-14 22:34:06 +020093 VALUES</a></h1>
Thomas Klausner37ca2c62018-04-10 12:40:44 +020094Upon successful completion, the created source is returned. Otherwise,
Thomas Klausner8fb14f92019-03-12 12:44:02 +010095 <code class="Dv">NULL</code> is returned and the error code in
96 <var class="Ar">archive</var> or <var class="Ar">error</var> is set to
97 indicate the error.
98</section>
99<section class="Sh">
100<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
101<code class="Fn">zip_source_file</code>() and
102 <code class="Fn">zip_source_file_create</code>() fail if:
Thomas Klausnerff556822018-12-23 19:58:03 +0100103<dl class="Bl-tag">
Thomas Klausner8fb14f92019-03-12 12:44:02 +0100104 <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt>
105 <dd><var class="Ar">fname</var>, <var class="Ar">start</var>, or
106 <var class="Ar">len</var> are invalid.</dd>
107 <dt>[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er" id="ZIP_ER_MEMORY">ZIP_ER_MEMORY</code></a>]</dt>
Thomas Klausnerd4ec9862018-05-19 20:35:35 +0200108 <dd>Required memory could not be allocated.</dd>
Thomas Klausner8fb14f92019-03-12 12:44:02 +0100109 <dt>[<a class="permalink" href="#ZIP_ER_OPEN"><code class="Er" id="ZIP_ER_OPEN">ZIP_ER_OPEN</code></a>]</dt>
110 <dd>Opening <var class="Ar">fname</var> failed.</dd>
Thomas Klausner37ca2c62018-04-10 12:40:44 +0200111</dl>
Thomas Klausner8fb14f92019-03-12 12:44:02 +0100112</section>
113<section class="Sh">
114<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
Thomas Klausner0001d262018-04-14 22:34:06 +0200115 ALSO</a></h1>
Thomas Klausner8fb14f92019-03-12 12:44:02 +0100116<a class="Xr" href="libzip.html">libzip(3)</a>,
117 <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>,
118 <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>,
119 <a class="Xr" href="zip_source.html">zip_source(3)</a>
120</section>
121<section class="Sh">
122<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
123<code class="Fn">zip_source_file</code>() and
124 <code class="Fn">zip_source_file_create</code>() were added in libzip 1.0.
125</section>
126<section class="Sh">
127<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
128<span class="An">Dieter Baron</span>
129 &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
130 <span class="An">Thomas Klausner</span>
131 &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
132</section>
133</div>
Thomas Klausner37ca2c62018-04-10 12:40:44 +0200134<table class="foot">
135 <tr>
136 <td class="foot-date">December 18, 2017</td>
Thomas Klausner6aecb022020-07-11 10:38:46 +0200137 <td class="foot-os">NiH</td>
Thomas Klausner37ca2c62018-04-10 12:40:44 +0200138 </tr>
139</table>
140</body>
141</html>