ZIP_GET_ARCHIVE_COMMENT(3)
β¨ ZIP_GET_ARCHIVE_COMMENT(3) β¨
okay bestie, gather round, we're reading the ZIP_GET_ARCHIVE_COMMENT(3) manual page together and honestly? it's giving helpful. it's in the Library Functions Manual, and it does exactly one thing but it does it so well.
π NAME π
zip_get_archive_comment β get zip archive comment
no cap, that's the whole job. you want the comment? she has the comment. π
π LIBRARY π
libzip (-lzip)
that's the library you're linking against, queen. link it or it doesn't exist. π
π¦ SYNOPSIS π¦
#include <zip.h>
const char *
zip_get_archive_comment(zip_t *archive, int *lenp, zip_flags_t flags);
look at that signature. three args. clean. iconic. the way that return type is a const char * and you are NOT allowed to touch it (more on that in a sec, i'm shaking).
π DESCRIPTION π
so, the zip_get_archive_comment() function returns the comment for the entire zip archive. yes, the whole archive, the main character comment, not a per-file one. ποΈ
the return value is in UTF-8 encoding unless ZIP_FL_ENC_RAW was specified (see below, bestie, we get there). β οΈ and now the important part: this pointer should not be modified or free(3)'d, and it becomes invalid when archive is closed. like, do NOT free it. do NOT scribble on it. she is borrowed, not gifted. π
if lenp is not NULL, the integer to which it points will be set to the length of the comment. handy, right? β¨
if flags is set to ZIP_FL_UNCHANGED, the original unchanged comment is returned. the before picture, if you will. πΈ
additionally, the following flags are supported:
ZIP_FL_ENC_RAWβ return the unmodified archive comment as it is in the ZIP archive. raw. unfiltered. no makeup. πͺZIP_FL_ENC_GUESSβ (Default.) guess the encoding of the archive comment in the ZIP archive and convert it to UTF-8, if necessary. (only CP-437 and UTF-8 are recognized, so like, those are the only two she speaks. sorry to the other encodings. π)ZIP_FL_ENC_STRICTβ follow the ZIP specification for file names and extend it to the archive comment, thus also expecting it in CP-437 encoding. convert it to UTF-8. she is a rule follower. π
π Note: ASCII is a subset of both CP-437 and UTF-8.
like, that note is lowkey the most important sentence here, iykyk. ASCII stays winning in both houses. π
π₯ RETURN VALUES π₯
upon successful completion, a pointer to the comment is returned, or NULL if there is no comment.
that's it. that's the deal. pointer or NULL, no in-between, no grey area, she does not do ambiguity. π
π SEE ALSO π
libzip(3), zip_file_get_comment(3)
go read the friends too. zip_file_get_comment(3) is the per-file version in case you were wondering why the archive one was being so specific. π«Ά
π°οΈ HISTORY π°οΈ
zip_get_archive_comment() was added in libzip 0.7. in libzip 0.11 the type of flags was changed from int to zip_flags_t.
glow up of the century honestly, int β‘οΈ zip_flags_t. we love a type-correct era. π¦β¨
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>
the icons who built it. bow down. πββοΈ
and that's the whole page, bestie!! this was shipped as part of the Debian manual pages, dated September 22, 2020, under the name ZIP_GET_ARCHIVE_COMMENT(3). periodt. π
πβ¨
π¦ 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