blob: cb68b73f32f6e8ab5f30c2fb806a49aa99a23246 [file] [log] [blame]
Thomas Klausner4c1db352014-11-18 14:58:31 +01001.\" zip_source_stat.mdoc -- get information about zip source
2.\" Copyright (C) 2014 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 18, 2014
33.Dt ZIP_SOURCE_STAT 3
34.Os
35.Sh NAME
36.Nm zip_source_stat
37.Nd get information about zip_source
38.Sh LIBRARY
39libzip (-lzip)
40.Sh SYNOPSIS
41.In zip.h
42.Ft int
Thomas Klausner50337cb2014-11-18 15:35:30 +010043.Fn zip_source_stat "zip_source_t *source" "zip_stat_t *sb"
Thomas Klausner4c1db352014-11-18 14:58:31 +010044.Sh DESCRIPTION
45The
46.Fn zip_source_stat
47function obtains information about the zip source
Thomas Klausner50337cb2014-11-18 15:35:30 +010048.Ar source
Thomas Klausner4c1db352014-11-18 14:58:31 +010049.Pp
50The
51.Ar sb
52argument is a pointer to a
53.Ft struct zip_source_stat
54(shown below), into which information about the zip source is placed.
55.Bd -literal
56struct zip_source_stat {
57 zip_uint64_t valid; /* which fields have valid values */
58 const char *name; /* name of the file */
59 zip_uint64_t index; /* index within archive */
60 zip_uint64_t size; /* size of file (uncompressed) */
61 zip_uint64_t comp_size; /* size of file (compressed) */
62 time_t mtime; /* modification time */
63 zip_uint32_t crc; /* crc of file data */
64 zip_uint16_t comp_method; /* compression method used */
65 zip_uint16_t encryption_method; /* encryption method used */
66 zip_uint32_t flags; /* reserved for future use */
67};
68.Ed
69The structure pointed to by
70.Ar sb
Thomas Klausner50337cb2014-11-18 15:35:30 +010071must be initialized with
72.Fn zip_stat_init 3
73before calling
Thomas Klausner4c1db352014-11-18 14:58:31 +010074.Fn zip_source_stat .
75.Pp
76The
77.Ar valid
78field of the structure specifies which other fields are valid.
79Check if the flag defined by the following defines are in
80.Ar valid
81before accessing the fields:
82.Bl -tag -width ZIP_SOURCE_STAT_ENCRYPTION_METHODXX -compact -offset indent
83.It Dv ZIP_SOURCE_STAT_NAME
84.Ar name
85.It Dv ZIP_SOURCE_STAT_INDEX
86.Ar index
87.It Dv ZIP_SOURCE_STAT_SIZE
88.Ar size
89.It Dv ZIP_SOURCE_STAT_COMP_SIZE
90.Ar comp_size
91.It Dv ZIP_SOURCE_STAT_MTIME
92.Ar mtime
93.It Dv ZIP_SOURCE_STAT_CRC
94.Ar crc
95.It Dv ZIP_SOURCE_STAT_COMP_METHOD
96.Ar comp_method
97.It Dv ZIP_SOURCE_STAT_ENCRYPTION_METHOD
98.Ar encryption_method
99.It Dv ZIP_SOURCE_STAT_FLAGS
100.Ar flags
101.El
102.Pp
103.Em NOTE :
104Some fields may only be filled out after all data has been read from
105the source, for example the
106.Ar crc
107or
108.Ar size
109fields.
110.Sh RETURN VALUES
111Upon successful completion 0 is returned.
112Otherwise, \-1 is returned and the error information in
Thomas Klausner50337cb2014-11-18 15:35:30 +0100113.Ar source
Thomas Klausner4c1db352014-11-18 14:58:31 +0100114is set to indicate the error.
115.Sh SEE ALSO
116.Xr libzip 3 ,
117.Xr zip_source 3
118.Sh AUTHORS
119.An -nosplit
120.An Dieter Baron Aq Mt dillo@nih.at
121and
122.An Thomas Klausner Aq Mt tk@giga.or.at