plugin.h \
lib.h \
zzip.h \
+ write.h \
fetch.h \
format.h \
info.h \
plugin.h \
lib.h \
zzip.h \
+ write.h \
fetch.h \
format.h \
info.h \
+/*
+ * These routines are helpers - note that this file gets linked into all the
+ * zip-access variants that refer to <zzip/format.h>. On the x86 platform the
+ * actual definitions will be empty - fetching is done on native machine-level
+ *
+ * Author:
+ * Guido Draheim <guidod@gmx.de>
+ *
+ * Copyright (c) 2004,2005,2006 Guido Draheim
+ * All rights reserved,
+ * use under the restrictions of the
+ * Lesser GNU General Public License
+ * or alternatively the restrictions
+ * of the Mozilla Public License 1.1
+ */
+
#include <zzip/fetch.h>
#if defined ZZIP_WORDS_BIGENDIAN && \
/* ------------------------------------------------------------------- */
-/**
+/** also: fopen(2)
* This function will => fopen(3) a real/zipped file.
*
* It has some magic functionality builtin - it will first try to open
* 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:
- * <ul><li><code> "r" : O_RDONLY : </code> read-only
- * </li><li><code> "b" : O_BINARY : </code> binary (win32 specific)
- * </li><li><code> "f" : O_NOCTTY : </code> no char device (unix)
- * </li><li><code> "i" : ZZIP_CASELESS : </code> inside zip file
- * </li><li><code> "*" : ZZIP_NOPATHS : </code> inside zip file only
- * </ul> all other modes will be ignored for zip-contained entries
+ * * <code> "r" : O_RDONLY : </code> read-only
+ * * <code> "b" : O_BINARY : </code> binary (win32 specific)
+ * * <code> "f" : O_NOCTTY : </code> no char device (unix)
+ * * <code> "i" : ZZIP_CASELESS : </code> inside zip file
+ * * <code> "*" : ZZIP_NOPATHS : </code> 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:
- * <ul><li><code> "x" : O_EXCL :</code> fail if file did exist
- * </li><li><code> "s" : O_SYNC :</code> synchronized access
- * </li><li><code> "n" : O_NONBLOCK :</code> nonblocking access
- * </li><li><code> "z#" : compression level :</code> for zlib
- * </li><li><code> "g#" : group access :</code> unix access bits
- * </li><li><code> "u#" : owner access :</code> unix access bits
- * </li><li><code> "o#" : world access :</code> unix access bits
- * </ul>... the access bits are in traditional unix bit format
+ * * <code> "x" : O_EXCL :</code> fail if file did exist
+ * * <code> "s" : O_SYNC :</code> synchronized access
+ * * <code> "n" : O_NONBLOCK :</code> nonblocking access
+ * * <code> "z#" : compression level :</code> for zlib
+ * * <code> "g#" : group access :</code> unix access bits
+ * * <code> "u#" : owner access :</code> unix access bits
+ * * <code> "o#" : world access :</code> 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
* 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. This function
- * is shallow in that it just extracts the zzipflags and calls <ul><li><code>
- * zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0) </code></li></ul>
- * you must stop using this extra functionality (not well known
- * anyway) since zzip_open might be later usable to open files
+ * is shallow in that it just extracts the zzipflags and calls <ul><li><p>
+ * <code>zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0) </code>
+ * </p></li></ul> 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
return err;
}
-/**
+/**
* This 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,
#define _LARGEFILE_SOURCE 1
#define _ZZIP_ENTRY_STRUCT 1
-#include <zzip/types.h>
+#include <zzip/fseeko.h>
+
+#include <zzip/fetch.h>
+#include <zzip/__mmap.h>
+#include <zzip/__fnmatch.h>
#include <assert.h>
#include <stdlib.h>
#include <strings.h>
#endif
-#include <zlib.h>
-#include <zzip/format.h>
-#include <zzip/fseeko.h>
-#include <zzip/fetch.h>
-#include <zzip/__mmap.h>
-#include <zzip/__fnmatch.h>
-
#if __STDC_VERSION__+0 > 199900L
#define ___
#define ____
#include <zzip/types.h>
#include <stdio.h>
+#ifdef _ZZIP_ENTRY_STRUCT
+#include <zlib.h>
+#include <zzip/format.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
* Author:
* Guido Draheim <guidod@gmx.de>
*
- * Copyright (c) 2003,2004 Guido Draheim
+ * Copyright (c) 2003,2004,2006 Guido Draheim
* All rights reserved,
* use under the restrictions of the
* Lesser GNU General Public License
* of the Mozilla Public License 1.1
*/
+#define _ZZIP_DISK_FILE_STRUCT 1
+
#ifdef __linux__
-#define _GNU_SOURCE _glibc_developers_are_idiots_to_call_this_gnu_specific_
+#define _GNU_SOURCE _glibc_developers_are_idiots_to_call_strndup_gnu_specific_
#endif
-#define _ZZIP_DISK_FILE_STRUCT 1
-
-#include <zzip/types.h>
+#include <zzip/mmapped.h>
+#include <zzip/format.h>
+#include <zzip/fetch.h>
+#include <zzip/__mmap.h>
+#include <zzip/__fnmatch.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <strings.h>
#endif
-#include <zlib.h>
-#include <zzip/mmapped.h>
-#include <zzip/format.h>
-#include <zzip/fetch.h>
-#include <zzip/__mmap.h>
-#include <zzip/__fnmatch.h>
#if __STDC_VERSION__+0 > 199900L
#define ___
#include <zzip/types.h>
+#ifdef _ZZIP_DISK_FILE_STRUCT
+#include <zlib.h> /* z_stream */
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
* where time-stamps are rather unimportant. Here we can create an
* archive with filenames and their data portions, possibly obfuscated.
*
+ * DONT USE THIS
+ *
+ * The write support is supposed to be added directly into the main
+ * zziplib but it has not been implemented so far. It does however
+ * export the relevant call entries which will return EROFS (read-only
+ * filesystem) in case they are being called. That allows later programs
+ * to start up with earlier versions of zziplib that can only read ZIPs.
+ *
* Author:
* Guido Draheim <guidod@gmx.de>
*
#define _ZZIP_POSIX_WRITE
#endif
-#include <zzip/lib.h> /* exported...*/
+#include <zzip/write.h> /* #includes <zzip/lib.h> */
#include <zzip/file.h>
#include <string.h>
return zzip_dir_creat (name, o_mode);
}
-/** => zzip_file_creat => mkdir(2), creat(2), zzip_dir_creat
+/** => zzip_file_creat also: mkdir(2), creat(2), zzip_dir_creat
*
* This function has an additional primary argument over the posix
* mkdir(2) - if it is null then this function behaves just like
--- /dev/null
+#ifndef _ZZIP_WRITE_H
+#define _ZZIP_WRITE_H
+
+#include <zzip/lib.h>
+
+/* ........................................................................
+ * write support is not yet implemented
+ * zzip/write.c
+ */
+#define ZZIP_NO_CREAT 1
+
+ZZIP_DIR* zzip_dir_creat_ext_io(zzip_char_t* name, int o_mode,
+ zzip_strings_t* ext, zzip_plugin_io_t io);
+ZZIP_DIR* zzip_dir_creat(zzip_char_t* name, int o_mode);
+int zzip_file_mkdir(ZZIP_DIR* dir, zzip_char_t* name, int o_mode);
+ZZIP_FILE* zzip_file_creat(ZZIP_DIR* dir, zzip_char_t* name, int o_mode);
+zzip_ssize_t zzip_file_write(ZZIP_FILE* file,
+ const void* ptr, zzip_size_t len);
+
+ZZIP_DIR* zzip_createdir(zzip_char_t* name, int o_mode);
+zzip_ssize_t zzip_write(ZZIP_FILE* file, const void* ptr, zzip_size_t len);
+zzip_size_t zzip_fwrite(const void* ptr, zzip_size_t len,
+ zzip_size_t multiply, ZZIP_FILE* file);
+#ifndef zzip_savefile
+#define zzip_savefile 0
+#define zzip_savefile_is_null
+#endif
+
+#ifdef _ZZIP_NO_INLINE
+#define zzip_mkdir(_name_,_mode_) \
+ zzip_file_mkdir((zzip_savefile),(_name_),(_mode_))
+#define zzip_creat(_name_,_mode_) \
+ zzip_file_creat((zzip_savefile),(_name_),(_mode_))
+#define zzip_sync() \
+ { zzip_closedir((zzip_savefile)); (zzip_savefile) = 0; }
+#define zzip_start(_name_,_mode_,_ext_) \
+ { if ((zzip_savefile)) zzip_closedir((zzip_savefile));
+ zzip_savefile = zzip_dir_creat(_name_, _mode_,_ext_); }
+
+#else
+
+_zzip_inline static int zzip_mkdir(zzip_char_t* name, int o_mode)
+{ return zzip_file_mkdir(zzip_savefile, name, o_mode); }
+_zzip_inline static ZZIP_FILE* zzip_creat(zzip_char_t* name, int o_mode)
+{ return zzip_file_creat(zzip_savefile, name, o_mode); }
+
+#ifndef zzip_savefile_is_null
+_zzip_inline static void zzip_sync(void)
+{ zzip_closedir(zzip_savefile); zzip_savefile = 0; }
+_zzip_inline static void zzip_mkfifo(zzip_char_t* name, int o_mode)
+{ if ((zzip_savefile)) zzip_closedir (zzip_savefile);
+ zzip_savefile = zzip_createdir(_name_,_mode_); }
+#else
+_zzip_inline static void zzip_sync(void) {}
+_zzip_inline static void zzip_mkfifo(zzip_char_t* name, int o_mode) {}
+#endif
+#endif /* _ZZIP_NO_INLINE */
+#endif /* _ZZIP_WRITE_H */
/* zzip_file_open_ext_io => zzip_dir_open_ext_io + zzip_file_open */
-#if defined _ZZIP_WRITE_SOURCE
-/* ........................................................................
- * write support is not yet implemented
- * zzip/write.c
- */
-#define ZZIP_NO_CREAT 1
-
-ZZIP_DIR* zzip_dir_creat_ext_io(zzip_char_t* name, int o_mode,
- zzip_strings_t* ext, zzip_plugin_io_t io);
-ZZIP_DIR* zzip_dir_creat(zzip_char_t* name, int o_mode);
-int zzip_file_mkdir(ZZIP_DIR* dir, zzip_char_t* name, int o_mode);
-ZZIP_FILE* zzip_file_creat(ZZIP_DIR* dir, zzip_char_t* name, int o_mode);
-zzip_ssize_t zzip_file_write(ZZIP_FILE* file,
- const void* ptr, zzip_size_t len);
-
-ZZIP_DIR* zzip_createdir(zzip_char_t* name, int o_mode);
-zzip_ssize_t zzip_write(ZZIP_FILE* file, const void* ptr, zzip_size_t len);
-zzip_size_t zzip_fwrite(const void* ptr, zzip_size_t len,
- zzip_size_t multiply, ZZIP_FILE* file);
-#ifndef zzip_savefile
-#define zzip_savefile 0
-#define zzip_savefile_is_null
-#endif
-
-#ifdef _ZZIP_NO_INLINE
-#define zzip_mkdir(_name_,_mode_) \
- zzip_file_mkdir((zzip_savefile),(_name_),(_mode_))
-#define zzip_creat(_name_,_mode_) \
- zzip_file_creat((zzip_savefile),(_name_),(_mode_))
-#define zzip_sync() \
- { zzip_closedir((zzip_savefile)); (zzip_savefile) = 0; }
-#define zzip_start(_name_,_mode_,_ext_) \
- { if ((zzip_savefile)) zzip_closedir((zzip_savefile));
- zzip_savefile = zzip_dir_creat(_name_, _mode_,_ext_); }
-
-#else
-
-_zzip_inline static int zzip_mkdir(zzip_char_t* name, int o_mode)
-{ return zzip_file_mkdir(zzip_savefile, name, o_mode); }
-_zzip_inline static ZZIP_FILE* zzip_creat(zzip_char_t* name, int o_mode)
-{ return zzip_file_creat(zzip_savefile, name, o_mode); }
-
-#ifndef zzip_savefile_is_null
-_zzip_inline static void zzip_sync(void)
-{ zzip_closedir(zzip_savefile); zzip_savefile = 0; }
-_zzip_inline static void zzip_mkfifo(zzip_char_t* name, int o_mode)
-{ if ((zzip_savefile)) zzip_closedir (zzip_savefile);
- zzip_savefile = zzip_createdir(_name_,_mode_); }
-#else
-_zzip_inline static void zzip_sync(void) {}
-_zzip_inline static void zzip_mkfifo(zzip_char_t* name, int o_mode) {}
-#endif
-#endif /* _ZZIP_NO_INLINE */
-#endif /* _ZZIP_WRITE_SOURCE */
-
#ifdef __cplusplus
};
#endif