zzip_dir_open(3)

πŸ“¦
version 0.13.78 Β· 4 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– zzip_dir_open β€” bestie's guide to opening zip archives πŸ’–

okay so this is from the zziplib Function List manual (the zzip_dir_open(3) girlies know ✨), and it's literally just three lil functions that let you crack open a zip-archive and read what's inside. no cap. let's get into it 🫢


✨ SYNOPSIS ✨

#include <zzip/lib.h>

ZZIP_DIR*
zzip_dir_open(zzip_char_t* filename, zzip_error_t* e)

ZZIP_DIR*
zzip_dir_open_ext_io(zzip_char_t* filename, zzip_error_t* e, zzip_strings_t* ext,
                     zzip_plugin_io_t io)

int
zzip_dir_read(ZZIP_DIR* dir, ZZIP_DIRENT* d)

like, look at her. three functions. one include. we're so back πŸ”₯


🌸 DESCRIPTION 🌸

so zzip_dir_open does exactly what it says on the tin: it opens the zip-archive you handed it (if available, bestie β€” if available, pls read that part πŸ™ˆ). and the two ext_io arguments? those will just default to using posix io and a set of default fileext that can atleast add the .zip ext itself. so it's doing the most for you already, no notes πŸ’…

the zzip_dir_open_ext_io function is the one where you get to be the main character and pass explicit ext and io instead of letting the internal defaults do their thing. and here's the tea: setting these to zero is equivalent to just calling zzip_dir_open. same energy, fr fr.

⚠️ okay important one, don't skip: the referenced ext_io plugin handlers structure must be static, because it is not copied into the returned ZZIP_DIR structure. it is not copied!! so if you let it go out of scope you're gonna have a bad time 😭 keep it alive, keep it static, keep it iconic.

and then zzip_dir_read β€” she fills the dirent-argument with the values and increments the read-pointer of the dir-argument. so each call moves you along the archive, one entry at a time, like scrolling a feed but for zip files πŸ¦‹

and it returns 0 if there's no entry (anymore). that's your little "we're done here, bestie" signal πŸŽ€


πŸ‘‘ AUTHOR πŸ‘‘

Guido Draheim <guidod@gmx.de> and Tomi Ollila <too@iki.fi> β€” the icons who built this. we stan 🌈


Copyright (c) Guido Draheim, use under copyleft (LGPL, MPL). slay, and also legally binding πŸ’œ


and that's the whole page, bestie!! this was zziplib, version 0.13.78, and yes this is me signing off on the zzip_dir_open(3) page specifically β€” go open some archives, stay static with your plugin handlers, and don't forget to check for that 0 return πŸ«Άβœ¨πŸ’–