1ZZIP_FOPEN(3)                zziplib Function List               ZZIP_FOPEN(3)
2
3
4

NAME

6       zzip_fopen, zzip_freopen -
7

SYNOPSIS

9       #include <zzip/lib.h>
10
11       ZZIP_FILE* zzip_fopen((zzip_char_t* filename, zzip_char_t* mode));
12
13       ZZIP_FILE*
14                               zzip_freopen((zzip_char_t* filename, zzip_char_t* mode, ZZIP_FILE* stream));
15

DESCRIPTION

17       The zzip_fopen function will fopen(3) a real/zipped file.
18
19       It has some magic functionality builtin - it will first try to open the
20       given filename as a normal file. If it does not exist, the given path
21       to the filename (if any) is split into its directory-part and the
22       file-part. A ".zip" extension is then added to the directory-part to
23       create the name of a zip-archive. That zip-archive (if it exists) is
24       being searched for the file-part, and if found a zzip-handle is
25       returned.
26
27       Note that if the file is found in the normal fs-directory the returned
28       structure is mostly empty and the zzip_read call will use the libc read
29       to obtain data. Otherwise a zzip_file_open is performed and any error
30       mapped to errno(3).
31
32       unlike the posix-wrapper zzip_open the mode-argument is a string which
33       allows for more freedom to support the extra zzip modes called
34       ZZIP_CASEINSENSITIVE and ZZIP_IGNOREPATH. Currently, this zzip_fopen
35       call will convert the following characters in the mode-string into
36       their corrsponding mode-bits:
37       ·    "r" : O_RDONLY : read-only
38       ·    "b" : O_BINARY : binary (win32 specific)
39       ·    "f" : O_NOCTTY : no char device (unix)
40       ·    "i" : ZZIP_CASELESS : inside zip file
41       ·    "*" : ZZIP_NOPATHS : inside zip file only
42
43       all other modes will be ignored for zip-contained entries but they are
44       transferred for compatibility and portability, including these extra
45       sugar bits:
46       ·    "x" : O_EXCL : fail if file did exist
47       ·    "s" : O_SYNC : synchronized access
48       ·    "n" : O_NONBLOCK : nonblocking access
49       ·    "z#" : compression level : for zlib
50       ·    "g#" : group access : unix access bits
51       ·    "u#" : owner access : unix access bits
52       ·    "o#" : world access : unix access bits
53
54       ... the access bits are in traditional unix bit format with 7 =
55       read/write/execute, 6 = read/write, 4 = read-only.
56
57       The default access mode is 0664, and the compression level is ignored
58       since the lib can not yet write zip files, otherwise it would be the
59       initialisation value for the zlib deflateInit where 0 = no-compression,
60       1 = best-speed, 9 = best-compression.
61
62       The zzip_fopen function returns a new zzip-handle (use zzip_close to
63       return it). On error the zzip_fopen function will return null setting
64       errno(3).
65
66       The zzip_freopen function receives an additional argument pointing to a
67       ZZIP_FILE* being already in use. If this extra argument is null then
68       the zzip_freopen function is identical with calling zzip_fopen
69
70       Per default, the old file stream is closed and only the internal
71       structures associated with it are kept. These internal structures may
72       be reused for the return value, and this is a lot quicker when the
73       filename matches a zipped file that is incidently in the very same zip
74       arch as the old filename wrapped in the stream struct.
75
76       That's simply because the zip arch's central directory does not need to
77       be read again. As an extension for the zzip_freopen function, if the
78       mode-string contains a "q" then the old stream is not closed but left
79       untouched, instead it is only given as a hint that a new file handle
80       may share/copy the zip arch structures of the old file handle if that
81       is possible, i.e when they are in the same zip arch.
82
83       The zzip_freopen function returns a new zzip-handle (use zzip_close to
84       return it). On error the zzip_freopen function will return null setting
85       errno(3).
86

AUTHOR

88       ·   Guido Draheim <guidod@gmx.de> Tomi Ollila <Tomi.Ollila@iki.fi>
89
91       Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim All rights
92       reserved, use under the restrictions of the Lesser GNU General Public
93       License or alternatively the restrictions of the Mozilla Public License
94       1.1
95

SEE ALSO

97       fopen(2)
98
99
100
101zziplib                             0.13.49                      ZZIP_FOPEN(3)
Impressum