1ZZIP_OPEN(3) zziplib Function List ZZIP_OPEN(3)
2
3
4
6 zzip_open, zzip_open_ext_io, zzip_open_shared_io -
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 read
32 to obtain data. Otherwise a zzip_file_open is performed and any error
33 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 The zzip_open_shared_io function takes an extra stream argument - if a
62 handle has been then ext/io can be left null and the new stream handle
63 will pick up the ext/io. This should be used only in specific
64 environment however since zzip_file_real does not store any
65 ext-sequence.
66
67 The benefit for the zzip_open_shared_io function comes in when the old
68 file handle was openened from a file within a zip archive. When the new
69 file is in the same zip archive then the internal zzip_dir structures
70 will be shared. It is even quicker, as no check needs to be done
71 anymore trying to guess the zip archive place in the filesystem, here
72 we just check whether the zip archive´s filepath is a prefix part of
73 the filename to be opened.
74
75 Note that the zzip_open_shared_io function is also used by zzip_freopen
76 that will unshare the old handle, thereby possibly closing the handle.
77
78 The zzip_open_shared_io function returns a new zzip-handle (use
79 zzip_close to return it). On error the zzip_open_shared_io function
80 will return null setting errno(3).
81
83 · Guido Draheim <guidod@gmx.de> Tomi Ollila <Tomi.Ollila@iki.fi>
84
86 Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim All rights
87 reserved, use under the restrictions of the Lesser GNU General Public
88 License or alternatively the restrictions of the Mozilla Public License
89 1.1
90
91
92
93zziplib 0.13.49 ZZIP_OPEN(3)