1ZIP_STAT(3) Library Functions Manual ZIP_STAT(3)
2
3
4
6 zip_stat , - .Nm zip_stat_index get information about file
7
9 libzip (-lzip)
10
12 #include <zip.h>
13
14 int zip_stat(struct zip *archive, const char *fname, int flags, struct
15 zip_stat *sb);
16
17 int zip_stat_index(struct zip *archive, int index, int flags, struct
18 zip_stat *sb);
19
21 The zip_stat function obtains information about the file named fname in
22 archive. The flags argument specifies how the name lookup should be
23 done. Its values are described in zip_name_locate(3). Also,
24 ZIP_FL_UNCHANGED may be or'ed to it to request information about the
25 original file in the archive, ignoring any changes made.
26
27 The zip_stat_index function obtains information about the file at posi‐
28 tion index.
29
30 The sb argument is a pointer to a
31
32 struct zip_stat (shown below), into which information about the file is
33 placed. struct zip_stat {
34 zip_uint64_t valid; /* which fields have valid val‐
35 ues */
36 const char *name; /* name of the file */
37 zip_uint64_t index; /* index within archive */
38 zip_uint64_t size; /* size of file (uncompressed)
39 */
40 zip_uint64_t comp_size; /* size of file (compressed) */
41 time_t mtime; /* modification time */
42 zip_uint32_t crc; /* crc of file data */
43 zip_uint16_t comp_method; /* compression method used */
44 zip_uint16_t encryption_method; /* encryption method used */
45 zip_uint32_t flags; /* reserved for future use */
46 }; The structure pointed to by sb must be allocated before calling
47 zip_stat or zip_stat_index.
48
49 The valid field of the structure specifies which other fields are
50 valid. Check if the flag defined by the following defines are in valid
51 before accessing the fields:
52
53 ZIP_STAT_NAME name
54
55 ZIP_STAT_INDEX index
56
57 ZIP_STAT_SIZE size
58
59 ZIP_STAT_COMP_SIZE comp_size
60
61 ZIP_STAT_MTIME mtime
62
63 ZIP_STAT_CRC crc
64
65 ZIP_STAT_COMP_METHOD comp_method
66
67 ZIP_STAT_ENCRYPTION_METHOD encryption_method
68
69 ZIP_STAT_FLAGS flags
70
72 Upon successful completion 0 is returned. Otherwise, -1 is returned
73 and the error information in archive is set to indicate the error.
74
76 The function zip_stat can fail for any of the errors specified for the
77 routine zip_name_locate(3).
78
79 The function zip_stat_index fails and sets the error information to
80 ZIP_ER_INVAL if index is invalid. If ZIP_FL_UNCHANGED is not set and
81 no information can be obtained from the source callback, the error
82 information is set to ZIP_ER_CHANGED.
83
85 libzip(3), zip_get_num_entries(3), zip_name_locate(3), zip_stat_init(3)
86
88 Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at>
89
90
91
92NiH February 14, 2011 ZIP_STAT(3)