1zzip_disk_findfile(3)        zziplib Function List       zzip_disk_findfile(3)
2
3
4

NAME

6       zzip_disk_findfile, zzip_disk_findfirst, zzip_disk_findnext,
7       zzip_disk_findmatch -  search for files in the (mmapped) zip central
8       directory
9

SYNOPSIS

11       #include <zzip/mmapped.h>
12
13
14       struct zzip_disk_entry *
15       zzip_disk_findfile(ZZIP_DISK * disk, char *filename,
16                          struct zzip_disk_entry *after, zzip_strcmp_fn_t compare)
17
18       struct zzip_disk_entry *
19       zzip_disk_findfirst(ZZIP_DISK * disk)
20
21       struct zzip_disk_entry *
22       zzip_disk_findnext(ZZIP_DISK * disk, struct zzip_disk_entry *entry)
23
24       struct zzip_disk_entry *
25       zzip_disk_findmatch(ZZIP_DISK * disk, char *filespec,
26                           struct zzip_disk_entry *after,
27                           zzip_fnmatch_fn_t compare, int flags)
28
29
30
31

DESCRIPTION

33        The zzip_disk_findfile function is given a filename as an additional
34       argument, to find the disk_entry matching a given filename. The
35       compare-function is usually strcmp or strcasecmp or perhaps strcoll, if
36       null then strcmp is used. - use null as argument for "after"-entry when
37       searching the first matching entry, otherwise the last returned value
38       if you look for other entries with a special "compare" function (if
39       null then a doubled search is rather useless with this variant of
40       _findfile).
41
42        The zzip_disk_findfile functionreturns the entry pointer. The
43       zzip_disk_findfile function may return null on error. (errno =
44       ENOMEM|EBADMSG|ENOENT)
45
46        The zzip_disk_findfirst function is the first call of all the zip
47       access functions here. It contains the code to find the first entry of
48       the zip central directory. Here we require the mmapped block to
49       represent a real zip file where the disk_trailer is _last_ in the file
50       area, so that its position would be at a fixed offset from the end of
51       the file area if not for the comment field allowed to be of variable
52       length (which needs us to do a little search for the disk_tailer).
53       However, in this simple implementation we disregard any disk_trailer
54       info telling about multidisk archives, so we just return a pointer to
55       the zip central directory.
56
57        For an actual means, we are going to search backwards from the end of
58       the mmaped block looking for the PK-magic signature of a disk_trailer.
59       If we see one then we check the rootseek value to find the first
60       disk_entry of the root central directory. If we find the correct PK-
61       magic signature of a disk_entry over there then we assume we are done
62       and we are going to return a pointer to that label.
63
64        The return value is a pointer to the first zzip_disk_entry being
65       checked to be within the bounds of the file area specified by the
66       arguments. If no disk_trailer was found then null is returned, and
67       likewise we only accept a disk_trailer with a seekvalue that points to
68       a disk_entry and both parts have valid PK-magic parts. Beyond some
69       sanity check we try to catch a common brokeness with zip archives that
70       still allows us to find the start of the zip central directory.So the
71       zzip_disk_findfirst function may return null and sets errno.
72
73        The zzip_disk_findnext function takes an existing disk_entry in the
74       central root directory (e.g. from zzip_disk_findfirst) and returns the
75       next entry within in the given bounds of the mmapped file area.
76
77        The zzip_disk_findnext function returns null if no next entry can be
78       found. The zzip_disk_findnext function may return null on errors.
79       (errno = ENOENT|EINVAL|EBADMSG)
80
81        The zzip_disk_findmatch function uses a compare-function with an
82       additional argument and it is called just like fnmatch(3) from POSIX.2
83       AD:1993), i.e. the argument filespec first and the ziplocal filename
84       second with the integer-flags put in as third to the indirect call. If
85       the platform has fnmatch available then null-compare will use that one
86       and otherwise we fall back to mere strcmp, so if you need fnmatch
87       searching then please provide an implementation somewhere else. - use
88       null as argument for "after"-entry when searching the first matching
89       entry, or the last disk_entry return-value to find the next entry
90       matching the given filespec.
91
92        The zzip_disk_findmatch function will return the matching entry
93       pointer. The zzip_disk_findmatch function may return null on error.
94       (errno = ENOMEM|EBADMSG|ENOENT)
95
96
97

AUTHOR

99        Guido Draheim <guidod@gmx.de>
100
101
102
104        Copyright (c)Guido Draheim, use under copyleft (LGPL,MPL)
105
106
107
108
109
110zziplib                             0.13.72              zzip_disk_findfile(3)
Impressum