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

NAME

4     zip_name_locate — get index of file by name
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     zip_int64_t
13     zip_name_locate(zip_t *archive, const char *fname, zip_flags_t flags);
14

DESCRIPTION

16     The zip_name_locate() function returns the index of the file named fname
17     in archive.  If archive does not contain a file with that name, -1 is re‐
18     turned.  The flags are specified by or'ing the following values, or 0 for
19     none of them.
20
21           ZIP_FL_NOCASE  Ignore case distinctions.  (Will only work well if
22                          the file names are ASCII.)  With this flag,
23                          zip_name_locate() will be slow for archives with
24                          many files.
25
26           ZIP_FL_NODIR   Ignore directory part of file name in archive.  With
27                          this flag, zip_name_locate() will be slow for ar‐
28                          chives with many files.
29
30           ZIP_FL_ENC_RAW
31                          Compare against the unmodified names as it is in the
32                          ZIP archive.
33
34           ZIP_FL_ENC_GUESS
35                          (Default.)  Guess the encoding of the name in the
36                          ZIP archive and convert it to UTF-8, if necessary,
37                          before comparing.  (Only CP-437 and UTF-8 are recog‐
38                          nized.)
39
40           ZIP_FL_ENC_STRICT
41                          Follow the ZIP specification and expect CP-437 en‐
42                          coded names in the ZIP archive (except if they are
43                          explicitly marked as UTF-8).  Convert it to UTF-8
44                          before comparing.
45     Note: ASCII is a subset of both CP-437 and UTF-8.
46

RETURN VALUES

48     zip_name_locate() returns the index of the file named fname or -1, if
49     archive does not contain an entry of that name.
50

ERRORS

52     zip_name_locate() fails if:
53
54     [ZIP_ER_INVAL]     One of the arguments is invalid.
55
56     [ZIP_ER_MEMORY]    Required memory could not be allocated.
57
58     [ZIP_ER_NOENT]     No entry of the name fname is found in the archive.
59

SEE ALSO

61     libzip(3), zip_get_name(3)
62

HISTORY

64     zip_name_locate() was added in libzip 0.6.  In libzip 0.11 the return
65     type was changed from int to zip_int64_t.  In libzip 0.11 the type of
66     flags was changed from int to zip_flags_t.
67

AUTHORS

69     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
70
71BSD                           September 22, 2020                           BSD
Impressum