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