blob: 4a01fa256e7f73827c12fe19b0c545b27b8ad415 [file] [log] [blame]
Dieter Baron973b5dc2003-10-06 02:52:23 +00001.\" Converted with mdoc2man 0.2
Thomas Klausner3dd81d82005-06-09 19:01:53 +00002.\" from NiH: zip_stat.mdoc,v 1.4 2005/06/09 18:50:27 wiz Exp
3.\" $NiH: zip_stat.mdoc,v 1.4 2005/06/09 18:50:27 wiz Exp $
Dieter Baron973b5dc2003-10-06 02:52:23 +00004.\"
Thomas Klausner201d1b22003-12-27 22:51:30 +00005.\" zip_stat.mdoc \-- get information about file
Dieter Baronb2ed74d2004-04-14 14:01:31 +00006.\" Copyright (C) 2003, 2004 Dieter Baron and Thomas Klausner
Dieter Baron973b5dc2003-10-06 02:52:23 +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.\"
Dieter Baronb2ed74d2004-04-14 14:01:31 +000036.TH ZIP_STAT 3 "April 14, 2004" NiH
Dieter Baron973b5dc2003-10-06 02:52:23 +000037.SH "NAME"
38zip_stat , \- .Nm zip_stat_index
39get information about file
40.SH "LIBRARY"
Thomas Klausner201d1b22003-12-27 22:51:30 +000041libzip (-lzip)
Dieter Baron973b5dc2003-10-06 02:52:23 +000042.SH "SYNOPSIS"
43.In zip.h
44.Ft int
Dieter Baronb2ed74d2004-04-14 14:01:31 +000045.Fn zip_stat "struct zip *archive" "const char *fname" "int flags" "struct zip_stat *sb"
Dieter Baron973b5dc2003-10-06 02:52:23 +000046.Ft int
Dieter Baronb2ed74d2004-04-14 14:01:31 +000047.Fn zip_stat_index "struct zip *archive" "int index" "int flags" "struct zip_stat *sb"
Dieter Baron973b5dc2003-10-06 02:52:23 +000048.SH "DESCRIPTION"
49The
50.Fn zip_stat
51function obtains information about the file named
52\fBfname\fR
53in
54\fBarchive.\fR
55The
56\fBflags\fR
57argument specifies how the name lookup should be done.
58Its values are described in
59zip_name_locate(3).
Dieter Baronb2ed74d2004-04-14 14:01:31 +000060Also,
Thomas Klausner6b4002c2005-05-20 22:00:03 +000061\fBZIP_FL_UNCHANGED\fR
Dieter Baronb2ed74d2004-04-14 14:01:31 +000062may be
Thomas Klausner6b4002c2005-05-20 22:00:03 +000063.I or'ed
Dieter Baronb2ed74d2004-04-14 14:01:31 +000064to it to request information about the original file in the archive,
65ignoring any changes made.
Dieter Baron973b5dc2003-10-06 02:52:23 +000066.PP
67The
68.Fn zip_stat_index
69function obtains information about the file at position
70\fBindex.\fR
71.PP
72The
73\fBsb\fR
74argument is a pointer to a
75.Ft struct zip_stat
76(shown below), into which information about the file is placed.
77.Bd \-literal
78struct zip_stat {
79 const char *name; /* name of the file */
80 int index; /* index within archive */
81 unsigned int crc; /* crc of file data */
82 unsigned int size; /* size of file (uncompressed) */
83 time_t mtime; /* modification time */
84 unsigned int comp_size; /* size of file (compressed) */
85 unsigned short comp_method; /* compression method used */
86};
87.SH "RETURN VALUES"
88Upon successful completion 0 is returned.
Thomas Klausner201d1b22003-12-27 22:51:30 +000089Otherwise, \-1 is returned and the error information in
Dieter Baron973b5dc2003-10-06 02:52:23 +000090\fBarchive\fR
91is set to indicate the error.
92.SH "ERRORS"
93The function
94.Fn zip_stat
95can fail for any of the errors specified for the routine
96zip_name_locate(3).
97.PP
98The function
99.Fn zip_stata_index
100fails and sets the error information to
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000101.Er ZIP_ER_INVAL
Dieter Baron973b5dc2003-10-06 02:52:23 +0000102if
103\fBindex\fR
104is invalid.
Thomas Klausnerd0147e92004-11-17 21:55:17 +0000105.\" XXX: ZIP_ER_CHANGED
Dieter Baron973b5dc2003-10-06 02:52:23 +0000106.SH "SEE ALSO"
Thomas Klausner3dd81d82005-06-09 19:01:53 +0000107libzip(3),
Dieter Baron973b5dc2003-10-06 02:52:23 +0000108zip_name_locate(3)