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.c50
1 files changed, 33 insertions, 17 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
index a1d14119fa0..e35648ac21e 100644
--- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c
+++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c
@@ -5,10 +5,14 @@
* This file is used as an example to clarify zzipfseeko api usage.
*/
+#define _ZZIP_ENTRY_STRUCT 1
+
#include <zzip/fseeko.h>
+#include <zzip/fetch.h>
#include <stdlib.h>
#include <string.h>
-#include "unzzip.h"
+#include "unzzipdir-zip.h"
+#include "unzzip-states.h"
#ifdef ZZIP_HAVE_FNMATCH_H
#include <fnmatch.h>
@@ -16,21 +20,17 @@
#define fnmatch(x,y,z) strcmp(x,y)
#endif
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
+static const char* comprlevel[] = {
+ "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4",
+ "impl:N", "toknze", "defl:N", "defl:B", "impl:B" };
-#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
+static int exitcode(int e)
+{
+ return EXIT_ERRORS;
+}
-int unzzip_list (int argc, char ** argv)
+static int
+unzzip_list (int argc, char ** argv, int verbose)
{
int argn;
FILE* disk;
@@ -38,7 +38,7 @@ int unzzip_list (int argc, char ** argv)
disk = fopen (argv[1], "rb");
if (! disk) {
perror(argv[1]);
- return -1;
+ return exitcode(errno);
}
if (argc == 2)
@@ -47,7 +47,9 @@ int unzzip_list (int argc, char ** argv)
for (; entry ; entry = zzip_entry_findnext(entry))
{
char* name = zzip_entry_strdup_name (entry);
- printf (" %s \n", name);
+ unsigned compr = zzip_entry_compr(entry);
+ const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)";
+ printf (" %s %s\n", defl, name);
free (name);
}
return 0;
@@ -59,13 +61,27 @@ int unzzip_list (int argc, char ** argv)
for (; entry ; entry = zzip_entry_findnext(entry))
{
char* name = zzip_entry_strdup_name (entry);
- printf (" %s \n", name);
+ unsigned compr = zzip_entry_compr(entry);
+ const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)";
+ printf (" %s %s\n", defl, name);
free (name);
}
}
return 0;
}
+int
+unzzip_long_list (int argc, char ** argv)
+{
+ return unzzip_list(argc, argv, 1);
+}
+
+int
+unzzip_show_list (int argc, char ** argv)
+{
+ return unzzip_list(argc, argv, 0);
+}
+
/*
* Local variables:
* c-file-style: "stroustrup"