Imported Upstream version 1.9.0
[platform/upstream/libzip.git] / man / zip_fseek.mdoc
1 .\" zip_fseek.mdoc -- seek in file
2 .\" Copyright (C) 2016-2022 Dieter Baron and Thomas Klausner
3 .\"
4 .\" This file is part of libzip, a library to manipulate ZIP archives.
5 .\" The authors can be contacted at <libzip@nih.at>
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in
14 .\"    the documentation and/or other materials provided with the
15 .\"    distribution.
16 .\" 3. The names of the authors may not be used to endorse or promote
17 .\"    products derived from this software without specific prior
18 .\"    written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
21 .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
24 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
28 .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 .\"
32 .Dd November 13, 2021
33 .Dt ZIP_FSEEK 3
34 .Os
35 .Sh NAME
36 .Nm zip_fseek ,
37 .Nm zip_file_is_seekable
38 .Nd seek in file
39 .Sh LIBRARY
40 libzip (-lzip)
41 .Sh SYNOPSIS
42 .In zip.h
43 .Ft zip_int8_t
44 .Fn zip_fseek "zip_file_t *file" "zip_int64_t offset" "int whence"
45 .Ft int
46 .Fn zip_file_is_seekable "zip_file_t *file"
47 .Sh DESCRIPTION
48 The
49 .Fn zip_fseek
50 function seeks to the specified
51 .Ar offset
52 relative to
53 .Ar whence ,
54 just like
55 .Xr fseek 3 .
56 .Pp
57 .Nm
58 only works on uncompressed (stored), unencrypted data.
59 When called on compressed or encrypted data it will return an error.
60 .Pp
61 The
62 .Fn zip_file_is_seekable
63 function returns 1 if a file is seekable.
64 .Sh RETURN VALUES
65 If successful,
66 .Fn zip_fseek
67 returns 0.
68 Otherwise, \-1 is returned.
69 .Pp
70 .Fn zip_file_is_seekable
71 returns 1 if a file is seekable and 0 if not.
72 On an invalid argument, it returns \-1.
73 .Sh SEE ALSO
74 .Xr libzip 3 ,
75 .Xr zip_fclose 3 ,
76 .Xr zip_fopen 3 ,
77 .Xr zip_fread 3 ,
78 .Xr zip_ftell 3
79 .Sh HISTORY
80 .Fn zip_fseek
81 was added in libzip 1.2.0.
82 .Fn zip_file_is_seekable
83 was added in libzip 1.9.0.
84 .Sh AUTHORS
85 .An -nosplit
86 .An Dieter Baron Aq Mt dillo@nih.at
87 and
88 .An Thomas Klausner Aq Mt tk@giga.or.at