* fix bugs for decompression on the latter as well
it seems the one has to use inflateInit2 (..., -MAX_WBITS)
* added bins/unzzipshow for an example binary
+ * added "--help" and "--version" to all bins examples
2003-12-24
* added libzzipmmap.la with a simplified interface to zip archives
* This file is used as an example to clarify zzip api usage.
*/
-#include <stdio.h>
-#include <stdlib.h>
#include <zzip/zzip.h>
+#include <stdio.h>
+#include <string.h>
#ifdef ZZIP_HAVE_UNISTD_H
#include <unistd.h>
int exitcode = 0;
zzip_error_t error;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
}
-
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
+ }
+
for (argn=1; argn < argc; argn++)
{
ZZIP_DIR * dir;
ZZIP_DIRENT d;
-
+
dir = zzip_dir_open(argv[argn], &error);
if (! dir)
{
* This file is used as an example to clarify zzipmmap api usage.
*/
+#include <zzip/mmapped.h>
#include <stdio.h>
#include <stdlib.h>
-#include <zzip/mmapped.h>
+#include <string.h>
#ifdef ZZIP_HAVE_UNISTD_H
#include <unistd.h>
int argn;
ZZIP_DISK* disk;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
disk = zzip_disk_open (argv[1]);
* This file is used as an example to clarify zzipmmap api usage.
*/
+#include <zzip/mmapped.h>
#include <stdio.h>
#include <stdlib.h>
-#include <zzip/mmapped.h>
+#include <string.h>
#ifdef ZZIP_HAVE_UNISTD_H
#include <unistd.h>
int argn;
ZZIP_DISK* disk;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
disk = zzip_disk_open (argv[1]);
#include <zzip/fseeko.h>
#include <stdlib.h>
+#include <string.h>
#ifdef ZZIP_HAVE_FNMATCH_H
#include <fnmatch.h>
int argn;
FILE* disk;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
disk = fopen (argv[1], "r");
* Use freely under the restrictions of the ZLIB License
*/
-#include <stdio.h>
-#include <stdlib.h>
#include <zzip/zzip.h>
+#include <stdio.h>
+#include <string.h>
#ifndef O_BINARY
#define O_BINARY 0
main (int argc, char ** argv)
{
int argn;
- if (argc <= 1)
+
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit (0);
+ return 0;
}
-
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
+ }
+
for (argn=1; argn < argc; argn++)
{
ZZIP_FILE* fp = zzip_open (argv[argn], O_RDONLY|O_BINARY);
* Use freely under the restrictions of the ZLIB license.
*/
-#include <stdio.h>
-#include <stdlib.h>
#include <zzip/zzip.h>
+#include <stdio.h>
+#include <string.h>
#ifndef O_BINARY
#define O_BINARY 0
{
int argn;
int exitcode = 0;
- if (argc <= 1)
+
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
}
-
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
+ }
+
for (argn=1; argn < argc; argn++)
{
ZZIP_DIR * dir;
#define _ZZIP_WRITE_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
#include <zzip/zzip.h>
+#include <stdio.h>
+#include <string.h>
#ifdef ZZIP_HAVE_UNISTD_H
#include <unistd.h>
int argn;
int exitcode = 0;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
ZZIP_DIR * dir;
*/
#include <stdio.h>
+#include <string.h>
#if defined _MSC_VER /* Win32*/
#define WIN32_LEAN_AND_MEAN
if (argc > 1 && argv[1] != NULL)
{
- name = argv[1];
- argv++; argc--;
+ if (! strcmp (argv[1], "--help")) {
+ printf ("zziptest [testfile]\n - selftest defaults to 'test.zip'");
+ return 0;
+ }else if (! strcmp (argv[1], "--version")) {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
+ }else{
+ name = argv[1];
+ argv++; argc--;
+ }
}
printf("Opening zip file `%s'... ", name);
int
main (int argc, char* argv[])
{
- if (argc <= 1 || argc > 3)
+ if (argc <= 1 || argc > 3 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit (0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
if (strlen(argv[1]) > 128) {
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
#include <zzip/zzip.h>
#include <zzip/plugin.h>
int argn;
xor_value = 0x55;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit (0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
zzip_init_io (&xor_handlers, 0); xor_handlers.read = &xor_read;
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
+#include <zzip/_config.h> /* for ZZIP_VERSION */
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
int argn;
xor_value = 0x55;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit (0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
for (argn=1; argn < argc; argn++)
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
#include <zzip/zzip.h>
int exitcode = 0;
xor_value = 0x55;
- if (argc <= 1)
+ if (argc <= 1 || ! strcmp (argv[1], "--help"))
{
printf (usage);
- exit(0);
+ return 0;
+ }
+ if (! strcmp (argv[1], "--version"))
+ {
+ printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
+ return 0;
}
zzip_init_io (&xor_handlers, 0); xor_handlers.fd.read = &xor_read;