ZIP_UNCHANGE(3)
β¨ ZIP_UNCHANGE(3) β¨
okay bestie, this is the Library Functions Manual page for zip_unchange, and it's lowkey one of the most satisfying little functions in libzip β it's the undo button π
π NAME π
zip_unchange β undo changes to file in zip archive
no fr, that's it. that's the whole vibe. you changed something, you regret it, you take it back. main character redemption arc π¦
π LIBRARY π
libzip (-lzip)
that's the library you're linking against, bestie. don't forget the flag or the linker will simply not know her π
πΈ SYNOPSIS πΈ
#include <zip.h>
int
zip_unchange(zip_t *archive, zip_uint64_t index);
so you include <zip.h>, you hand her your archive, you hand her the index of the file you're having second thoughts about, and she returns an int. simple. iconic. no notes. β¨
π DESCRIPTION π
Changes to the file at position index are reverted.
that's the whole thing!! reverted. all the little edits, the renames, the whatever-you-did β gone, back to how the archive originally had it. it's giving "not me accidentally editing a file in a zip and needing a full factory reset" π
π RETURN VALUES π
0β slay, it worked, we're so back π«Ά-1β nope, something went wrong, and the error code inarchiveis set to tell you exactly what.
periodt.
π₯ ERRORS π₯
zip_unchange() fails if:
[ZIP_ER_EXISTS]β Unchanging the name would result in a duplicate name in the archive.
like... you'd end up with two files sharing a name and the archive is NOT doing that. it's giving "there can only be one" π
[ZIP_ER_INVAL]βindexis not a valid file index inzip.
you pointed at something that isn't a real file in there. vibe check failed. index invalid, bestie π
π SEE ALSO π
iykyk β if you want to undo everything, go peep those two. this one is just for the one file. π§
π HISTORY π
zip_unchange()was added in libzip 0.6. a legend was born.- In libzip 0.10 the type of
indexwas changed frominttozip_uint64_t.
so if you're reading old code and the signature looks different β that's why. glow-up era β¨
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>
the founding mothers/fathers of this whole thing, we stan π«Ά
and that's the page!! this little gem comes to you from Debian, dated December 18, 2017 β yes the footer said so, and yes I'm telling you anyway because we respect our elders π now go undo something, bestie πΈ
π¦ 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-2017 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