1zzip_open(3) zziplib Function List zzip_open(3)
2
3
4
6 zzip_open, zzip_open_ext_io, zzip_open_shared_io - start usage.
7
9 #include <zzip/lib.h>
10
11
12 ZZIP_FILE *
13 zzip_open(zzip_char_t * filename, int o_flags)
14
15 ZZIP_FILE *
16 zzip_open_ext_io(zzip_char_t * filename, int o_flags, int o_modes,
17 zzip_strings_t * ext, zzip_plugin_io_t io)
18
19 ZZIP_FILE *
20 zzip_open_shared_io(ZZIP_FILE * stream,
21 zzip_char_t * filename, int o_flags, int o_modes,
22 zzip_strings_t * ext, zzip_plugin_io_t io)
23
24
25
26
28 The zzip_open function will open(2) a real/zipped file
29
30 It has some magic functionality builtin - it will first try to open
31 the given <emphasis>filename</emphasis> as a normal file. If it does
32 not exist, the given path to the filename (if any) is split into its
33 directory-part and the file-part. A ".zip" extension is then added to
34 the directory-part to create the name of a zip-archive. That zip-
35 archive (if it exists) is being searched for the file-part, and if
36 found a zzip-handle is returned.
37
38 Note that if the file is found in the normal fs-directory the returned
39 structure is mostly empty and the zzip_read call will use the libc
40 read(2) to obtain data. Otherwise a zzip_file_open is performed and any
41 error mapped to errno(3).
42
43 There was a possibility to transfer zziplib-specific openmodes through
44 o_flags but you should please not use them anymore and look into
45 zzip_open_ext_io to submit them down. The zzip_open function is shallow
46 in that it just extracts the zzipflags and calls
47
48 zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0)
49
50 you must stop using this extra functionality (not well known anyway)
51 since zzip_open might be later usable to open files for writing in
52 which case the _EXTRAFLAGS will get in conflict.
53
54 compare with open(2) and zzip_fopen
55
56 The zzip_open_ext_io function uses explicit ext and io instead of the
57 internal defaults, setting them to zero is equivalent to zzip_open
58
59 note that the two flag types have been split into an o_flags (for
60 fcntl-like openflags) and o_modes where the latter shall carry the
61 zzip_flags and possibly accessmodes for unix filesystems. Since this
62 version of zziplib can not write zipfiles, it is not yet used for
63 anything else than zzip-specific modeflags.
64
65 The zzip_open_ext_io function returns a new zzip-handle (use
66 zzip_close to return it). On error the zzip_open_ext_io function will
67 return null setting errno(3).
68
69 If any ext_io handlers were used then the referenced structure should
70 be static as the allocated ZZIP_FILE does not copy them.
71
72 The zzip_open_shared_io function takes an extra stream argument - if a
73 handle has been then ext/io can be left null and the new stream handle
74 will pick up the ext/io. This should be used only in specific
75 environment however since zzip_file_real does not store any ext-
76 sequence.
77
78 The benefit for the zzip_open_shared_io function comes in when the old
79 file handle was openened from a file within a zip archive. When the new
80 file is in the same zip archive then the internal zzip_dir structures
81 will be shared. It is even quicker, as no check needs to be done
82 anymore trying to guess the zip archive place in the filesystem, here
83 we just check whether the zip archive's filepath is a prefix part of
84 the filename to be opened.
85
86 Note that the zzip_open_shared_io function is also used by
87 zzip_freopen that will unshare the old handle, thereby possibly closing
88 the handle.
89
90 The zzip_open_shared_io function returns a new zzip-handle (use
91 zzip_close to return it). On error the zzip_open_shared_io function
92 will return null setting errno(3).
93
94
95
97 Guido Draheim <guidod@gmx.de> Tomi Ollila <Tomi.Ollila@iki.fi>
98
99
100
102 Copyright (c) Guido Draheim, use under copyleft (LGPL,MPL)
103
104
105
106
107
108zziplib 0.13.72 zzip_open(3)