ZIP_REGISTER_PROGRESS_CALLBACK_WITH_STATE(3)

πŸ“¦
version 1.11.4 Β· 3 versions
, in arch rolling, debian trixie, fedora 43, fedora 44, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 βœ¨πŸŽ€πŸ’œ