1ZIP_STAT(3)              BSD Library Functions Manual              ZIP_STAT(3)
2

NAME

4     zip_stat, zip_stat_index — get information about file
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     int
13     zip_stat(zip_t *archive, const char *fname, zip_flags_t flags,
14         zip_stat_t *sb);
15
16     int
17     zip_stat_index(zip_t *archive, zip_uint64_t index, zip_flags_t flags,
18         zip_stat_t *sb);
19

DESCRIPTION

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 struct zip_stat (shown below), into
31     which information about the file is placed.
32
33     struct zip_stat {
34         zip_uint64_t valid;                 /* which fields have valid values */
35         const char *name;                   /* name of the file */
36         zip_uint64_t index;                 /* index within archive */
37         zip_uint64_t size;                  /* size of file (uncompressed) */
38         zip_uint64_t comp_size;             /* size of file (compressed) */
39         time_t mtime;                       /* modification time */
40         zip_uint32_t crc;                   /* crc of file data */
41         zip_uint16_t comp_method;           /* compression method used */
42         zip_uint16_t encryption_method;     /* encryption method used */
43         zip_uint32_t flags;                 /* reserved for future use */
44     };
45     The structure pointed to by sb must be allocated before calling
46     zip_stat() or zip_stat_index().
47
48     The valid field of the structure specifies which other fields are valid.
49     Check if the flag defined by the following defines are in valid before
50     accessing the fields:
51           ZIP_STAT_NAME                 name
52           ZIP_STAT_INDEX                index
53           ZIP_STAT_SIZE                 size
54           ZIP_STAT_COMP_SIZE            comp_size
55           ZIP_STAT_MTIME                mtime
56           ZIP_STAT_CRC                  crc
57           ZIP_STAT_COMP_METHOD          comp_method
58           ZIP_STAT_ENCRYPTION_METHOD    encryption_method
59           ZIP_STAT_FLAGS                flags
60

RETURN VALUES

62     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
63     the error information in archive is set to indicate the error.
64

ERRORS

66     The function zip_stat() can fail for any of the errors specified for the
67     routine zip_name_locate(3).
68
69     The function zip_stat_index() fails and sets the error information to
70     ZIP_ER_INVAL if index is invalid.  If ZIP_FL_UNCHANGED is not set and no
71     information can be obtained from the source callback, the error informa‐
72     tion is set to ZIP_ER_CHANGED.
73

SEE ALSO

75     libzip(3), zip_get_num_entries(3), zip_name_locate(3), zip_stat_init(3)
76

HISTORY

78     zip_stat() was added in libzip 0.6.  In libzip 0.11 the type of flags was
79     changed from int to zip_flags_t.
80
81     zip_stat_index() was added in libzip 0.6.  In libzip 0.10 the type of
82     index was changed from int to zip_uint64_t.  In libzip 0.11 the type of
83     flags was changed from int to zip_flags_t.
84

AUTHORS

86     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
87
88BSD                            December 18, 2017                           BSD
Impressum