zzip_open(3)
β¨ zzip_open β the one where zziplib opens your stuff β¨
okay bestie, welcome to the zzip_open family π this is a zziplib Function List situation, and honestly it's giving "small function, big magic". let's get into it π«Ά
πΈ NAME πΈ
zzip_open, zzip_open_ext_io, zzip_open_shared_io β start usage. periodt. π
π SYNOPSIS π
#include <zzip/lib.h>
ZZIP_FILE*
zzip_open(zzip_char_t* filename, int o_flags)
ZZIP_FILE*
zzip_open_ext_io(zzip_char_t* filename, int o_flags, int o_modes, zzip_strings_t* ext,
zzip_plugin_io_t io)
ZZIP_FILE*
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)
π DESCRIPTION π
so, the zzip_open function will open(2) a real/zipped file. yes, both. it's flexible like that. π
It has some magic functionality builtin β it will first try to open the given filename as a normal file. If it does not exist, the given path to the filename (if any) is split into its directory-part and the file-part. A ".zip" extension is then added to the directory-part to create the name of a zip-archive. That zip-archive (if it exists) is being searched for the file-part, and if found a zzip-handle is returned. π¦β¨
Note that if the file is found in the normal fs-directory the returned structure is mostly empty and the zzip_read call will use the libc read(2) to obtain data. Otherwise a zzip_file_open is performed and any error mapped to errno(3).
There was a possibility to transfer zziplib-specific openmodes through o_flags but you should please not use them anymore π and look into zzip_open_ext_io to submit them down. The zzip_open function is shallow in that it just extracts the zzipflags and calls
zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0)
β οΈ you must stop using this extra functionality (not well known anyway) sincezzip_openmight be later usable to open files for writing in which case the_EXTRAFLAGSwill get in conflict. no cap, just let it go. π
compare with open(2) and zzip_fopen π
The zzip_open_ext_io function uses explicit ext and io instead of the internal defaults β setting them to zero is equivalent to zzip_open. π
note that the two flag types have been split into an o_flags (for fcntl-like openflags) and o_modes where the latter shall carry the zzip_flags and possibly accessmodes for unix filesystems. Since this version of zziplib can not write zipfiles, it is not yet used for anything else than zzip-specific modeflags. π
The zzip_open_ext_io function returns a new zzip-handle (use zzip_close to return it). On error the zzip_open_ext_io function will return null setting errno(3).
π¨ If anyext_iohandlers were used then the referenced structure should be static as the allocatedZZIP_FILEdoes not copy them. this one matters, bestie, don't be out here with a dangling stack struct π
The zzip_open_shared_io function takes an extra stream argument β if a handle has been then ext/io can be left null and the new stream handle will pick up the ext/io. This should be used only in specific environment however since zzip_file_real does not store any ext-sequence. π§
The benefit for the zzip_open_shared_io function comes in when the old file handle was openened from a file within a zip archive. When the new file is in the same zip archive then the internal zzip_dir structures will be shared. It is even quicker, as no check needs to be done anymore trying to guess the zip archive place in the filesystem, here we just check whether the zip archive's filepath is a prefix part of the filename to be opened. π₯ lowkey iconic behaviour
Note that the zzip_open_shared_io function is also used by zzip_freopen that will unshare the old handle, thereby possibly closing the handle. π
The zzip_open_shared_io function returns a new zzip-handle (use zzip_close to return it). On error the zzip_open_shared_io function will return null setting errno(3).
π AUTHOR π
Guido Draheim <guidod@gmx.de> and Tomi Ollila <Tomi.Ollila@iki.fi> β the main characters fr fr π«Ά
π COPYRIGHT π
Copyright (c) Guido Draheim, use under copyleft (LGPL,MPL) β¨
okay that's the whole vibe check done β
this was the zzip_open(3) page from zziplib 0.13.78, and honestly? slay. now go open something ππ π¦
π¦ where this page comes from
- centos-stream 10: zziplib-devel 0.13.78-2.el10 Β· LGPL-2.0-or-later OR MPL-1.1
- debian trixie: libzzip-dev 0.13.78+dfsg.1-0.1 Β· ZZIP
- fedora 43: zziplib-devel 0.13.78-2.fc43 Β· LGPL-2.0-or-later OR MPL-1.1
- fedora 43: zziplib-devel 0.13.78-2.fc43 Β· LGPL-2.0-or-later OR MPL-1.1
- fedora 44: zziplib-devel 0.13.78-4.fc44 Β· LGPL-2.0-or-later OR MPL-1.1
- fedora 44: zziplib-devel 0.13.78-4.fc44 Β· LGPL-2.0-or-later OR MPL-1.1
- opensuse-leap 16.0: zziplib-devel 0.13.78-160000.2.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: zziplib-devel 0.13.78-160000.2.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: zziplib-devel 0.13.78-160000.2.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: zziplib-devel 0.13.78-160000.2.2 Β· LGPL-2.1-or-later
- ubuntu questing: libzzip-dev 0.13.78+dfsg.1-0.1
- ubuntu resolute: libzzip-dev 0.13.78+dfsg.1-0.2 Β· ZZIP
- ubuntu stonking: libzzip-dev 0.13.78+dfsg.1-0.2 Β· ZZIP
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms