ZIP_SET_ARCHIVE_COMMENT(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_SET_ARCHIVE_COMMENT(3) ✨

okay so bestie, we're in the Library Functions Manual section of your system and today's main character is zip_set_archive_comment. yes it's a whole mood, come sit with me 🫢


πŸ’– NAME πŸ’–

zip_set_archive_comment β€” set zip archive comment


🌸 LIBRARY 🌸

libzip (-lzip)

like, that's the library you're linking against, no cap πŸ”₯


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <zip.h>

int
zip_set_archive_comment(zip_t *archive, const char *comment,
    zip_uint16_t len);

look at her. iconic signature. three little arguments and she's gonna change your whole archive's vibe πŸ’…


🌈 DESCRIPTION 🌈

so here's the tea: zip_set_archive_comment() sets the comment for the entire zip archive. not one file inside it, the whole girl. the archive itself. main character energy fr fr.

and listen β€” if comment is NULL and len is 0, the archive comment gets removed. gone. deleted. she said bye πŸ™ˆ

also important: comment must be encoded in ASCII or UTF-8. that's the vibe check it has to pass, okay?


✨ RETURN VALUES ✨

  • upon successful completion, 0 is returned πŸŽ€
  • otherwise, -1 is returned and the error information in archive is set to indicate the error πŸ’€

so like, always peek at that return value, bestie. don't just ignore her.


😭 ERRORS 😭

zip_set_archive_comment() fails if:

  • [ZIP_ER_INVAL] β€” len is less than 0 or longer than the maximum comment length in a zip file (65535), or comment is not a valid UTF-8 encoded string. so either the length is doing too much, or your string is giving invalid-encoding 😬
  • [ZIP_ER_MEMORY] β€” required memory could not be allocated. the machine said "no room, bestie" πŸͺ¦

πŸ‘‘ SEE ALSO πŸ‘‘

go read the whole friend group, they're all connected iykyk 🧚


πŸ“œ HISTORY πŸ“œ

zip_set_archive_comment() was added in libzip 0.7. and then in libzip 0.11, the type of len was changed from int to zip_uint16_t. glow-up era, honestly ✨


πŸŽ€ AUTHORS πŸŽ€

Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>

absolute legends, we stan 🫢


k that's the whole page, no notes. go forth and comment your archives, just keep it ASCII or UTF-8 and under 65535 bytes, mwah πŸ’‹

this was the Debian build of ZIP_SET_ARCHIVE_COMMENT(3), dated December 18, 2017. periodt. πŸ’–