summaryrefslogtreecommitdiff
path: root/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c')
-rw-r--r--Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c
new file mode 100644
index 00000000000..ceec003ffb6
--- /dev/null
+++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2003 Guido Draheim <guidod@gmx.de>
+ * Use freely under the restrictions of the ZLIB license.
+ *
+ * This file is used as an example to clarify zzipfseeko api usage.
+ */
+
+#include <zzip/fseeko.h>
+#include <stdlib.h>
+#include <string.h>
+#include "unzzip.h"
+
+#ifdef ZZIP_HAVE_FNMATCH_H
+#include <fnmatch.h>
+#else
+#define fnmatch(x,y,z) strcmp(x,y)
+#endif
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifdef DEBUG
+#define debug1(msg) do { fprintf(stderr, "%s : " msg "\n", __func__); } while(0)
+#define debug2(msg, arg1) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1); } while(0)
+#define debug3(msg, arg1, arg2) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2); } while(0)
+#else
+#define debug1(msg)
+#define debug2(msg, arg1)
+#define debug3(msg, arg1, arg2)
+#endif
+
+int unzzip_list (int argc, char ** argv)
+{
+ int argn;
+ FILE* disk;
+
+ disk = fopen (argv[1], "r");
+ if (! disk) {
+ perror(argv[1]);
+ return -1;
+ }
+
+ if (argc == 2)
+ { /* print directory list */
+ ZZIP_ENTRY* entry = zzip_entry_findfirst(disk);
+ for (; entry ; entry = zzip_entry_findnext(entry))
+ {
+ char* name = zzip_entry_strdup_name (entry);
+ printf (" %s \n", name);
+ free (name);
+ }
+ return 0;
+ }
+
+ for (argn=1; argn < argc; argn++)
+ { /* list only the matching entries - each in order of commandline */
+ ZZIP_ENTRY* entry = zzip_entry_findfirst(disk);
+ for (; entry ; entry = zzip_entry_findnext(entry))
+ {
+ char* name = zzip_entry_strdup_name (entry);
+ printf (" %s \n", name);
+ free (name);
+ }
+ }
+ return 0;
+}
+
+/*
+ * Local variables:
+ * c-file-style: "stroustrup"
+ * End:
+ */