Imported Upstream version 1.1.3
[platform/upstream/libzip.git] / man / zip_source_stat.man
1 .TH "ZIP_SOURCE_STAT" "3" "November 18, 2014" "NiH" "Library Functions Manual"
2 .nh
3 .if n .ad l
4 .SH "NAME"
5 \fBzip_source_stat\fR
6 \- get information about zip_source
7 .SH "LIBRARY"
8 libzip (-lzip)
9 .SH "SYNOPSIS"
10 \fB#include <zip.h>\fR
11 .sp
12 \fIint\fR
13 .PD 0
14 .HP 4n
15 \fBzip_source_stat\fR(\fIzip_source_t\ *source\fR, \fIzip_stat_t\ *sb\fR);
16 .PD
17 .SH "DESCRIPTION"
18 The
19 \fBzip_source_stat\fR()
20 function obtains information about the zip source
21 \fIsource\fR
22 .PP
23 The
24 \fIsb\fR
25 argument is a pointer to a
26 \fIstruct zip_source_stat\fR
27 (shown below), into which information about the zip source is placed.
28 .nf
29 .sp
30 .RS 0n
31 struct zip_source_stat {
32     zip_uint64_t valid;                 /* which fields have valid values */
33     const char *name;                   /* name of the file */
34     zip_uint64_t index;                 /* index within archive */
35     zip_uint64_t size;                  /* size of file (uncompressed) */
36     zip_uint64_t comp_size;             /* size of file (compressed) */
37     time_t mtime;                       /* modification time */
38     zip_uint32_t crc;                   /* crc of file data */
39     zip_uint16_t comp_method;           /* compression method used */
40     zip_uint16_t encryption_method;     /* encryption method used */
41     zip_uint32_t flags;                 /* reserved for future use */
42 };
43 .RE
44 .fi
45 The structure pointed to by
46 \fIsb\fR
47 must be initialized with
48 \fBzip_stat_init\fR(\fI3\fR)
49 before calling
50 \fBzip_source_stat\fR().
51 .PP
52 The
53 \fIvalid\fR
54 field of the structure specifies which other fields are valid.
55 Check if the flag defined by the following defines are in
56 \fIvalid\fR
57 before accessing the fields:
58 .RS 6n
59 .PD 0
60 .TP 37n
61 \fRZIP_SOURCE_STAT_NAME\fR
62 \fIname\fR
63 .TP 37n
64 \fRZIP_SOURCE_STAT_INDEX\fR
65 \fIindex\fR
66 .TP 37n
67 \fRZIP_SOURCE_STAT_SIZE\fR
68 \fIsize\fR
69 .TP 37n
70 \fRZIP_SOURCE_STAT_COMP_SIZE\fR
71 \fIcomp_size\fR
72 .TP 37n
73 \fRZIP_SOURCE_STAT_MTIME\fR
74 \fImtime\fR
75 .TP 37n
76 \fRZIP_SOURCE_STAT_CRC\fR
77 \fIcrc\fR
78 .TP 37n
79 \fRZIP_SOURCE_STAT_COMP_METHOD\fR
80 \fIcomp_method\fR
81 .TP 37n
82 \fRZIP_SOURCE_STAT_ENCRYPTION_METHOD\fR
83 \fIencryption_method\fR
84 .TP 37n
85 \fRZIP_SOURCE_STAT_FLAGS\fR
86 \fIflags\fR
87 .RE
88 .PD
89 .PP
90 \fINOTE\fR:
91 Some fields may only be filled out after all data has been read from
92 the source, for example the
93 \fIcrc\fR
94 or
95 \fIsize\fR
96 fields.
97 .SH "RETURN VALUES"
98 Upon successful completion 0 is returned.
99 Otherwise, \-1 is returned and the error information in
100 \fIsource\fR
101 is set to indicate the error.
102 .SH "SEE ALSO"
103 libzip(3),
104 zip_source(3)
105 .SH "AUTHORS"
106 Dieter Baron <\fIdillo@nih.at\fR>
107 and
108 Thomas Klausner <\fItk@giga.or.at\fR>