www.LinuxHowtos.org





ZIP_NAME_LOCATE

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

zip_name_locate - get index of file by name  

LIBRARY

libzip -lzip)  

SYNOPSIS

In zip.h Ft zip_int64_t Fn zip_name_locate zip_t *archive const char *fname zip_flags_t flags  

DESCRIPTION

The Fn zip_name_locate function returns the index of the file named fname in archive If archive does not contain a file with that name, -1 is returned.

If neither ZIP_FL_ENC_RAW nor ZIP_FL_ENC_STRICT are specified, guess the encoding of the name in the ZIP archive and convert it to UT-8, if necessary, before comparing.

If neither ZIP_FL_ENC_CP437 nor ZIP_FL_ENC_UTF_8 are specified, guess the encoding of fname

Only C-437 and UT-8 are recognized.

The Fa flags are specified by or 'ing the following values, or 0 for none of them.

ZIP_FL_NOCASE
Ignore case distinctions. (Will only work well if the file names are ASCII.) With this flag, Fn zip_name_locate will be slow for archives with many files.
ZIP_FL_NODIR
Ignore directory part of file name in archive. With this flag, Fn zip_name_locate will be slow for archives with many files.
ZIP_FL_ENC_GUESS
This flag has no effect (its value is 0); it can be used to explicitly denote the absence of encoding flags.
ZIP_FL_ENC_RAW
Compare fname against the unmodified names as they are in the ZIP archive, without converting them to UT-8.
ZIP_FL_ENC_STRICT
Follow the ZIP specification and expect C-437 encoded names in the ZIP archive (except if they are explicitly marked as UT-8). Convert them to UT-8 before comparing.
ZIP_FL_ENC_CP437
fname is encoded as C-437.
ZIP_FL_ENC_UTF_8
fname is encoded as UT-8.

Note ASCII is a subset of both C-437 and UT-8.  

RETURN VALUES

Fn zip_name_locate returns the index of the file named fname or -1, if archive does not contain an entry of that name.  

ERRORS

Fn zip_name_locate fails if:

Bq Er ZIP_ER_INVAL
One of the arguments is invalid.
Bq Er ZIP_ER_MEMORY
Required memory could not be allocated.
Bq Er ZIP_ER_NOENT
No entry of the name fname is found in the archive.

 

SEE ALSO

libzip(3), zip_get_name3  

HISTORY

Fn zip_name_locate was added in libzip 0.6. In libzip 0.11 the return type was changed from Vt int to Vt zip_int64_t . In libzip 0.11 the type of flags was changed from Vt int to Vt zip_flags_t .  

AUTHORS

An -nosplit An Dieter Baron Aq Mt dillo@nih.at and An Thomas Klausner Aq Mt wiz@gatalith.at


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
RETURN VALUES
ERRORS
SEE ALSO
HISTORY
AUTHORS