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
38       ·    "r" : O_RDONLY : read-only
39
40       ·    "b" : O_BINARY : binary (win32 specific)
41
42       ·    "f" : O_NOCTTY : no char device (unix)
43
44       ·    "i" : ZZIP_CASELESS : inside zip file
45
46       ·    "*" : ZZIP_NOPATHS : inside zip file only
47
48       all other modes will be ignored for zip-contained entries but they are
49       transferred for compatibility and portability, including these extra
50       sugar bits:
51
52       ·    "x" : O_EXCL : fail if file did exist
53
54       ·    "s" : O_SYNC : synchronized access
55
56       ·    "n" : O_NONBLOCK : nonblocking access
57
58       ·    "z#" : compression level : for zlib
59
60       ·    "g#" : group access : unix access bits
61
62       ·    "u#" : owner access : unix access bits
63
64       ·    "o#" : world access : unix access bits
65
66       ... the access bits are in traditional unix bit format with 7 =
67       read/write/execute, 6 = read/write, 4 = read-only.
68
69       The default access mode is 0664, and the compression level is ignored
70       since the lib can not yet write zip files, otherwise it would be the
71       initialisation value for the zlib deflateInit where 0 = no-compression,
72       1 = best-speed, 9 = best-compression.
73
74       The zzip_fopen function returns a new zzip-handle (use zzip_close to
75       return it). On error the zzip_fopen function will return null setting
76       errno(3).
77
78       The zzip_freopen function receives an additional argument pointing to a
79       ZZIP_FILE* being already in use. If this extra argument is null then
80       the zzip_freopen function is identical with calling zzip_fopen
81
82       Per default, the old file stream is closed and only the internal
83       structures associated with it are kept. These internal structures may
84       be reused for the return value, and this is a lot quicker when the
85       filename matches a zipped file that is incidently in the very same zip
86       arch as the old filename wrapped in the stream struct.
87
88       That´s simply because the zip arch´s central directory does not need to
89       be read again. As an extension for the zzip_freopen function, if the
90       mode-string contains a "q" then the old stream is not closed but left
91       untouched, instead it is only given as a hint that a new file handle
92       may share/copy the zip arch structures of the old file handle if that
93       is possible, i.e when they are in the same zip arch.
94
95       The zzip_freopen function returns a new zzip-handle (use zzip_close to
96       return it). On error the zzip_freopen function will return null setting
97       errno(3).
98

AUTHOR

100       ·   Guido Draheim <guidod@gmx.de> Tomi Ollila <Tomi.Ollila@iki.fi>
101
103       Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim All rights
104       reserved, use under the restrictions of the Lesser GNU General Public
105       License or alternatively the restrictions of the Mozilla Public License
106       1.1
107

SEE ALSO

109       fopen(2)
110
111
112
113zziplib                             0.13.49                      ZZIP_FOPEN(3)
Impressum