ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)
π zip_register_progress_callback_with_state(3) π
okay bestie, so this one is a libzip manual page β a library functions manual page, no cap β and it's all about making your progress bar actually go brrrr while you're closing a zip archive. Let's get into it π«Ά
β¨ NAME β¨
zip_register_progress_callback_with_state β give you updates during zip_close, like a lil hype squad that tells you how far along you are π
π LIBRARY π
libzip (-lzip) β yeah, that's the one you link against, queen.
πΈ SYNOPSIS πΈ
#include <zip.h>
typedef void (*zip_progress_callback)(zip_t *, double, void *);
void
zip_register_progress_callback_with_state(zip_t *archive,
double precision, zip_progress_callback callback,
void (*ud_free)(void *), void *ud);
like. look at it. five arguments. she's serving π
π« DESCRIPTION π«
so the zip_register_progress_callback_with_state() function registers a callback function β that's callback β for the zip archive, which is archive. simple as that, fr fr.
the precision argument is a double in the range from 0.00 to 1.0 and it defines the smallest change for which the callback should get called. it's literally there so you don't get spammed with calls β she's not trying to be extra, she's trying to be efficient π
the ud_free function gets called during cleanup, and its whole job is deleting the userdata you supplied over in ud. yes, you have to clean up after yourself. main character energy includes aftercare, periodt.
π¦ when does the callback actually run π¦
the callback function is called during zip_close(3) in regular intervals. and by regular intervals we mean:
- after every zip archive entry that's completely written to disk, and
- while writing data for entries π
and what does it get handed? three things, as its arguments:
- the zip archive
archive, - the current progression state as a
double, and - the user-provided user-data
ud.
the progression state is a double in the range from 0.0 to 1.0. so like, 0.0 = nothing yet, 1.0 = we ate and left no crumbs π₯
this is literally what you use to feed progress indicators for user interfaces. your lil loading bar? this is her food. feed her. π
π SEE ALSO π
(the cancel one is her sister, iykyk)
π°οΈ HISTORY π°οΈ
zip_register_progress_callback_with_state() was added in libzip 1.3.0. so if you're on something older, no she's not there yet, sorry bestie π
π AUTHORS π
- Dieter Baron
<dillo@nih.at> - Thomas Klausner
<wiz@gatalith.at>
absolute icons, we stan π
heads up: this page came to you from Debian, dated December (the footer got a lil chopped up in transit but that's the vibe). that's the whole manual page bestie β now go forth and make your progress bars gorgeous β¨ππ
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- debian trixie: libzip-dev 1.11.3-2 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu questing: libzip-dev 1.11.3-2
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2017-2021 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms