zzip_seek(3)

πŸ“¦
version 0.13.78 Β· 4 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ zzip_seek β€” the seek page πŸ’…

okay so bestie, this is the man page for zzip_seek and zzip_seek32, straight out of the zziplib Function List. it's giving "let me move around inside your file" energy. sit down, hydrate, we're doing this 🫢


🌸 NAME 🌸

zzip_seek, zzip_seek32 β€” seek. yeah. that's the whole vibe. it seeks. iconic honestly πŸ’–


✨ SYNOPSIS ✨

pull the header in first, always:

#include <zzip/lib.h>

and then the two besties themselves:

zzip_off_t
zzip_seek(ZZIP_FILE* fp, zzip_off_t offset, int whence)

long
zzip_seek32(ZZIP_FILE* fp, long offset, int whence)

copy those exactly, no cap πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so zzip_seek is gonna do a lseek(2) operation on a real/zipped file. that's the whole job description. she seeks 🧚

she'll try to seek to the offset you passed in as offset, relative to whence, and whence has to be one of SEEK_SET, SEEK_CUR or SEEK_END. no improvising, those are the options πŸ’…

now here's where it gets interesting (derogatory). if the file-handle is wrapping a stat'able file, she just does a normal lseek(2) call and it's a whole slay, fast, no drama. but β€” and this is the part we need to talk about β€” if it's not, then the relative offset gets calculated, negative offsets get transformed into positive ones by rewinding the file, and then data is read until the offset is reached. yeah. she's reading. the whole way. 😭

this can make the function terribly slow. like, genuinely. that's just how gzio implements it, and the author is out here saying they're not sure there's a better way without using the internals of the algorithm. so. it's giving "it is what it is" πŸ’€

and zzip_seek32? that one is provided for users who can not use any largefile-mode. she's here for you specifically 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Guido Draheim <guidod@gmx.de> and Tomi Ollila <Tomi.Ollila@iki.fi> β€” the two main characters of this page, honestly ⭐


Copyright (c) Guido Draheim, use under copyleft (LGPL,MPL). keep the receipts, bestie πŸ“


aaaand that's the whole page πŸ’œ this was zziplib version 0.13.78, page zzip_seek(3) β€” thanks for coming to my ted talk, go forth and seek responsibly, mwah πŸŽ€βœ¨