diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-03-18 00:25:18 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-03-18 00:25:18 +0000 |
commit | e62a7bd0553ee23d5ff91ef2fa89a5558ccc58db (patch) | |
tree | 8e0b25559cc31478e6d19f21fe10cac841e5b327 /Build/source/libs/zziplib/zziplib-src/bins | |
parent | de28cbce128eea40f3e90af96d0e1807b742c3a6 (diff) |
zziplib-0.13.69
git-svn-id: svn://tug.org/texlive/trunk@47004 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/zziplib/zziplib-src/bins')
12 files changed, 210 insertions, 107 deletions
diff --git a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am index 9483dc9c97f..ed1df98d428 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am @@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign AUTOTOOL_VERSION=autoconf-2.52 automake-1.5 libtool-1.4.2 DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 +CFLAGS = @CFLAGS@ @ASAN_CFLAGS@ bin_PROGRAMS = zzcat zzdir zzxorcat zzxordir zzxorcopy \ unzzip unzzip-mix unzzip-mem unzzip-big unzip-mem @@ -20,26 +21,26 @@ noinst_HEADERS = unzzipdir-zip.h unzzipcat-zip.h unzzip-states.h zzipmake-zip.h EXTRA_DIST = $(aclocal_DATA) $(noinst_HEADERS) CLEANFILES = $(WCC10_CLEAN) -zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ -zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ zzip_SOURCES = zzip.c zzipmake-zip.c -unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_SOURCES = unzzip.c unzzipcat-zip.c unzzipdir-zip.c -unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_mix_SOURCES = unzzip.c unzzipcat-mix.c unzzipdir-mix.c -unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz +unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_mem_SOURCES = unzzip.c unzzipcat-mem.c unzzipdir-mem.c -unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz +unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_big_SOURCES = unzzip.c unzzipcat-big.c unzzipdir-big.c -unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz +unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@ ../zzip/libzzip.la : @top_srcdir@/zzip/*.c (cd ../zzip && $(MAKE) `basename $@`) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in index a37d61184a9..3a9b806ca24 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,17 @@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -88,9 +98,6 @@ bin_PROGRAMS = zzcat$(EXEEXT) zzdir$(EXEEXT) zzxorcat$(EXEEXT) \ noinst_PROGRAMS = zziptest$(EXEEXT) zzobfuscated$(EXEEXT) \ zzip$(EXEEXT) subdir = bins -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/uses/mkinstalldirs $(top_srcdir)/uses/depcomp \ - $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ac_set_default_paths_system.m4 \ @@ -101,6 +108,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_strict_prototypes.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ $(top_srcdir)/m4/ax_enable_builddir.m4 \ @@ -123,6 +131,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/uses/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -270,19 +280,23 @@ am__define_uniq_tagged_files = \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/uses/depcomp \ + $(top_srcdir)/uses/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ +ASAN_CFLAGS = @ASAN_CFLAGS@ +ASAN_LIBS = @ASAN_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ @ASAN_CFLAGS@ CONFIG_FILES = @CONFIG_FILES@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -315,8 +329,10 @@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MKZIP = @MKZIP@ NM = @NM@ @@ -363,6 +379,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ aclocaldir = $(datadir)/aclocal @@ -397,7 +414,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -429,23 +445,23 @@ WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt noinst_HEADERS = unzzipdir-zip.h unzzipcat-zip.h unzzip-states.h zzipmake-zip.h EXTRA_DIST = $(aclocal_DATA) $(noinst_HEADERS) CLEANFILES = $(WCC10_CLEAN) -zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ +zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ zzip_SOURCES = zzip.c zzipmake-zip.c -unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_SOURCES = unzzip.c unzzipcat-zip.c unzzipdir-zip.c -unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_mix_SOURCES = unzzip.c unzzipcat-mix.c unzzipdir-mix.c -unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz +unzzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_mem_SOURCES = unzzip.c unzzipcat-mem.c unzzipdir-mem.c -unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz +unzzip_big_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz @ASAN_LIBS@ unzzip_big_SOURCES = unzzip.c unzzipcat-big.c unzzipdir-big.c -unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz +unzip_mem_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz @ASAN_LIBS@ all: all-am .SUFFIXES: @@ -462,7 +478,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bins/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bins/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -622,14 +637,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -874,6 +889,8 @@ uninstall-am: uninstall-aclocalDATA uninstall-binPROGRAMS tags tags-am uninstall uninstall-aclocalDATA uninstall-am \ uninstall-binPROGRAMS +.PRECIOUS: Makefile + ../zzip/libzzip.la : @top_srcdir@/zzip/*.c (cd ../zzip && $(MAKE) `basename $@`) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c index b20bf37d6c5..c45cb72b835 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c @@ -8,6 +8,7 @@ #include <zlib.h> /* crc32 */ #include <zzip/memdisk.h> +#include <zzip/__fnmatch.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -21,12 +22,6 @@ #include <time.h> -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - #define ___ { #define ____ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c index 7ab6bad9b15..982d262dbe8 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c @@ -136,7 +136,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) char* name = zzip_entry_strdup_name (entry); DBG3(".. check '%s' to zip '%s'", argv[argn], name); if (! _zzip_fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) { FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c index 13cca3aaf7b..9bc966b90db 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c @@ -89,7 +89,7 @@ static FILE* create_fopen(char* name, char* mode, int subdirs) static int unzzip_cat (int argc, char ** argv, int extract) { - int done; + int done = 0; int argn; ZZIP_MEM_DISK* disk; @@ -116,47 +116,50 @@ static int unzzip_cat (int argc, char ** argv, int extract) FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); if (! out) { - if (errno != EISDIR) done = EXIT_ERRORS; + if (errno != EISDIR) { + DBG3("can not open output file %i %s", errno, strerror(errno)); + done = EXIT_ERRORS; + } continue; } unzzip_mem_disk_cat_file (disk, name, out); if (extract) fclose(out); } - return done; - } - - if (argc == 3 && !extract) + } + else if (argc == 3 && !extract) { /* list from one spec */ ZZIP_MEM_ENTRY* entry = 0; while ((entry = zzip_mem_disk_findmatch(disk, argv[2], entry, 0, 0))) { unzzip_mem_entry_fprint (disk, entry, stdout); } - - return 0; - } - - for (argn=1; argn < argc; argn++) - { /* list only the matching entries - each in order of commandline */ - ZZIP_MEM_ENTRY* entry = zzip_mem_disk_findfirst(disk); - for (; entry ; entry = zzip_mem_disk_findnext(disk, entry)) - { - char* name = zzip_mem_entry_to_name (entry); - if (! _zzip_fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + } else { + for (argn=1; argn < argc; argn++) + { /* list only the matching entries - each in order of commandline */ + ZZIP_MEM_ENTRY* entry = zzip_mem_disk_findfirst(disk); + for (; entry ; entry = zzip_mem_disk_findnext(disk, entry)) { - FILE* out = stdout; - if (extract) out = create_fopen(name, "wb", 1); - if (! out) { - if (errno != EISDIR) done = EXIT_ERRORS; - continue; - } - unzzip_mem_disk_cat_file (disk, name, out); - if (extract) fclose(out); - break; /* match loop */ + char* name = zzip_mem_entry_to_name (entry); + if (! _zzip_fnmatch (argv[argn], name, + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) + { + FILE* out = stdout; + if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) { + DBG3("can not open output file %i %s", errno, strerror(errno)); + done = EXIT_ERRORS; + } + continue; + } + unzzip_mem_disk_cat_file (disk, name, out); + if (extract) fclose(out); + break; /* match loop */ + } } } } + zzip_mem_disk_close(disk); return done; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c index aa9b86c4915..91c2f009c0f 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c @@ -143,7 +143,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) for (argn=1; argn < argc; argn++) { if (! _zzip_fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) { FILE* out = stdout; char* zip_name = argv[1]; diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c index 216be41ee29..2810f85a42b 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c @@ -143,7 +143,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) for (argn=1; argn < argc; argn++) { if (! _zzip_fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) { FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); 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 e35648ac21e..7b66875d115 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c @@ -9,17 +9,12 @@ #include <zzip/fseeko.h> #include <zzip/fetch.h> +#include <zzip/__fnmatch.h> #include <stdlib.h> #include <string.h> #include "unzzipdir-zip.h" #include "unzzip-states.h" -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - static const char* comprlevel[] = { "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c index 79d64911844..beca7887c9b 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c @@ -7,6 +7,7 @@ #include <zzip/memdisk.h> #include <zzip/__debug.h> +#include <zzip/__fnmatch.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -20,12 +21,6 @@ #include <io.h> #endif -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - static const char* comprlevel[] = { "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; @@ -73,10 +68,8 @@ unzzip_list (int argc, char ** argv, int verbose) printf ("%lli/%lli %s %s\n", csize, usize, defl, name); } } - return 0; } - - if (argc == 3) + else if (argc == 3) { /* list from one spec */ ZZIP_MEM_ENTRY* entry = 0; while ((entry = zzip_mem_disk_findmatch(disk, argv[2], entry, 0, 0))) @@ -94,9 +87,8 @@ unzzip_list (int argc, char ** argv, int verbose) printf ("%lli/%lli %s %s\n", csize, usize, defl, name); } } - return 0; } - + else { /* list only the matching entries - in order of zip directory */ ZZIP_MEM_ENTRY* entry = zzip_mem_disk_findfirst(disk); for (; entry ; entry = zzip_mem_disk_findnext(disk, entry)) @@ -104,8 +96,8 @@ unzzip_list (int argc, char ** argv, int verbose) char* name = zzip_mem_entry_to_name (entry); for (argn=1; argn < argc; argn++) { - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! _zzip_fnmatch (argv[argn], name, + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) { char* name = zzip_mem_entry_to_name (entry); long long usize = entry->zz_usize; @@ -123,8 +115,9 @@ unzzip_list (int argc, char ** argv, int verbose) } } } - return 0; } + zzip_mem_disk_close(disk); + return EXIT_OK; } int diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c index 3caa4810b69..891f77b3450 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c @@ -7,6 +7,7 @@ #include <zzip/lib.h> #include <zzip/__debug.h> +#include <zzip/__fnmatch.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -20,12 +21,6 @@ #include <io.h> #endif -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - static const char* comprlevel[] = { "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; @@ -107,8 +102,8 @@ unzzip_list (int argc, char ** argv, int verbose) char* name = entry->d_name; for (argn=1; argn < argc; argn++) { - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! _zzip_fnmatch (argv[argn], name, + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) { long long usize = entry->st_size; if (!verbose) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c index bfac8334837..b66ae689a10 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c @@ -6,6 +6,7 @@ */ #include <zzip/lib.h> +#include <zzip/__fnmatch.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -19,12 +20,6 @@ #include <io.h> #endif -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - static const char* comprlevel[] = { "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; @@ -105,8 +100,8 @@ unzzip_list (int argc, char ** argv, int verbose) char* name = entry.d_name; for (argn=1; argn < argc; argn++) { - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! _zzip_fnmatch (argv[argn], name, + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) { long long usize = entry.st_size; if (!verbose) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c new file mode 100644 index 00000000000..ca215a110d0 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c @@ -0,0 +1,109 @@ +/* + * 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 <zzip/__fnmatch.h> +#include <stdlib.h> +#include <string.h> + +static const char usage[] = +{ + "unzzipshow <zip> [names].. \n" + " - unzzip data content of files contained in a zip archive.\n" +}; + +static void zzip_entry_fprint(ZZIP_ENTRY* entry, FILE* out) +{ + ZZIP_ENTRY_FILE* file = zzip_entry_fopen (entry, 0); + if (file) + { + char buffer[1024]; int len; + while ((len = zzip_entry_fread (buffer, 1024, 1, file))) + fwrite (buffer, len, 1, out); + + zzip_entry_fclose (file); + } +} + +static void zzip_cat_file(FILE* disk, char* name, FILE* out) +{ + ZZIP_ENTRY_FILE* file = zzip_entry_ffile (disk, name); + if (file) + { + char buffer[1024]; int len; + while ((len = zzip_entry_fread (buffer, 1024, 1, file))) + fwrite (buffer, len, 1, out); + + zzip_entry_fclose (file); + } +} + +int +main (int argc, char ** argv) +{ + int argn; + FILE* disk; + + if (argc <= 1 || ! strcmp (argv[1], "--help")) + { + printf (usage); + return 0; + } + if (! strcmp (argv[1], "--version")) + { + printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + return 0; + } + + 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); + if (! entry) puts("no first entry!\n"); + for (; entry ; entry = zzip_entry_findnext(entry)) + { + char* name = zzip_entry_strdup_name (entry); + printf ("%s\n", name); + free (name); + } + return 0; + } + + if (argc == 3) + { /* list from one spec */ + ZZIP_ENTRY* entry = 0; + while ((entry = zzip_entry_findmatch(disk, argv[2], entry, 0, 0))) + zzip_entry_fprint (entry, stdout); + + 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); + if (! _zzip_fnmatch (argv[argn], name, + _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD)) + zzip_cat_file (disk, name, stdout); + free (name); + } + } + return 0; +} + +/* + * Local variables: + * c-file-style: "stroustrup" + * End: + */ |