ZIP_FILE_SET_COMMENT(3)
π ZIP_FILE_SET_COMMENT(3) π
okay bestie, welcome to the libzip corner of the manual pages β this one's about zip_file_set_comment(), and it's genuinely so useful, no cap. Library Functions Manual energy, but make it cute. π
β¨ NAME β¨
zip_file_set_comment β set comment for file in zip
π LIBRARY π
libzip (-lzip)
πΈ SYNOPSIS πΈ
#include <zip.h>
int
zip_file_set_comment(zip_t *archive, zip_uint64_t index,
const char *comment, zip_uint16_t len, zip_flags_t flags);
π DESCRIPTION π
So the zip_file_set_comment() function does exactly what it says on the tin, bestie: it sets the comment for the file sitting at position index in the zip archive to comment of length len. Glow up for your zip entries, literally. β¨
And if comment is NULL and len is 0? The file comment gets removed. Poof. Gone. It's giving "un-commenting your ex," we love to see it. π
The flags argument can be any of these iconic little options:
ZIP_FL_ENC_GUESSβ Guess the encoding ofcomment(this is the default, btw). Only CP-437 and UTF-8 get recognized, so don't get too creative in there. πZIP_FL_ENC_UTF_8β Interpretcommentas UTF-8. π¦ZIP_FL_ENC_CP437β Interpretcommentas code page 437 (CP-437). π§
π₯ RETURN VALUES π₯
When everything goes right, 0 is returned. Slay. π
Otherwise you get -1, and the error information in archive is set to indicate the error β so like, check that if things go sideways, bestie.
π ERRORS π
zip_file_set_comment() fails if:
[ZIP_ER_INVAL]βindexis not a valid file index inarchive, orlenis less than0or longer than the maximum comment length in a zip file (65535), orcommentis not a valid UTF-8 encoded string. π[ZIP_ER_MEMORY]β Required memory could not be allocated. The audacity. π[ZIP_ER_RDONLY]β The archive was opened in read-only mode. You can't write to something that said "no thank you," periodt. π«
π SEE ALSO π
libzip(3), zip_file_get_comment(3), zip_get_archive_comment(3), zip_set_archive_comment(3)
π HISTORY π
zip_file_set_comment() was added in libzip 0.11. A classic, honestly. β
π«Ά AUTHORS π«Ά
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β the icons who made this happen. π
okay that's the whole page, bestie β this one's from the Debian crew, dated September 22, 2020, and it lives at ZIP_FILE_SET_COMMENT(3). go forth and comment your zips, ily, bye πβ¨
π¦ 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) 2006-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