ZIP_NAME_LOCATE(3)
π ZIP_NAME_LOCATE(3) π
ok so this is a page from the Library Functions Manual and we're talking about ZIP_NAME_LOCATE(3) bestie. come sit with me.
β¨ NAME β¨
zip_name_locate β get index of file by name
π LIBRARY π
libzip (-lzip)
πΈ SYNOPSIS πΈ
#include <zip.h>
zip_int64_t
zip_name_locate(zip_t *archive, const char *fname, zip_flags_t flags);
π¦ DESCRIPTION π¦
ok so zip_name_locate() hands you back the index of the file named fname inside archive. and if archive literally does not have a file with that name? you get -1. that's it, that's the whole vibe. π
if neither ZIP_FL_ENC_RAW nor ZIP_FL_ENC_STRICT are specified, it will guess the encoding of the name in the ZIP archive and convert it to UTF-8, if necessary, before comparing. guessing era fr.
if neither ZIP_FL_ENC_CP437 nor ZIP_FL_ENC_UTF_8 are specified, it guesses the encoding of fname.
Only CP-437 and UTF-8 are recognized. that's the whole roster, no plus ones.
the flags get specified by or'ing the following values, or 0 for none of them. slay:
ZIP_FL_NOCASEβ ignore case distinctions. (will only work well if the file names are ASCII.) heads up bestie: with this flag,zip_name_locate()will be slow for archives with many files. πZIP_FL_NODIRβ ignore the directory part of the file name in the archive. and again: with this flag,zip_name_locate()will be slow for archives with many files.ZIP_FL_ENC_GUESSβ this flag has no effect (its value is0); it can be used to explicitly denote the absence of encoding flags. it's giving "i'm here but i do nothing" energy πZIP_FL_ENC_RAWβ comparefnameagainst the unmodified names as they are in the ZIP archive, without converting them to UTF-8. raw dogging the bytes, no conversion.ZIP_FL_ENC_STRICTβ follow the ZIP specification and expect CP-437 encoded names in the ZIP archive (except if they are explicitly marked as UTF-8). convert them to UTF-8 before comparing. it's the rule-follower of the group.ZIP_FL_ENC_CP437βfnameis encoded as CP-437.ZIP_FL_ENC_UTF_8βfnameis encoded as UTF-8.
Note: ASCII is a subset of both CP-437 and UTF-8. so like, it's valid in both houses, iykyk π
π RETURN VALUES π
zip_name_locate() returns the index of the file named fname, or -1, if archive does not contain an entry of that name.
π ERRORS π
zip_name_locate() fails if:
[ZIP_ER_INVAL]β one of the arguments is invalid. ma'am. π«[ZIP_ER_MEMORY]β required memory could not be allocated. she tried her best.[ZIP_ER_NOENT]β no entry of the namefnameis found in the archive. ghosted fr.
π SEE ALSO π
β HISTORY β
zip_name_locate() was added in libzip 0.6. in libzip 0.11 the return type was changed from int to zip_int64_t. and also in libzip 0.11 the type of flags was changed from int to zip_flags_t. glow-up era, honestly. β¨
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β the icons who made all of this happen π«Ά
and that's the tea, bestie π this came from the Debian build, dated March 15, 2022 β go forth and locate some names, you've got this πΈ
π¦ 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) 2003-2022 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