zziplib Library Functions

Version 0.13.72

#include <zzip/lib.h>

zzip_rewinddir(ZZIP_DIR * dir) : void
zzip_telldir(ZZIP_DIR * dir) : zzip_off_t
zzip_seekdir(ZZIP_DIR * dir, zzip_off_t offset) : void
zzip_telldir32(ZZIP_DIR * dir) : long
zzip_seekdir32(ZZIP_DIR * dir, long offset) : void
zzip_opendir(zzip_char_t * filename) : ZZIP_DIR *
zzip_opendir_ext_io(zzip_char_t * filename, int o_modes, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_DIR *
zzip_strerror(int errcode) : zzip_char_t *
zzip_strerror_of(ZZIP_DIR * dir) : zzip_char_t *
zzip_fclose(ZZIP_FILE * fp) : int
zzip_close(ZZIP_FILE * fp) : int
zzip_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) : zzip_ssize_t
zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE * file) : zzip_size_t
zzip_fopen(zzip_char_t * filename, zzip_char_t * mode) : ZZIP_FILE *
zzip_freopen(zzip_char_t * filename, zzip_char_t * mode, ZZIP_FILE * stream) : ZZIP_FILE *
zzip_open(zzip_char_t * filename, int o_flags) : ZZIP_FILE *
zzip_open_ext_io(zzip_char_t * filename, int o_flags, int o_modes, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_FILE *
zzip_open_shared_io(ZZIP_FILE * stream, zzip_char_t * filename, int o_flags, int o_modes, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_FILE *
zzip_tell(ZZIP_FILE * fp) : zzip_off_t
zzip_tell32(ZZIP_FILE * fp) : long
zzip_seek(ZZIP_FILE * fp, zzip_off_t offset, int whence) : zzip_off_t
zzip_seek32(ZZIP_FILE * fp, long offset, int whence) : long
zzip_error(ZZIP_DIR * dir) : int
zzip_seterror(ZZIP_DIR * dir, int errcode) : void
zzip_dirhandle(ZZIP_FILE * fp) : ZZIP_DIR *
zzip_dirfd(ZZIP_DIR * dir) : int
zzip_file_real(ZZIP_FILE * fp) : int
zzip_dir_real(ZZIP_DIR * dir) : int
zzip_realdir(ZZIP_DIR * dir) : void *
zzip_realfd(ZZIP_FILE * fp) : int
zzip_init_io(zzip_plugin_io_handlers_t io, int flags) : int
zzip_get_default_io(void) : zzip_plugin_io_t
zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t * name, ZZIP_STAT * zs, int flags) : int
zzip_file_stat(ZZIP_FILE * file, ZZIP_STAT * zs) : int
zzip_fstat(ZZIP_FILE * file, ZZIP_STAT * zs) : int
zzip_dir_alloc_ext_io(zzip_strings_t * ext, const zzip_plugin_io_t io) : ZZIP_DIR *
zzip_dir_alloc(zzip_strings_t * fileext) : ZZIP_DIR *
zzip_dir_free(ZZIP_DIR * dir) : int
zzip_dir_close(ZZIP_DIR * dir) : int
zzip_dir_fdopen(int fd, zzip_error_t * errcode_p) : ZZIP_DIR *
zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errcode_p, zzip_strings_t * ext, const zzip_plugin_io_t io) : ZZIP_DIR *
zzip_dir_open(zzip_char_t * filename, zzip_error_t * e) : ZZIP_DIR *
zzip_dir_open_ext_io(zzip_char_t * filename, zzip_error_t * e, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_DIR *
zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * d) : int
zzip_readdir(ZZIP_DIR * dir) : ZZIP_DIRENT *
zzip_closedir(ZZIP_DIR * dir) : int
zzip_errno(int errcode) : int
zzip_file_close(ZZIP_FILE * fp) : int
zzip_file_open(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) : ZZIP_FILE *
zzip_inflate_init(ZZIP_FILE * fp, struct zzip_dir_hdr *hdr) : static int
zzip_file_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) : zzip_ssize_t
zzip_rewind(ZZIP_FILE * fp) : int
zzip_compr_str(int compr) : zzip_char_t *
zzip_filesize(int fd) : zzip_off_t
__zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, struct _disk_trailer *_zzip_restrict trailer, zzip_plugin_io_t io) : static int
__zzip_parse_root_directory(int fd, struct _disk_trailer *trailer, struct zzip_dir_hdr **hdr_return, zzip_plugin_io_t io, zzip_off_t filesize) : static int
__zzip_try_open(zzip_char_t * filename, int filemode, zzip_strings_t * ext, zzip_plugin_io_t io) : int

Documentation

zzip_rewinddir(ZZIP_DIR * dir) : void
zzip_telldir(ZZIP_DIR * dir) : zzip_off_t
zzip_seekdir(ZZIP_DIR * dir, zzip_off_t offset) : void
zzip_telldir32(ZZIP_DIR * dir) : long
zzip_seekdir32(ZZIP_DIR * dir, long offset) : void
  rewind. zzip/dir.c

The zzip_rewinddir function is the equivalent of a rewinddir(2) for a realdir or the zipfile in place of a directory. The ZZIP_DIR handle returned from zzip_opendir has a flag saying realdir or zipfile. As for a zipfile, the filenames will include the filesubpath, so take care.

The zzip_telldir function is the equivalent of telldir(2) for a realdir or zipfile.

The zzip_seekdir function is the equivalent of seekdir(2) for a realdir or zipfile.

The zzip_telldir32 function is provided for users who can not use any largefile-mode.

The zzip_seekdir32 function is provided for users who can not use any largefile-mode.

zzip_opendir(zzip_char_t * filename) : ZZIP_DIR *
zzip_opendir_ext_io(zzip_char_t * filename, int o_modes, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_DIR *
  start usage. zzip/dir.c

The zzip_opendir function is the equivalent of opendir(3) for a realdir or zipfile.

The zzip_opendir function has some magic - if the given argument-path is a directory, it will wrap a real opendir(3) into the ZZIP_DIR structure. Otherwise it will divert to zzip_dir_open which can also attach a ".zip" extension if needed to find the archive.

the error-code is mapped to errno(3).

The zzip_opendir_ext_io function uses explicit ext and io instead of the internal defaults, setting them to zero is equivalent to zzip_opendir

zzip_strerror(int errcode) : zzip_char_t *
zzip_strerror_of(ZZIP_DIR * dir) : zzip_char_t *
 ... zzip/err.c

The zzip_strerror_of function fetches the errorcode from the DIR-handle and runs it through zzip_strerror to obtain the static string describing the error.

zzip_fclose(ZZIP_FILE * fp) : int
zzip_close(ZZIP_FILE * fp) : int
  end usage. zzip/file.c

The zzip_fclose function closes the given ZZIP_FILE handle.

If the ZZIP_FILE wraps a normal stat'fd then it is just that int'fd that is being closed and the otherwise empty ZZIP_FILE gets freed.

zzip_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) : zzip_ssize_t
zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE * file) : zzip_size_t
  read data. zzip/file.c

The zzip_read function will read(2) data from a real/zipped file.

The zzip_read function is the replacement for read(2) will fill the given buffer with bytes from the opened file. It will return the number of bytes read, so if the EOF is encountered you will be prompted with the number of bytes actually read.

If the file-handle is wrapping a stat'able file then it will actually just perform a normal read(2)-call, otherwise zzip_file_read is called to decompress the data stream and any error is mapped to errno(3).

zzip_fopen(zzip_char_t * filename, zzip_char_t * mode) : ZZIP_FILE *
zzip_freopen(zzip_char_t * filename, zzip_char_t * mode, ZZIP_FILE * stream) : ZZIP_FILE *
  start usage. zzip/file.c

The zzip_fopen function will fopen(3) a real/zipped file.

It has some magic functionality builtin - it will first try to open the given filename as a normal file. If it does not exist, the given path to the filename (if any) is split into its directory-part and the file-part. A ".zip" extension is then added to the directory-part to create the name of a zip-archive. That zip-archive (if it exists) is being searched for the file-part, and if found a zzip-handle is returned.

Note that if the file is found in the normal fs-directory the returned structure is mostly empty and the zzip_read call will use the libc read(2) to obtain data. Otherwise a zzip_file_open is performed and any error mapped to errno(3).

unlike the posix-wrapper zzip_open the mode-argument is a string which allows for more freedom to support the extra zzip modes called ZZIP_CASEINSENSITIVE and ZZIP_IGNOREPATH. Currently, this zzip_fopen call will convert the following characters in the mode-string into their corrsponding mode-bits:

  • "r" : O_RDONLY : read-only

  • "b" : O_BINARY : binary (win32 specific)

  • "f" : O_NOCTTY : no char device (unix)

  • "i" : ZZIP_CASELESS : inside zip file

  • "*" : ZZIP_NOPATHS : inside zip file only

all other modes will be ignored for zip-contained entries but they are transferred for compatibility and portability, including these extra sugar bits:

  • "x" : O_EXCL : fail if file did exist

  • "s" : O_SYNC : synchronized access

  • "n" : O_NONBLOCK : nonblocking access

  • "z#" : compression level : for zlib

  • "g#" : group access : unix access bits

  • "u#" : owner access : unix access bits

  • "o#" : world access : unix access bits

... the access bits are in traditional unix bit format with 7 = read/write/execute, 6 = read/write, 4 = read-only.

The default access mode is 0664, and the compression level is ignored since the lib can not yet write zip files, otherwise it would be the initialisation value for the zlib deflateInit where 0 = no-compression, 1 = best-speed, 9 = best-compression.

The zzip_fopen function returns a new zzip-handle (use zzip_close to return it). On error the zzip_fopen function will return null setting errno(3).

The zzip_freopen function receives an additional argument pointing to a ZZIP_FILE* being already in use. If this extra argument is null then the zzip_freopen function is identical with calling zzip_fopen

Per default, the old file stream is closed and only the internal structures associated with it are kept. These internal structures may be reused for the return value, and this is a lot quicker when the filename matches a zipped file that is incidentally in the very same zip arch as the old filename wrapped in the stream struct.

That's simply because the zip arch's central directory does not need to be read again. As an extension for the zzip_freopen function, if the mode-string contains a "q" then the old stream is not closed but left untouched, instead it is only given as a hint that a new file handle may share/copy the zip arch structures of the old file handle if that is possible, i.e when they are in the same zip arch.

The zzip_freopen function returns a new zzip-handle (use zzip_close to return it). On error the zzip_freopen function will return null setting errno(3).

zzip_open(zzip_char_t * filename, int o_flags) : ZZIP_FILE *
zzip_open_ext_io(zzip_char_t * filename, int o_flags, int o_modes, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_FILE *
zzip_open_shared_io(ZZIP_FILE * stream, zzip_char_t * filename, int o_flags, int o_modes, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_FILE *
  start usage. zzip/file.c

The zzip_open function will open(2) a real/zipped file

It has some magic functionality builtin - it will first try to open the given filename as a normal file. If it does not exist, the given path to the filename (if any) is split into its directory-part and the file-part. A ".zip" extension is then added to the directory-part to create the name of a zip-archive. That zip-archive (if it exists) is being searched for the file-part, and if found a zzip-handle is returned.

Note that if the file is found in the normal fs-directory the returned structure is mostly empty and the zzip_read call will use the libc read(2) to obtain data. Otherwise a zzip_file_open is performed and any error mapped to errno(3).

There was a possibility to transfer zziplib-specific openmodes through o_flags but you should please not use them anymore and look into zzip_open_ext_io to submit them down. The zzip_open function is shallow in that it just extracts the zzipflags and calls

  • zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0)

you must stop using this extra functionality (not well known anyway) since zzip_open might be later usable to open files for writing in which case the _EXTRAFLAGS will get in conflict.

compare with open(2) and zzip_fopen

The zzip_open_ext_io function uses explicit ext and io instead of the internal defaults, setting them to zero is equivalent to zzip_open

note that the two flag types have been split into an o_flags (for fcntl-like openflags) and o_modes where the latter shall carry the zzip_flags and possibly accessmodes for unix filesystems. Since this version of zziplib can not write zipfiles, it is not yet used for anything else than zzip-specific modeflags.

The zzip_open_ext_io function returns a new zzip-handle (use zzip_close to return it). On error the zzip_open_ext_io function will return null setting errno(3).

If any ext_io handlers were used then the referenced structure should be static as the allocated ZZIP_FILE does not copy them.

The zzip_open_shared_io function takes an extra stream argument - if a handle has been then ext/io can be left null and the new stream handle will pick up the ext/io. This should be used only in specific environment however since zzip_file_real does not store any ext-sequence.

The benefit for the zzip_open_shared_io function comes in when the old file handle was openened from a file within a zip archive. When the new file is in the same zip archive then the internal zzip_dir structures will be shared. It is even quicker, as no check needs to be done anymore trying to guess the zip archive place in the filesystem, here we just check whether the zip archive's filepath is a prefix part of the filename to be opened.

Note that the zzip_open_shared_io function is also used by zzip_freopen that will unshare the old handle, thereby possibly closing the handle.

The zzip_open_shared_io function returns a new zzip-handle (use zzip_close to return it). On error the zzip_open_shared_io function will return null setting errno(3).

zzip_tell(ZZIP_FILE * fp) : zzip_off_t
zzip_tell32(ZZIP_FILE * fp) : long
  tell. zzip/file.c

The zzip_tell function will tell(2) the current position in a real/zipped file

It will return the current offset within the real/zipped file, measured in uncompressed bytes for the zipped-file case.

If the file-handle is wrapping a stat'able file then it will actually just perform a normal tell(2)-call, otherwise the offset is calculated from the amount of data left and the total uncompressed size;

The zzip_tell32 function is provided for users who can not use any largefile-mode.

zzip_seek(ZZIP_FILE * fp, zzip_off_t offset, int whence) : zzip_off_t
zzip_seek32(ZZIP_FILE * fp, long offset, int whence) : long
  seek. zzip/file.c

The zzip_seek function will perform a lseek(2) operation on a real/zipped file

It will try to seek to the offset specified by offset, relative to whence, which is one of SEEK_SET, SEEK_CUR or SEEK_END.

If the file-handle is wrapping a stat'able file then it will actually just perform a normal lseek(2)-call. Otherwise the relative offset is calculated, negative offsets are transformed into positive ones by rewinding the file, and then data is read until the offset is reached. This can make the function terribly slow, but this is how gzio implements it, so I'm not sure there is a better way without using the internals of the algorithm.

The zzip_seek32 function is provided for users who can not use any largefile-mode.

zzip_error(ZZIP_DIR * dir) : int
zzip_seterror(ZZIP_DIR * dir, int errcode) : void
  get errror status. zzip/info.c

The zzip_error function just returns dir->errcode of the ZZIP_DIR handle see: zzip_dir_open, zzip_dir_open, zzip_readdir, zzip_dir_read

The zzip_seterror function just does dir->errcode = errcode

zzip_dirhandle(ZZIP_FILE * fp) : ZZIP_DIR *
zzip_dirfd(ZZIP_DIR * dir) : int
  get handle. zzip/info.c

The zzip_dirhandle function will just return the fp->dir value.

If a ZZIP_FILE is contained within a zip-file that one will be a valid pointer, otherwise a NULL is returned and the ZZIP_FILE wraps a real file.

The zzip_dirfd function will just return dir->fd

If a ZZIP_DIR does point to a zipfile then the file-descriptor of that zipfile is returned, otherwise a NULL is returned and the ZZIP_DIR wraps a real directory DIR (if you have dirent on your system).

zzip_file_real(ZZIP_FILE * fp) : int
zzip_dir_real(ZZIP_DIR * dir) : int
zzip_realdir(ZZIP_DIR * dir) : void *
zzip_realfd(ZZIP_FILE * fp) : int
  check real or zipped file. zzip/info.c

The zzip_file_real function checks if the ZZIP_FILE-handle is wrapping a real file or a zip-contained file. Returns 1 for a stat'able file, and 0 for a file inside a zip-archive.

The zzip_dir_real function checks if the ZZIP_DIR-handle is wrapping a real directory or a zip-archive. Returns 1 for a stat'able directory, and 0 for a handle to zip-archive.

The zzip_realdir function returns the posix DIR* handle (if one exists). Check before with zzip_dir_real if the the ZZIP_DIR points to a real directory.

The zzip_realfd function returns the posix file descriptor (if one exists). Check before with zzip_file_real if the the ZZIP_FILE points to a real file.

zzip_init_io(zzip_plugin_io_handlers_t io, int flags) : int
zzip_get_default_io(void) : zzip_plugin_io_t
  init plugin struct. zzip/plugin.c

The zzip_init_io function initializes the users handler struct to default values being the posix io functions in default configured environments.

Note that the target io_handlers_t structure should be static or atleast it should be kept during the lifetime of zzip operations.

The zzip_get_default_io function returns a zzip_plugin_io_t handle to static defaults wrapping the posix io file functions for actual file access. The returned structure is shared by all threads in the system.

zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t * name, ZZIP_STAT * zs, int flags) : int
zzip_file_stat(ZZIP_FILE * file, ZZIP_STAT * zs) : int
zzip_fstat(ZZIP_FILE * file, ZZIP_STAT * zs) : int
  get meta infornation on a zipped element. zzip/stat.c

The zzip_dir_stat function obtains information about a filename in an opened zip-archive without opening that file first. Mostly used to obtain the uncompressed size of a file inside a zip-archive. see zzip_dir_open.

The zzip_file_stat function will obtain information about a opened file _within_ a zip-archive. The file is supposed to be open (otherwise -1 is returned). The st_size stat-member contains the uncompressed size. The optional d_name is never set here.

The zzip_fstat function will obtain information about a opened file which may be either real/zipped. The file is supposed to be open (otherwise -1 is returned). The st_size stat-member contains the uncompressed size. The optional d_name is never set here. For a real file, we do set the d_csize := st_size and d_compr := 0 for meaningful defaults.

zzip_dir_alloc_ext_io(zzip_strings_t * ext, const zzip_plugin_io_t io) : ZZIP_DIR *
zzip_dir_alloc(zzip_strings_t * fileext) : ZZIP_DIR *
  start usage. zzip/zip.c

The zzip_dir_alloc_ext_io function allocates a new ZZIP_DIR handle and do basic initializations before usage by zzip_dir_fdopen zzip_dir_open zzip_file_open or through zzip_open (ext==null flags uses { ".zip" , ".ZIP" } ) (io ==null flags use of posix io defaults)

The zzip_dir_alloc function is obsolete - it was generally used for implementation and exported to let other code build on it. It is now advised to use zzip_dir_alloc_ext_io now on explicitly, just set that second argument to zero to achieve the same functionality as the old style.

zzip_dir_free(ZZIP_DIR * dir) : int
zzip_dir_close(ZZIP_DIR * dir) : int
  zzip/zip.c

The zzip_dir_free function will free the zzip_dir handle unless there are still zzip_files attached (that may use its cache buffer). This is the inverse of zzip_dir_alloc , and both are helper functions used implicitly in other zzipcalls e.g. zzip_dir_close = zzip_close

returns zero on success returns the refcount when files are attached.

It will also free(2) the ZZIP_DIR-handle given. the counterpart for zzip_dir_open see also zzip_dir_free

zzip_dir_fdopen(int fd, zzip_error_t * errcode_p) : ZZIP_DIR *
zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errcode_p, zzip_strings_t * ext, const zzip_plugin_io_t io) : ZZIP_DIR *
  fd reopen. zzip/zip.c

The zzip_dir_fdopen function is used by the zzip_dir_open and zzip_opendir(2) call. Opens the zip-archive as specified with the fd which points to an already openend file. The zzip_dir_fdopen function then search and parse the zip's central directory.

NOTE: refcount is zero, so an _open/_close pair will also delete this _dirhandle

the zzip_dir_fdopen_ext_io function uses explicit ext and io instead of the internal defaults, setting these to zero is equivalent to zzip_dir_fdopen

zzip_dir_open(zzip_char_t * filename, zzip_error_t * e) : ZZIP_DIR *
zzip_dir_open_ext_io(zzip_char_t * filename, zzip_error_t * e, zzip_strings_t * ext, zzip_plugin_io_t io) : ZZIP_DIR *
zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * d) : int
  open zip-archive. zzip/zip.c

The zzip_dir_open function opens the given zip-archive (if available). The two ext_io arguments will default to use posix io and a set of default fileext that can atleast add .zip ext itself.

the zzip_dir_open_ext_io function uses explicit ext and io instead of the internal defaults. Setting these to zero is equivalent to zzip_dir_open Note that the referenced ext_io plugin handlers structure must be static as it is not copied to the returned ZZIP_DIR structure.

fills the dirent-argument with the values and increments the read-pointer of the dir-argument.

returns 0 if there no entry (anymore).

zzip_readdir(ZZIP_DIR * dir) : ZZIP_DIRENT *
  read dir. zzip/dir.c

The zzip_readdir function is the equivalent of a readdir(2) for a realdir or a zipfile referenced by the ZZIP_DIR returned from zzip_opendir.

The ZZIP_DIR handle (as returned by zzip_opendir) contains a few more entries than being copied into the ZZIP_DIRENT. The only valid fields in a ZZIP_DIRENT are d_name (the file name), d_compr (compression), d_csize (compressed size), st_size (uncompressed size).

zzip_closedir(ZZIP_DIR * dir) : int
  stop usage. zzip/dir.c

The zzip_closedir function is the equivalent of closedir(3) for a realdir or zipfile.

The zzip_closedir function is magic - if the given arg-ZZIP_DIR is a real directory, it will call the real closedir(3) and then free the wrapping ZZIP_DIR structure. Otherwise it will divert to zzip_dir_close which will free the ZZIP_DIR structure.

zzip_errno(int errcode) : int
 ... zzip/err.c
zzip_file_close(ZZIP_FILE * fp) : int
  end usage. zzip/file.c

The zzip_file_close function is the direct call of zzip_close(fp). It will cleanup the inflate-portion of zlib and free the structure given.

it is called quite from the error-cleanup parts of the various _open functions.

the .refcount is decreased and if zero the fp->dir is closed just as well.

zzip_file_open(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) : ZZIP_FILE *
  start usage. zzip/file.c

The zzip_file_open function opens an ZZIP_FILE from an already open ZZIP_DIR handle. Since we have a chance to reuse a cached buf32k and ZZIP_FILE memchunk this is the best choice to unpack multiple files.

Note: the zlib supports 2..15 bit windowsize, hence we provide a 32k memchunk here... just to be safe.

On error it returns null and sets errcode in the ZZIP_DIR.

zzip_inflate_init(ZZIP_FILE * fp, struct zzip_dir_hdr *hdr) : static int
  internal. zzip/file.c

call inflateInit and setup fp's iterator variables, used by lowlevel _open functions.

zzip_file_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) : zzip_ssize_t
  read data. zzip/file.c

The zzip_file_read function reads data from zip-contained file.

This fuction works like read(2) and will fill the given buffer with bytes from the opened file. It will return the number of bytes read, so if the EOF is encountered you will be prompted with the number of bytes actually read.

This is the routines that needs the buf32k buffer, and it would have need for much more polishing but it does already work quite well.

Note: the 32K buffer is rather big. The original inflate-algorithm required just that but the latest zlib would work just fine with a smaller buffer.

zzip_rewind(ZZIP_FILE * fp) : int
  rewind. zzip/file.c

The zzip_rewind function will rewind a real/zipped file.

It seeks to the beginning of this file's data in the zip, or the beginning of the file for a stat'fd.

zzip_compr_str(int compr) : zzip_char_t *
  compr name. zzip/info.c

The zzip_compr_str function returns the static const string of the known compression methods, Unknown id values will return just "zipped" as the string code.

zzip_filesize(int fd) : zzip_off_t
  get file size. zzip/plugin.c

The zzip_filesize function works on a real file descriptor.

__zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, struct _disk_trailer *_zzip_restrict trailer, zzip_plugin_io_t io) : static int
  internal. zzip/zip.c

The __zzip_fetch_disk_trailer function is used by zzip_file_open. It tries to find the zip's central directory info that is usually a few bytes off the end of the file.

__zzip_parse_root_directory(int fd, struct _disk_trailer *trailer, struct zzip_dir_hdr **hdr_return, zzip_plugin_io_t io, zzip_off_t filesize) : static int
  internal. zzip/zip.c

The __zzip_parse_root_directory function is used by zzip_file_open, it is usually called after __zzip_find_disk_trailer. It will parse the zip's central directory information and create a zziplib private directory table in memory.

__zzip_try_open(zzip_char_t * filename, int filemode, zzip_strings_t * ext, zzip_plugin_io_t io) : int
  internal. zzip/zip.c

The __zzip_try_open function will attach any of the .zip extensions then trying to open it the with open(2). This is a helper function for zzip_dir_open, zzip_opendir and zzip_open.

The __zzip_try_open function returns a new system file handle or -1 on error. On error the __zzip_try_open function leaves the errno(3) of the underlying open(2) call on the last file.