diff options
| author | Brian <none@none> | 2010-08-25 23:40:39 -0600 |
|---|---|---|
| committer | Brian <none@none> | 2010-08-25 23:40:39 -0600 |
| commit | bed85f565b853b13576258adcd585c9753e3e10f (patch) | |
| tree | b5ed510db75eefcbb380f4c5edd52d4fc8d69942 /dep/libzip/regress | |
| parent | 55b09e7a9c312e900d6995fac790173904d5cf60 (diff) | |
Core/Dep: Added libzip which IS needed by G3D
Fixes compile on Windows and Linux (if you didn't have libzip installed for
some reason).
--HG--
branch : trunk
Diffstat (limited to 'dep/libzip/regress')
47 files changed, 2797 insertions, 0 deletions
diff --git a/dep/libzip/regress/CMakeLists.txt b/dep/libzip/regress/CMakeLists.txt new file mode 100644 index 00000000000..0a589f398bd --- /dev/null +++ b/dep/libzip/regress/CMakeLists.txt @@ -0,0 +1,27 @@ +# $NiH$ + +ENABLE_TESTING() + +SET(TEST_PROGRAMS + add_from_buffer + add_from_file + add_from_filep + encrypt + fread + get_comment + name_locate + open + set_comment_all + set_comment_localonly + set_comment_removeglobal + set_comment_revert +) + +SET(ENV{srcdir} ${CMAKE_CURRENT_SOURCE_DIR}) +FOREACH(PROGRAM ${TEST_PROGRAMS}) + ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}.c) + TARGET_LINK_LIBRARIES(${PROGRAM} zip) + ADD_TEST(${PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/runtest ${CMAKE_CURRENT_SOURCE_DIR}/${PROGRAM}) +ENDFOREACH(PROGRAM ${TEST_PROGRAMS}) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../lib) diff --git a/dep/libzip/regress/Makefile.am b/dep/libzip/regress/Makefile.am new file mode 100644 index 00000000000..9c974ae3a16 --- /dev/null +++ b/dep/libzip/regress/Makefile.am @@ -0,0 +1,56 @@ +noinst_PROGRAMS= \ + add_dir \ + add_from_buffer \ + add_from_file \ + add_from_filep \ + encrypt \ + fread \ + get_comment \ + open \ + name_locate \ + set_comment_all \ + set_comment_localonly \ + set_comment_removeglobal \ + set_comment_revert + +EXTRA_PROGRAMS=deltest ziptest + +EXTRA_DIST= \ + CMakeLists.txt \ + runtest \ + ${TESTS} \ + broken.zip \ + encrypt.zip \ + test.zip \ + testbuffer.zip \ + testdir.zip \ + testchanged.zip \ + testchangedlocal.zip \ + testcomment.zip \ + testcommentremoved.zip \ + testfile.txt \ + testfile.zip \ + testnottorrent.zip \ + testtorrent.tzip + +TESTS_ENVIRONMENT= ZIPCMP=${top_builddir}/src/zipcmp ${srcdir}/runtest + +TESTS= \ + add_dir.test \ + add_from_buffer.test \ + add_from_file.test \ + add_from_filep.test \ + encrypt.test \ + fread.test \ + get_comment.test \ + name_locate.test \ + open.test \ + set_comment_all.test \ + set_comment_localonly.test \ + set_comment_removeglobal.test \ + set_comment_revert.test \ + torrent-already.test \ + torrent-new.test + +AM_CPPFLAGS=-I${top_srcdir}/lib +LDADD=${top_builddir}/lib/libzip.la diff --git a/dep/libzip/regress/Makefile.in b/dep/libzip/regress/Makefile.in new file mode 100644 index 00000000000..13ba79b056c --- /dev/null +++ b/dep/libzip/regress/Makefile.in @@ -0,0 +1,726 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = add_dir$(EXEEXT) add_from_buffer$(EXEEXT) \ + add_from_file$(EXEEXT) add_from_filep$(EXEEXT) \ + encrypt$(EXEEXT) fread$(EXEEXT) get_comment$(EXEEXT) \ + open$(EXEEXT) name_locate$(EXEEXT) set_comment_all$(EXEEXT) \ + set_comment_localonly$(EXEEXT) \ + set_comment_removeglobal$(EXEEXT) set_comment_revert$(EXEEXT) +EXTRA_PROGRAMS = deltest$(EXEEXT) ziptest$(EXEEXT) +subdir = regress +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +add_dir_SOURCES = add_dir.c +add_dir_OBJECTS = add_dir.$(OBJEXT) +add_dir_LDADD = $(LDADD) +add_dir_DEPENDENCIES = ${top_builddir}/lib/libzip.la +add_from_buffer_SOURCES = add_from_buffer.c +add_from_buffer_OBJECTS = add_from_buffer.$(OBJEXT) +add_from_buffer_LDADD = $(LDADD) +add_from_buffer_DEPENDENCIES = ${top_builddir}/lib/libzip.la +add_from_file_SOURCES = add_from_file.c +add_from_file_OBJECTS = add_from_file.$(OBJEXT) +add_from_file_LDADD = $(LDADD) +add_from_file_DEPENDENCIES = ${top_builddir}/lib/libzip.la +add_from_filep_SOURCES = add_from_filep.c +add_from_filep_OBJECTS = add_from_filep.$(OBJEXT) +add_from_filep_LDADD = $(LDADD) +add_from_filep_DEPENDENCIES = ${top_builddir}/lib/libzip.la +deltest_SOURCES = deltest.c +deltest_OBJECTS = deltest.$(OBJEXT) +deltest_LDADD = $(LDADD) +deltest_DEPENDENCIES = ${top_builddir}/lib/libzip.la +encrypt_SOURCES = encrypt.c +encrypt_OBJECTS = encrypt.$(OBJEXT) +encrypt_LDADD = $(LDADD) +encrypt_DEPENDENCIES = ${top_builddir}/lib/libzip.la +fread_SOURCES = fread.c +fread_OBJECTS = fread.$(OBJEXT) +fread_LDADD = $(LDADD) +fread_DEPENDENCIES = ${top_builddir}/lib/libzip.la +get_comment_SOURCES = get_comment.c +get_comment_OBJECTS = get_comment.$(OBJEXT) +get_comment_LDADD = $(LDADD) +get_comment_DEPENDENCIES = ${top_builddir}/lib/libzip.la +name_locate_SOURCES = name_locate.c +name_locate_OBJECTS = name_locate.$(OBJEXT) +name_locate_LDADD = $(LDADD) +name_locate_DEPENDENCIES = ${top_builddir}/lib/libzip.la +open_SOURCES = open.c +open_OBJECTS = open.$(OBJEXT) +open_LDADD = $(LDADD) +open_DEPENDENCIES = ${top_builddir}/lib/libzip.la +set_comment_all_SOURCES = set_comment_all.c +set_comment_all_OBJECTS = set_comment_all.$(OBJEXT) +set_comment_all_LDADD = $(LDADD) +set_comment_all_DEPENDENCIES = ${top_builddir}/lib/libzip.la +set_comment_localonly_SOURCES = set_comment_localonly.c +set_comment_localonly_OBJECTS = set_comment_localonly.$(OBJEXT) +set_comment_localonly_LDADD = $(LDADD) +set_comment_localonly_DEPENDENCIES = ${top_builddir}/lib/libzip.la +set_comment_removeglobal_SOURCES = set_comment_removeglobal.c +set_comment_removeglobal_OBJECTS = set_comment_removeglobal.$(OBJEXT) +set_comment_removeglobal_LDADD = $(LDADD) +set_comment_removeglobal_DEPENDENCIES = ${top_builddir}/lib/libzip.la +set_comment_revert_SOURCES = set_comment_revert.c +set_comment_revert_OBJECTS = set_comment_revert.$(OBJEXT) +set_comment_revert_LDADD = $(LDADD) +set_comment_revert_DEPENDENCIES = ${top_builddir}/lib/libzip.la +ziptest_SOURCES = ziptest.c +ziptest_OBJECTS = ziptest.$(OBJEXT) +ziptest_LDADD = $(LDADD) +ziptest_DEPENDENCIES = ${top_builddir}/lib/libzip.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = add_dir.c add_from_buffer.c add_from_file.c add_from_filep.c \ + deltest.c encrypt.c fread.c get_comment.c name_locate.c open.c \ + set_comment_all.c set_comment_localonly.c \ + set_comment_removeglobal.c set_comment_revert.c ziptest.c +DIST_SOURCES = add_dir.c add_from_buffer.c add_from_file.c \ + add_from_filep.c deltest.c encrypt.c fread.c get_comment.c \ + name_locate.c open.c set_comment_all.c set_comment_localonly.c \ + set_comment_removeglobal.c set_comment_revert.c ziptest.c +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANFMT = @MANFMT@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + CMakeLists.txt \ + runtest \ + ${TESTS} \ + broken.zip \ + encrypt.zip \ + test.zip \ + testbuffer.zip \ + testdir.zip \ + testchanged.zip \ + testchangedlocal.zip \ + testcomment.zip \ + testcommentremoved.zip \ + testfile.txt \ + testfile.zip \ + testnottorrent.zip \ + testtorrent.tzip + +TESTS_ENVIRONMENT = ZIPCMP=${top_builddir}/src/zipcmp ${srcdir}/runtest +TESTS = \ + add_dir.test \ + add_from_buffer.test \ + add_from_file.test \ + add_from_filep.test \ + encrypt.test \ + fread.test \ + get_comment.test \ + name_locate.test \ + open.test \ + set_comment_all.test \ + set_comment_localonly.test \ + set_comment_removeglobal.test \ + set_comment_revert.test \ + torrent-already.test \ + torrent-new.test + +AM_CPPFLAGS = -I${top_srcdir}/lib +LDADD = ${top_builddir}/lib/libzip.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign regress/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign regress/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +add_dir$(EXEEXT): $(add_dir_OBJECTS) $(add_dir_DEPENDENCIES) + @rm -f add_dir$(EXEEXT) + $(LINK) $(add_dir_OBJECTS) $(add_dir_LDADD) $(LIBS) +add_from_buffer$(EXEEXT): $(add_from_buffer_OBJECTS) $(add_from_buffer_DEPENDENCIES) + @rm -f add_from_buffer$(EXEEXT) + $(LINK) $(add_from_buffer_OBJECTS) $(add_from_buffer_LDADD) $(LIBS) +add_from_file$(EXEEXT): $(add_from_file_OBJECTS) $(add_from_file_DEPENDENCIES) + @rm -f add_from_file$(EXEEXT) + $(LINK) $(add_from_file_OBJECTS) $(add_from_file_LDADD) $(LIBS) +add_from_filep$(EXEEXT): $(add_from_filep_OBJECTS) $(add_from_filep_DEPENDENCIES) + @rm -f add_from_filep$(EXEEXT) + $(LINK) $(add_from_filep_OBJECTS) $(add_from_filep_LDADD) $(LIBS) +deltest$(EXEEXT): $(deltest_OBJECTS) $(deltest_DEPENDENCIES) + @rm -f deltest$(EXEEXT) + $(LINK) $(deltest_OBJECTS) $(deltest_LDADD) $(LIBS) +encrypt$(EXEEXT): $(encrypt_OBJECTS) $(encrypt_DEPENDENCIES) + @rm -f encrypt$(EXEEXT) + $(LINK) $(encrypt_OBJECTS) $(encrypt_LDADD) $(LIBS) +fread$(EXEEXT): $(fread_OBJECTS) $(fread_DEPENDENCIES) + @rm -f fread$(EXEEXT) + $(LINK) $(fread_OBJECTS) $(fread_LDADD) $(LIBS) +get_comment$(EXEEXT): $(get_comment_OBJECTS) $(get_comment_DEPENDENCIES) + @rm -f get_comment$(EXEEXT) + $(LINK) $(get_comment_OBJECTS) $(get_comment_LDADD) $(LIBS) +name_locate$(EXEEXT): $(name_locate_OBJECTS) $(name_locate_DEPENDENCIES) + @rm -f name_locate$(EXEEXT) + $(LINK) $(name_locate_OBJECTS) $(name_locate_LDADD) $(LIBS) +open$(EXEEXT): $(open_OBJECTS) $(open_DEPENDENCIES) + @rm -f open$(EXEEXT) + $(LINK) $(open_OBJECTS) $(open_LDADD) $(LIBS) +set_comment_all$(EXEEXT): $(set_comment_all_OBJECTS) $(set_comment_all_DEPENDENCIES) + @rm -f set_comment_all$(EXEEXT) + $(LINK) $(set_comment_all_OBJECTS) $(set_comment_all_LDADD) $(LIBS) +set_comment_localonly$(EXEEXT): $(set_comment_localonly_OBJECTS) $(set_comment_localonly_DEPENDENCIES) + @rm -f set_comment_localonly$(EXEEXT) + $(LINK) $(set_comment_localonly_OBJECTS) $(set_comment_localonly_LDADD) $(LIBS) +set_comment_removeglobal$(EXEEXT): $(set_comment_removeglobal_OBJECTS) $(set_comment_removeglobal_DEPENDENCIES) + @rm -f set_comment_removeglobal$(EXEEXT) + $(LINK) $(set_comment_removeglobal_OBJECTS) $(set_comment_removeglobal_LDADD) $(LIBS) +set_comment_revert$(EXEEXT): $(set_comment_revert_OBJECTS) $(set_comment_revert_DEPENDENCIES) + @rm -f set_comment_revert$(EXEEXT) + $(LINK) $(set_comment_revert_OBJECTS) $(set_comment_revert_LDADD) $(LIBS) +ziptest$(EXEEXT): $(ziptest_OBJECTS) $(ziptest_DEPENDENCIES) + @rm -f ziptest$(EXEEXT) + $(LINK) $(ziptest_OBJECTS) $(ziptest_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_dir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_from_buffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_from_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_from_filep.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deltest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encrypt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fread.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_comment.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/name_locate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_comment_all.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_comment_localonly.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_comment_removeglobal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_comment_revert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ziptest.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dep/libzip/regress/add_dir.c b/dep/libzip/regress/add_dir.c new file mode 100644 index 00000000000..ddd6758c151 --- /dev/null +++ b/dep/libzip/regress/add_dir.c @@ -0,0 +1,90 @@ +/* + add_dir.c -- test case for adding file from buffer to archive + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *dir[2] = { + "testdir/", + "testdir-noslash" +}; + +const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + size_t i; + int err; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, ZIP_CREATE, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive %s: %s\n", prg, + archive, buf); + return 1; + } + + for (i=0; i<sizeof(dir)/sizeof(dir[0]); i++) { + if (zip_add_dir(za, dir[i]) == -1) { + fprintf(stderr, "%s: can't add file `%s': %s\n", prg, + dir[i], zip_strerror(za)); + return 1; + } + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive %s\n", prg, + archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/add_dir.test b/dep/libzip/regress/add_dir.test new file mode 100644 index 00000000000..8613b058d0c --- /dev/null +++ b/dep/libzip/regress/add_dir.test @@ -0,0 +1,5 @@ +# add directories to zip +program add_dir +return 0 +args testdir.zip +file-new testdir.zip testdir.zip diff --git a/dep/libzip/regress/add_from_buffer.c b/dep/libzip/regress/add_from_buffer.c new file mode 100644 index 00000000000..baee8f6f72e --- /dev/null +++ b/dep/libzip/regress/add_from_buffer.c @@ -0,0 +1,94 @@ +/* + $NiH: add_from_buffer.c,v 1.2 2006/02/21 09:41:13 dillo Exp $ + + add_from_buffer.c -- test case for adding file from buffer to archive + Copyright (C) 1999, 2003, 2005 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *teststr="This is a test, and it seems to have been successful.\n"; +const char *file="teststring.txt"; +const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + struct zip_source *zs; + char buf[100]; + int err; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, ZIP_CREATE, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive %s: %s\n", prg, + archive, buf); + return 1; + } + + if ((zs=zip_source_buffer(za, teststr, strlen(teststr), 0)) == NULL) { + fprintf(stderr, "%s: can't create zip_source from buffer: %s\n", prg, + zip_strerror(za)); + exit(1); + } + + if (zip_add(za, file, zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "%s: can't add file `%s': %s\n", prg, + file, zip_strerror(za)); + return 1; + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive %s\n", prg, + archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/add_from_buffer.test b/dep/libzip/regress/add_from_buffer.test new file mode 100644 index 00000000000..c6e75a0d180 --- /dev/null +++ b/dep/libzip/regress/add_from_buffer.test @@ -0,0 +1,6 @@ +# add buffer contents as file to zip +# $NiH: add_from_buffer.test,v 1.1 2005/07/15 16:54:25 wiz Exp $ +program add_from_buffer +return 0 +args testbuffer.zip +file-new testbuffer.zip testbuffer.zip diff --git a/dep/libzip/regress/add_from_file.c b/dep/libzip/regress/add_from_file.c new file mode 100644 index 00000000000..13141a16403 --- /dev/null +++ b/dep/libzip/regress/add_from_file.c @@ -0,0 +1,98 @@ +/* + $NiH: add_from_file.c,v 1.1 2005/07/15 16:53:37 wiz Exp $ + + add_from_file.c -- test case for adding file to archive + Copyright (C) 1999, 2003, 2005 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +static const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + const char *file; + const char *name; + struct zip *za; + struct zip_source *zs; + char buf[100]; + int err; + + prg = argv[0]; + + if (argc != 3) { + fprintf(stderr, "usage: %s archive file\n", prg); + return 1; + } + + archive = argv[1]; + file = argv[2]; + + if ((za=zip_open(archive, ZIP_CREATE, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive %s: %s\n", prg, + archive, buf); + return 1; + } + + if ((zs=zip_source_file(za, file, 0, -1)) == NULL) { + fprintf(stderr, "%s: error creating file source for `%s': %s\n", prg, + file, zip_strerror(za)); + return 1; + } + + if ((name=strrchr(file, '/')) == NULL) + name = file; + + if (zip_add(za, name, zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "%s: can't add file `%s': %s\n", prg, + file, zip_strerror(za)); + return 1; + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, + archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/add_from_file.test b/dep/libzip/regress/add_from_file.test new file mode 100644 index 00000000000..35e9ac36e41 --- /dev/null +++ b/dep/libzip/regress/add_from_file.test @@ -0,0 +1,7 @@ +# add file to zip +# $NiH: add_from_file.test,v 1.1 2005/07/15 16:54:25 wiz Exp $ +program add_from_file +return 0 +args testfile.zip testfile.txt +file testfile.txt testfile.txt testfile.txt +file-new testfile.zip testfile.zip diff --git a/dep/libzip/regress/add_from_filep.c b/dep/libzip/regress/add_from_filep.c new file mode 100644 index 00000000000..ab83db00c95 --- /dev/null +++ b/dep/libzip/regress/add_from_filep.c @@ -0,0 +1,105 @@ +/* + $NiH: add_from_filep.c,v 1.1 2005/07/17 00:01:06 wiz Exp $ + + add_from_filep.c -- test case for adding file to archive + Copyright (C) 1999, 2003, 2005 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +static const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + const char *file; + const char *name; + struct zip *za; + struct zip_source *zs; + char buf[100]; + int err; + FILE *fp; + + prg = argv[0]; + + if (argc != 3) { + fprintf(stderr, "usage: %s archive file\n", prg); + return 1; + } + + archive = argv[1]; + file = argv[2]; + + if ((za=zip_open(archive, ZIP_CREATE, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive %s: %s\n", prg, + archive, buf); + return 1; + } + + if ((fp=fopen(file, "r")) == NULL) { + fprintf(stderr, "%s: can't open input file `%s': %s\n", prg, + file, strerror(errno)); + return 1; + } + + if ((zs=zip_source_filep(za, fp, 0, -1)) == NULL) { + fprintf(stderr, "%s: error creating file source for `%s': %s\n", prg, + file, zip_strerror(za)); + return 1; + } + + if ((name=strrchr(file, '/')) == NULL) + name = file; + + if (zip_add(za, name, zs) == -1) { + zip_source_free(zs); + fprintf(stderr, "%s: can't add file `%s': %s\n", prg, + file, zip_strerror(za)); + return 1; + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, + archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/add_from_filep.test b/dep/libzip/regress/add_from_filep.test new file mode 100644 index 00000000000..48f7edcc95d --- /dev/null +++ b/dep/libzip/regress/add_from_filep.test @@ -0,0 +1,7 @@ +# add file to zip +# $NiH: add_from_filep.test,v 1.1 2005/07/17 00:01:06 wiz Exp $ +program add_from_filep +return 0 +args testfile.zip testfile.txt +file testfile.txt testfile.txt testfile.txt +file-new testfile.zip testfile.zip diff --git a/dep/libzip/regress/broken.zip b/dep/libzip/regress/broken.zip Binary files differnew file mode 100644 index 00000000000..6dbff3e15fd --- /dev/null +++ b/dep/libzip/regress/broken.zip diff --git a/dep/libzip/regress/deltest.c b/dep/libzip/regress/deltest.c new file mode 100644 index 00000000000..87991e5ede0 --- /dev/null +++ b/dep/libzip/regress/deltest.c @@ -0,0 +1,37 @@ +#include "zip.h" +#include "error.h" + +char *prg; +#define BUFSIZE 65536 + +int +main(int argc, char *argv[]) +{ + struct zip *za; + + if (argc != 2) { + fprintf(stderr, "%s: call with one option: zip-file. First file" + " in zip-file will be deleted\n", argv[0]); + return 1; + } + + if ((za=zip_open(argv[1], ZIP_CHECKCONS))==NULL) { + fprintf(stderr, "%s: can't open '%s': %s\n", argv[0], argv[1], + zip_err_str[zip_err]); + return 1; + } + + if (zip_delete(za, 0)< 0) { + fprintf(stderr, "%s: can't delete first file in '%s': %s", + argv[0], argv[1], zip_err_str[zip_err]); + return 1; + } + + if (zip_close(za)!=0) { + fprintf(stderr, "%s: can't close file '%s': %s", argv[0], argv[1], + zip_err_str[zip_err]); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/encrypt.c b/dep/libzip/regress/encrypt.c new file mode 100644 index 00000000000..832d0d1e1e9 --- /dev/null +++ b/dep/libzip/regress/encrypt.c @@ -0,0 +1,87 @@ +/* + $NiH$ + + encrypt.c -- test encryption support + Copyright (C) 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + int err; + int i; + struct zip_stat st; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, 0, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, + archive, buf); + return 1; + } + + for (i=0; i<zip_get_num_files(za); i++) { + if (zip_stat_index(za, i, 0, &st) < 0) + fprintf(stderr, "%s: can't stat file %d: %s\n", + prg, i, zip_strerror(za)); + else + printf("%d: %d\n", i, st.encryption_method); + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/encrypt.test b/dep/libzip/regress/encrypt.test new file mode 100644 index 00000000000..6fb73717409 --- /dev/null +++ b/dep/libzip/regress/encrypt.test @@ -0,0 +1,8 @@ +# test encryption support +# $NiH$ +program encrypt +return 0 +args encrypt.zip +file encrypt.zip encrypt.zip encrypt.zip +stdout 0: 1 +stdout 1: 0 diff --git a/dep/libzip/regress/encrypt.zip b/dep/libzip/regress/encrypt.zip Binary files differnew file mode 100644 index 00000000000..e50aa385af3 --- /dev/null +++ b/dep/libzip/regress/encrypt.zip diff --git a/dep/libzip/regress/fread.c b/dep/libzip/regress/fread.c new file mode 100644 index 00000000000..85f4e74544d --- /dev/null +++ b/dep/libzip/regress/fread.c @@ -0,0 +1,164 @@ +/* + $NiH: fread.c,v 1.6 2006/02/21 10:21:25 dillo Exp $ + + fread.c -- test cases for reading from zip archives + Copyright (C) 2004, 2005, 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> + +#include "zip.h" + +enum when { + WHEN_NEVER, WHEN_OPEN, WHEN_READ, WHEN_CLOSE +}; + +const char *when_name[] = { + "no", "zip_fopen", "zip_fread", "zip_fclose" +}; + +int do_read(struct zip *, const char *, int, enum when, int, int); + + + +const char *prg; + +int +main(int argc, char *argv[]) +{ + int fail, ze; + struct zip *z; + struct zip_source *zs; + char *archive; + char errstr[1024]; + + fail = 0; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((z=zip_open(archive, 0, &ze)) == NULL) { + zip_error_to_str(errstr, sizeof(errstr), ze, errno); + printf("%s: opening zip archive ``%s'' failed: %s\n", + prg, archive, errstr); + return 1; + } + + fail += do_read(z, "storedok", 0, WHEN_NEVER, 0, 0); + fail += do_read(z, "deflateok", 0, WHEN_NEVER, 0, 0); + fail += do_read(z, "storedcrcerror", 0, WHEN_READ, ZIP_ER_CRC, 0); + fail += do_read(z, "deflatecrcerror", 0, WHEN_READ, ZIP_ER_CRC, 0); + fail += do_read(z, "deflatezliberror", 0, WHEN_READ, ZIP_ER_ZLIB, -3); + fail += do_read(z, NULL, 0, WHEN_OPEN, ZIP_ER_INVAL, 0); + fail += do_read(z, "nosuchfile", 0, WHEN_OPEN, ZIP_ER_NOENT, 0); + fail += do_read(z, "deflatezliberror", ZIP_FL_COMPRESSED, WHEN_NEVER, 0,0); + fail += do_read(z, "deflatecrcerror", ZIP_FL_COMPRESSED, WHEN_NEVER, 0, 0); + fail += do_read(z, "storedcrcerror", ZIP_FL_COMPRESSED, + WHEN_READ, ZIP_ER_CRC, 0); + fail += do_read(z, "storedok", ZIP_FL_COMPRESSED, WHEN_NEVER, 0, 0); + + zs = zip_source_buffer(z, "asdf", 4, 0); + zip_replace(z, zip_name_locate(z, "storedok", 0), zs); + fail += do_read(z, "storedok", 0, WHEN_OPEN, ZIP_ER_CHANGED, 0); + fail += do_read(z, "storedok", ZIP_FL_UNCHANGED, WHEN_NEVER, 0, 0); + zip_delete(z, zip_name_locate(z, "storedok", 0)); + fail += do_read(z, "storedok", 0, WHEN_OPEN, ZIP_ER_NOENT, 0); + fail += do_read(z, "storedok", ZIP_FL_UNCHANGED, WHEN_NEVER, 0, 0); + zs = zip_source_buffer(z, "asdf", 4, 0); + zip_add(z, "new_file", zs); + fail += do_read(z, "new_file", 0, WHEN_OPEN, ZIP_ER_CHANGED, 0); + zip_unchange_all(z); + + if (zip_close(z) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + exit(fail ? 1 : 0); +} + + + +int +do_read(struct zip *z, const char *name, int flags, + enum when when_ex, int ze_ex, int se_ex) +{ + struct zip_file *zf; + enum when when_got; + int ze_got, se_got; + char b[8192]; + int n; + char expected[80]; + char got[80]; + + when_got = WHEN_NEVER; + ze_got = se_got = 0; + + if ((zf=zip_fopen(z, name, flags)) == NULL) { + when_got = WHEN_OPEN; + zip_error_get(z, &ze_got, &se_got); + } + else { + while ((n=zip_fread(zf, b, sizeof(b))) > 0) + ; + if (n < 0) { + when_got = WHEN_READ; + zip_file_error_get(zf, &ze_got, &se_got); + } + n = zip_fclose(zf); + if (when_got == WHEN_NEVER && n != 0) { + when_got = WHEN_CLOSE; + ze_got = n; + se_got = 0; + } + } + + if (when_got != when_ex || ze_got != ze_ex || se_got != se_ex) { + zip_error_to_str(expected, sizeof(expected), ze_ex, se_ex); + zip_error_to_str(got, sizeof(got), ze_got, se_got); + printf("%s: got %s error (%s), expected %s error (%s)\n", prg, + when_name[when_got], got, + when_name[when_ex], expected); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/fread.test b/dep/libzip/regress/fread.test new file mode 100644 index 00000000000..9fbe5d8c3fd --- /dev/null +++ b/dep/libzip/regress/fread.test @@ -0,0 +1,6 @@ +# various tests for zip_fread +# $NiH: fread.test,v 1.1 2005/07/16 17:14:32 wiz Exp $ +program fread +args broken.zip +return 0 +file broken.zip broken.zip broken.zip diff --git a/dep/libzip/regress/get_comment.c b/dep/libzip/regress/get_comment.c new file mode 100644 index 00000000000..7df1e3c239c --- /dev/null +++ b/dep/libzip/regress/get_comment.c @@ -0,0 +1,91 @@ +/* + $NiH: get_comment.c,v 1.3 2006/04/23 14:17:36 wiz Exp $ + + comment.c -- test cases for file and archive comments + Copyright (C) 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + int err; + const char *com; + int i, len; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, 0, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, + archive, buf); + return 1; + } + + if ((com=zip_get_archive_comment(za, &len, 0)) == NULL) + printf("No archive comment\n"); + else + printf("Archive comment: %.*s\n", len, com); + + for (i=0; i<zip_get_num_files(za); i++) { + if ((com=zip_get_file_comment(za, i, &len, 0)) == NULL) + printf("No comment for `%s'\n", zip_get_name(za, i, 0)); + else + printf("File comment for `%s': %.*s\n", zip_get_name(za, i, 0), len, com); + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/get_comment.test b/dep/libzip/regress/get_comment.test new file mode 100644 index 00000000000..e2cb8293c6f --- /dev/null +++ b/dep/libzip/regress/get_comment.test @@ -0,0 +1,16 @@ +# show comments of a zip archive +# $NiH: comment.test,v 1.1 2006/04/09 19:05:48 wiz Exp $ +program get_comment +return 0 +args testcomment.zip +file testcomment.zip testcomment.zip testcomment.zip +stdout Archive comment: This is the archive comment for the file.
+stdout
+stdout Long.
+stdout
+stdout Longer.
+stdout +stdout No comment for `file1' +stdout File comment for `file2': First one had no comment. +stdout File comment for `file3': Third one. +stdout File comment for `file4': Last. diff --git a/dep/libzip/regress/name_locate.c b/dep/libzip/regress/name_locate.c new file mode 100644 index 00000000000..dc145240a55 --- /dev/null +++ b/dep/libzip/regress/name_locate.c @@ -0,0 +1,138 @@ +/* + $NiH: name_locate.c,v 1.6 2006/02/21 09:41:13 dillo Exp $ + + name_locate.c -- test cases for finding files in zip archives + Copyright (C) 2005-2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> + +#include "zip.h" + +int find_fail(struct zip *, const char *, int, int); +int find_success(struct zip *, const char *, int); + +const char *prg; + + + +int +main(int argc, char *argv[]) +{ + int fail, ze; + struct zip *z; + const char *archive; + + fail = 0; + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((z=zip_open(archive, 0, &ze)) == NULL) { + printf("%s: opening zip archive ``%s'' failed (%d)\n", prg, + archive, ze); + return 1; + } + + fail += find_fail(z, "nosuchfile", 0, ZIP_ER_NOENT); + fail += find_success(z, "test", 0); + fail += find_fail(z, "TeSt", 0, ZIP_ER_NOENT); + fail += find_success(z, "TeSt", ZIP_FL_NOCASE); + fail += find_success(z, "testdir/test2", 0); + fail += find_success(z, "tesTdir/tESt2", ZIP_FL_NOCASE); + fail += find_fail(z, "testdir/test2", ZIP_FL_NODIR, ZIP_ER_NOENT); + fail += find_fail(z, "tesTdir/tESt2", ZIP_FL_NOCASE|ZIP_FL_NODIR, + ZIP_ER_NOENT); + fail += find_fail(z, "test2", 0, ZIP_ER_NOENT); + fail += find_success(z, "test2", ZIP_FL_NODIR); + fail += find_success(z, "TeST2", ZIP_FL_NODIR|ZIP_FL_NOCASE); + zip_delete(z, 0); + fail += find_fail(z, "test", 0, ZIP_ER_NOENT); + fail += find_success(z, "test", ZIP_FL_UNCHANGED); + zip_unchange_all(z); + fail += find_success(z, "test", 0); + + if (zip_close(z) == -1) { + fprintf(stderr, "%s: can't close zip archive %s\n", prg, + archive); + return 1; + } + + exit(fail ? 1 : 0); +} + + + +int +find_fail(struct zip *z, const char *name, int flags, int zerr) +{ + int ze, se; + char expected[80]; + + if (zip_name_locate(z, name, flags) < 0) { + zip_error_get(z, &ze, &se); + if (ze != zerr) { + zip_error_to_str(expected, sizeof(expected), zerr, 0); + printf("%s: unexpected error while looking for ``%s'': " + "got ``%s'', expected ``%s''\n", prg, name, + zip_strerror(z), expected); + return 1; + } + + return 0; + } + + return 1; +} + + + +int +find_success(struct zip *z, const char *name, int flags) +{ + + if (zip_name_locate(z, name, flags) < 0) { + printf("%s: unexpected error while looking for ``%s'': %s\n", + prg, name, zip_strerror(z)); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/name_locate.test b/dep/libzip/regress/name_locate.test new file mode 100644 index 00000000000..e664fd75c57 --- /dev/null +++ b/dep/libzip/regress/name_locate.test @@ -0,0 +1,6 @@ +# various tests for zip_name_locate +# $NiH: name_locate.test,v 1.1 2005/07/16 17:14:32 wiz Exp $ +program name_locate +args test.zip +return 0 +file test.zip test.zip test.zip diff --git a/dep/libzip/regress/open.c b/dep/libzip/regress/open.c new file mode 100644 index 00000000000..6b6c18c1658 --- /dev/null +++ b/dep/libzip/regress/open.c @@ -0,0 +1,134 @@ +/* + $NiH: open.c,v 1.6 2005/07/16 17:14:32 wiz Exp $ + + open.c -- test cases for opening zip archives + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> + +#include "zip.h" + +int open_fail(const char *, int, const char *, int, int); +int open_success(const char *, int, const char *, int); + +const char *prg; + + +int +main(int argc, char *argv[]) +{ + int fail; + const char *archive; + const char *nonarchive; + + fail = 0; + prg = argv[0]; + + if (argc != 3) { + fprintf(stderr, "usage: %s archive non-archive\n", prg); + return 1; + } + + archive = argv[1]; + nonarchive = argv[2]; + + remove("nosuchfile"); + fail += open_fail("nosuchfile", 0, "non-existing", ZIP_ER_OPEN, ENOENT); + fail += open_fail(nonarchive, 0, "non-zip", ZIP_ER_NOZIP, 0); + fail += open_fail(archive, ZIP_EXCL, "existing-excl", ZIP_ER_EXISTS, 0); + /* ZIP_ER_OPEN */ + /* ZIP_ER_READ */ + /* ZIP_ER_SEEK */ + /* ZIP_ER_INCONS */ + + fail += open_success(archive, 0, "existing", 3); + fail += open_success("nosuchfile", ZIP_CREATE, "new", 0); + + exit(fail ? 1 : 0); +} + + + +int +open_fail(const char *fname, int flags, const char *desc, int zerr, int serr) +{ + struct zip *z; + int ze; + + errno = 0; + + if ((z=zip_open(fname, flags, &ze)) != NULL) { + printf("%s: opening `%s' succeeded, though it shouldn't\n", prg, desc); + zip_close(z); + return 1; + } + else if (ze != zerr + || (zip_error_get_sys_type(ze) == ZIP_ET_SYS && errno != serr)) { + printf("%s: opening `%s' returned wrong error %d/%d, expected %d/%d\n", + prg, desc, ze, errno, zerr, serr); + return 1; + } + + return 0; +} + + + +int +open_success(const char *fname, int flags, const char *desc, int nent) +{ + struct zip *z; + int ze, num; + + if ((z=zip_open(fname, flags, &ze)) == NULL) { + printf("%s: opening `%s' failed (%d)\n", prg, desc, ze); + return 1; + } + + num = zip_get_num_files(z); + if (zip_close(z) == -1) { + printf("%s: closing `%s' failed\n", prg, desc); + return 1; + } + + if (num != nent) { + printf("%s: opening `%s' got wrong number of files %d, expected %d\n", + prg, desc, num, nent); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/open.test b/dep/libzip/regress/open.test new file mode 100644 index 00000000000..b843cd412b8 --- /dev/null +++ b/dep/libzip/regress/open.test @@ -0,0 +1,7 @@ +# various tests for zip_open +# $NiH: open.test,v 1.1 2005/07/16 17:14:32 wiz Exp $ +program open +args test.zip Makefile.am +return 0 +file test.zip test.zip test.zip +file Makefile.am Makefile.am Makefile.am diff --git a/dep/libzip/regress/runtest b/dep/libzip/regress/runtest new file mode 100755 index 00000000000..a1042510eaf --- /dev/null +++ b/dep/libzip/regress/runtest @@ -0,0 +1,363 @@ +#!/bin/sh + +# from ckmame:runtest,v 1.22 2005/12/27 09:41:51 dillo Exp +# +# runtest -- run regression tests +# Copyright (C) 2002-2007 Dieter Baron and Thomas Klausner +# +# This file is part of libzip, a library to manipulate ZIP archives. +# The authors can be contacted at <libzip@nih.at> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# runtest TESTNAME +# +# files: +# TESTNAME.test: test scenario +# +# test scenario: +# Lines beginning with # are comments. +# +# The following commands are recognized; return and args must +# appear exactly once, the others are optional. +# +# args ARGS +# run program with command line arguments ARGS +# +# description TEXT +# description of what test is for +# +# file TEST IN OUT +# copy file IN as TEST, compare against OUT after program run. +# +# file-del TEST IN +# copy file IN as TEST, check that it is removed by program. +# +# file-new TEST OUT +# check that file TEST is created by program and compare +# against OUT. +# +# mkdir MODE NAME +# create directory NAME with permissions MODE. +# +# program PRG +# run PRG. +# +# return RET +# RET is the expected exit code +# +# stderr TEXT +# program is expected to produce the error message TEXT. If +# multiple stderr commands are used, the messages are +# expected in the order given. +# +# stdout TEXT +# program is expected to print TEXT to stdout. If multiple +# stdout commands are used, the messages are expected in +# the order given. +# +# exit status +# runtest uses the following exit codes: +# 0: test passed +# 1: test failed +# 2: other error +# 77: test was skipped +# +# environment variables: +# VERBOSE: if set, be more verbose (e. g., output diffs) +# NOCLEANUP: if set, don't delete directory test is run in + +die() { + echo "$0: $*" >&2; + cleanup; + exit 2; +} + +fail() { + if [ ! -z "${VERBOSE}" ] + then + echo "${TEST} -- FAILED: $*"; + fi; + cleanup; + exit 1; +} + +skip() { + if [ ! -z "${VERBOSE}" ] + then + echo "${TEST} -- skipped: $*"; + fi; + cleanup; + exit 77; +} + +succeed() { + if [ ! -z "${VERBOSE}" ] + then + echo "${TEST} -- passed"; + fi + cleanup; + exit 0; +} + +cleanup() { + cd ..; + if [ -z "${NOCLEANUP}" ] + then + chmod -R u+rw ${DIR}; + rm -r ${DIR}; + fi +} + +check_in_out_exists() { + if [ ! -f "$2" ] + then + fail "missing output file: '$2'" + elif [ ! -f "$1" ] + then + die "cannot find input file '$1'" + fi +} + +checkdb() { + check_in_out_exists "$1" "$2" + out=`../dbdump "$2" | sort | diff ${DIFF_FLAGS} "$1" -` + if [ $? -ne 0 ] + then + if [ $VERBOSE ] + then + echo "$out" + fi + fail "$3" + fi + +} + +checkfile() { + check_in_out_exists "$1" "$2" + out=`diff ${DIFF_FLAGS} "$1" "$2"` + if [ $? -ne 0 ] + then + if [ $VERBOSE ] + then + echo "$out" + fi + fail "$3" + fi +} + +checkzip() { + check_in_out_exists "$1" "$2" + # quiet CRC errors + ${ZIPCMP} -t ${ZIPCMP_FLAGS} "$1" "$2" 2>/dev/null + if [ $? -ne 0 ] + then + fail "$3" + fi +} + +test_empty() { + if [ ! -z "$1" ] + then + die "directive $2 appeared twice in test file" + fi +} + +test_set() { + if [ -z "$1" ] + then + die "required directive $2 missing in test file" + fi +} + +copy_file() { + src="${srcdir}/$1" + + if [ ! -f "$src" ] + then + die "source file '$src' does not exist" + fi + dir=`dirname "$2"` + if [ ! -d "$dir" ] + then + mkdir -p "$dir" + fi + cp "$src" "$2" +} + +# GNU sort behaves differently on locales other than C, breaking tests +LC_ALL=C +export LC_ALL + +#testdir=`dirname $1` +TEST=`echo $1 | sed -e s',.*/,,' -e 's/\.test$//'` +shift + +DIR=${TEST}.d$$ +if [ -z "${srcdir}" ] +then + srcdir=.. +else + # XXX: fix for absolute srcdir? + srcdir=../${srcdir} +fi + +if [ -z "${ZIPCMP}" ] +then + ZIPCMP=zipcmp +else + if expr "${ZIPCMP}" : '[^/].*/' > /dev/null + then + ZIPCMP="../${ZIPCMP}" + fi +fi + +if [ -z "${VERBOSE}" ] +then + DIFF_FLAGS='' + ZIPCMP_FLAGS='-q' +else + DIFF_FLAGS='-u' + ZIPCMP_FLAGS='-v' +fi + +# XXX: set up trap to cleanup + +mkdir ${DIR} || ( die "cannot create test directory ${DIR}" ) +cd ${DIR} || ( die "cannot cd to test directory ${DIR}" ) + +{ + +RET='' +ARGS='' +FILES='' +FILES_SHOULD='' +DESCR='' + +touch stderr stdout + +while read cmd arg +do + case $cmd in + \#*) ;; + args) + test_empty "${ARGS}" args + ARGS="$arg";; + description) + test_empty "${DESCR}" description + DESCR="$arg";; + file) + set $arg + copy_file "$2" "$1" + FILES="${FILES} ${srcdir}/$3!$1";; + file-del) + set $arg + copy_file "$2" "$1";; + file-new) + set $arg + FILES="${FILES} ${srcdir}/$2!$1";; + mkdir) + set $arg + mkdir "$2" && chmod "$1" "$2";; + program) + PROGRAM=../"$arg";; + return) + test_empty "${RET}" return + RET="$arg";; + stderr) + echo "${PROGRAM}: $arg" >> stderr;; + stdout) + echo "$arg" >> stdout;; + *) + die "unknown directive '$cmd'" + esac +done + +test_set "${RET}" return +test_set "${ARGS}" args + +if [ -z "${PROGRAM}" ] +then + die no program to run given +fi + +if [ ! -z "${SETUP_ONLY}" ] +then + echo ${DIR} + exit 0 +fi + +if [ ! -z "${VERBOSE}" ] +then + echo "${TEST}: ${DESCR}" + echo "running: ${PROGRAM} ${ARGS}" +fi + +${PROGRAM} ${ARGS} > gotout 2> goterr +ret=$? + +if [ $ret -ne ${RET} ] +then + if [ ! -z "${VERBOSE}" ] + then + cat gotout + cat goterr + fi + fail "unexpected exit status: got $ret, expected ${RET}" +fi + +FILES_SHOULD="${FILES_SHOULD} stderr stdout gotout goterr" + +checkfile stderr goterr "unexpected error output" +checkfile stdout gotout "unexpected output" + +if [ ! -z "${FILES}" ] +then + for fs in ${FILES} + do + set -- `echo ${fs} | tr '!' ' '` + FILES_SHOULD="${FILES_SHOULD} $2" + case "$2" in + *.db) + checkdb "$1" "$2" "database $2 wrong";; + *.zip) + checkzip "$1" "$2" "zip file $2 wrong";; + *) + checkfile "$1" "$2" "file $2 wrong";; + esac + done +fi + +# check that no additional files exist +echo gotfiles shouldfiles ${FILES_SHOULD} | tr ' ' '\012' | sort > shouldfiles +touch gotfiles +find . -type f -print | sed 's!^./!!' | sort > gotfiles + +checkfile shouldfiles gotfiles "unexpected/missing files" + +succeed + +} < ${srcdir}/${TEST}.test diff --git a/dep/libzip/regress/set_comment_all.c b/dep/libzip/regress/set_comment_all.c new file mode 100644 index 00000000000..e187a7a8a87 --- /dev/null +++ b/dep/libzip/regress/set_comment_all.c @@ -0,0 +1,97 @@ +/* + $NiH: set_comment_all.c,v 1.2 2006/04/23 13:28:41 wiz Exp $ + + set_comment_all.c -- set global and file comments + Copyright (C) 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *prg; +const char *new_archive_comment="This is the new,\r\n" +"multiline archive comment.\r\n" +"Ain't it nice?"; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + int err; + int i; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, 0, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, + archive, buf); + return 1; + } + + if (zip_set_archive_comment(za, new_archive_comment, + strlen(new_archive_comment)) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_archive_comment failed: %s\n", + prg, buf); + } + + for (i=0; i<zip_get_num_files(za); i++) { + snprintf(buf, sizeof(buf), "File comment no %d", i); + if (zip_set_file_comment(za, i, buf, strlen(buf)) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_file_comment on file %d failed: %s\n", + prg, i, buf); + } + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/set_comment_all.test b/dep/libzip/regress/set_comment_all.test new file mode 100644 index 00000000000..a1b9c5c7c97 --- /dev/null +++ b/dep/libzip/regress/set_comment_all.test @@ -0,0 +1,8 @@ +# change local and global comments in a zip archive +# $NiH: set_comment.test,v 1.1 2006/04/23 00:39:58 wiz Exp $ +program set_comment_all +return 0 +# need filename extension != zip to avoid using zipcmp, +# which doesn't look at comments +args testcomment.reg +file testcomment.reg testcomment.zip testchanged.zip diff --git a/dep/libzip/regress/set_comment_localonly.c b/dep/libzip/regress/set_comment_localonly.c new file mode 100644 index 00000000000..f11416e475b --- /dev/null +++ b/dep/libzip/regress/set_comment_localonly.c @@ -0,0 +1,93 @@ +/* + $NiH: set_comment_localonly.c,v 1.3 2006/04/23 13:28:41 wiz Exp $ + + set_comment_localonly.c -- set file comments + Copyright (C) 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + int err; + int i; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, 0, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, + archive, buf); + return 1; + } + + for (i=0; i<zip_get_num_files(za); i++) { + snprintf(buf, sizeof(buf), "File comment no %d", i); + if (zip_set_file_comment(za, i, buf, strlen(buf)) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_file_comment on file %d failed: %s\n", + prg, i, buf); + } + } + /* remove comment for third file */ + if (zip_set_file_comment(za, 2, NULL, 0) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_file_comment on file %d failed: %s\n", + prg, i, buf); + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/set_comment_localonly.test b/dep/libzip/regress/set_comment_localonly.test new file mode 100644 index 00000000000..269f9c9dde1 --- /dev/null +++ b/dep/libzip/regress/set_comment_localonly.test @@ -0,0 +1,8 @@ +# change local comments in a zip archive +# $NiH: set_comment.test,v 1.1 2006/04/23 00:39:58 wiz Exp $ +program set_comment_localonly +return 0 +# need filename extension != zip to avoid using zipcmp, +# which doesn't look at comments +args testcomment.reg +file testcomment.reg testcomment.zip testchangedlocal.zip diff --git a/dep/libzip/regress/set_comment_removeglobal.c b/dep/libzip/regress/set_comment_removeglobal.c new file mode 100644 index 00000000000..c6cb4ccf295 --- /dev/null +++ b/dep/libzip/regress/set_comment_removeglobal.c @@ -0,0 +1,83 @@ +/* + $NiH: set_comment_removeglobal.c,v 1.1 2006/04/23 13:28:31 wiz Exp $ + + set_comment_removeglobal.c -- remove archive comment + Copyright (C) 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *prg; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + int err; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, 0, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, + archive, buf); + return 1; + } + + if (zip_set_archive_comment(za, NULL, 0) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_archive_comment failed: %s\n", + prg, buf); + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/set_comment_removeglobal.test b/dep/libzip/regress/set_comment_removeglobal.test new file mode 100644 index 00000000000..091fa7079df --- /dev/null +++ b/dep/libzip/regress/set_comment_removeglobal.test @@ -0,0 +1,8 @@ +# remove archive comment +# $NiH: set_comment_revert.test,v 1.1 2006/04/23 13:21:19 wiz Exp $ +program set_comment_removeglobal +return 0 +# need filename extension != zip to avoid using zipcmp, +# which doesn't look at comments +args testcomment.reg +file testcomment.reg testcomment.zip testcommentremoved.zip diff --git a/dep/libzip/regress/set_comment_revert.c b/dep/libzip/regress/set_comment_revert.c new file mode 100644 index 00000000000..2c7618b1985 --- /dev/null +++ b/dep/libzip/regress/set_comment_revert.c @@ -0,0 +1,103 @@ +/* + $NiH: set_comment_revert.c,v 1.2 2006/04/23 13:28:41 wiz Exp $ + + set_comment_revert.c -- set global and file comments, but revert + Copyright (C) 2006 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "zip.h" + +const char *prg; +const char *new_archive_comment="This is the new,\r\n" +"multiline archive comment.\r\n" +"Ain't it nice?"; + +int +main(int argc, char *argv[]) +{ + const char *archive; + struct zip *za; + char buf[100]; + int err; + int i; + + prg = argv[0]; + + if (argc != 2) { + fprintf(stderr, "usage: %s archive\n", prg); + return 1; + } + + archive = argv[1]; + + if ((za=zip_open(archive, 0, &err)) == NULL) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: can't open zip archive `%s': %s\n", prg, + archive, buf); + return 1; + } + + if (zip_set_archive_comment(za, new_archive_comment, + strlen(new_archive_comment)) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_archive_comment failed: %s\n", + prg, buf); + } + + for (i=0; i<zip_get_num_files(za); i++) { + snprintf(buf, sizeof(buf), "File comment no %d", i); + if (zip_set_file_comment(za, i, buf, strlen(buf)) < 0) { + zip_error_to_str(buf, sizeof(buf), err, errno); + fprintf(stderr, "%s: zip_set_file_comment on file %d failed: %s\n", + prg, i, buf); + } + } + + if (zip_unchange_all(za) == -1) { + fprintf(stderr, "%s: can't revert changes to archive `%s'\n", + prg, archive); + return 1; + } + + if (zip_close(za) == -1) { + fprintf(stderr, "%s: can't close zip archive `%s'\n", prg, archive); + return 1; + } + + return 0; +} diff --git a/dep/libzip/regress/set_comment_revert.test b/dep/libzip/regress/set_comment_revert.test new file mode 100644 index 00000000000..2d83f0c0c18 --- /dev/null +++ b/dep/libzip/regress/set_comment_revert.test @@ -0,0 +1,8 @@ +# start changing local and global comments, but revert before closing +# $NiH: set_comment_all.test,v 1.1 2006/04/23 12:25:00 wiz Exp $ +program set_comment_revert +return 0 +# need filename extension != zip to avoid using zipcmp, +# which doesn't look at comments +args testcomment.reg +file testcomment.reg testcomment.zip testcomment.zip diff --git a/dep/libzip/regress/test.zip b/dep/libzip/regress/test.zip Binary files differnew file mode 100644 index 00000000000..e4efd716b64 --- /dev/null +++ b/dep/libzip/regress/test.zip diff --git a/dep/libzip/regress/testbuffer.zip b/dep/libzip/regress/testbuffer.zip Binary files differnew file mode 100644 index 00000000000..e474989119b --- /dev/null +++ b/dep/libzip/regress/testbuffer.zip diff --git a/dep/libzip/regress/testchanged.zip b/dep/libzip/regress/testchanged.zip Binary files differnew file mode 100644 index 00000000000..d5169c96edb --- /dev/null +++ b/dep/libzip/regress/testchanged.zip diff --git a/dep/libzip/regress/testchangedlocal.zip b/dep/libzip/regress/testchangedlocal.zip Binary files differnew file mode 100644 index 00000000000..1c8b3014144 --- /dev/null +++ b/dep/libzip/regress/testchangedlocal.zip diff --git a/dep/libzip/regress/testcomment.zip b/dep/libzip/regress/testcomment.zip Binary files differnew file mode 100644 index 00000000000..45dc18d1423 --- /dev/null +++ b/dep/libzip/regress/testcomment.zip diff --git a/dep/libzip/regress/testcommentremoved.zip b/dep/libzip/regress/testcommentremoved.zip Binary files differnew file mode 100644 index 00000000000..b2e4d05dc5b --- /dev/null +++ b/dep/libzip/regress/testcommentremoved.zip diff --git a/dep/libzip/regress/testdir.zip b/dep/libzip/regress/testdir.zip Binary files differnew file mode 100644 index 00000000000..7e6e7b9625d --- /dev/null +++ b/dep/libzip/regress/testdir.zip diff --git a/dep/libzip/regress/testfile.txt b/dep/libzip/regress/testfile.txt new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/dep/libzip/regress/testfile.txt diff --git a/dep/libzip/regress/testfile.zip b/dep/libzip/regress/testfile.zip Binary files differnew file mode 100644 index 00000000000..b46d2987939 --- /dev/null +++ b/dep/libzip/regress/testfile.zip diff --git a/dep/libzip/regress/testnottorrent.zip b/dep/libzip/regress/testnottorrent.zip Binary files differnew file mode 100644 index 00000000000..e79f2439cf7 --- /dev/null +++ b/dep/libzip/regress/testnottorrent.zip diff --git a/dep/libzip/regress/testtorrent.tzip b/dep/libzip/regress/testtorrent.tzip Binary files differnew file mode 100644 index 00000000000..1da3859f70b --- /dev/null +++ b/dep/libzip/regress/testtorrent.tzip diff --git a/dep/libzip/regress/torrent-already.test b/dep/libzip/regress/torrent-already.test new file mode 100644 index 00000000000..8bd15b3bc78 --- /dev/null +++ b/dep/libzip/regress/torrent-already.test @@ -0,0 +1,6 @@ +# add directories to zip +program ../src/ziptorrent +return 0 +args -v test.zip +file test.zip testtorrent.tzip testtorrent.tzip +stdout test.zip: already torrentzipped diff --git a/dep/libzip/regress/torrent-new.test b/dep/libzip/regress/torrent-new.test new file mode 100644 index 00000000000..02242080856 --- /dev/null +++ b/dep/libzip/regress/torrent-new.test @@ -0,0 +1,6 @@ +# add directories to zip +program ../src/ziptorrent +return 0 +args -v test.zip +file test.zip testnottorrent.zip testtorrent.tzip +stdout test.zip: torrentzipping diff --git a/dep/libzip/regress/ziptest.c b/dep/libzip/regress/ziptest.c new file mode 100644 index 00000000000..7d37be55621 --- /dev/null +++ b/dep/libzip/regress/ziptest.c @@ -0,0 +1,99 @@ +#include "zip.h" +#include "error.h" + + +int +main(int argc, char *argv[]) +{ +#if 0 + int i; +#endif + struct zip *za, *destza; +#if 0 +#define BUFSIZE 65536 + struct zip_file *zf1, *zf2; + char buf1[BUFSIZE], buf2[BUFSIZE]; +#endif + +#if 0 + if (argc != 2) { + fprintf(stderr, "%s: call with one option: the zip-file to destroy" + "^H^H^H^H^H^H^Htest\n", argv[0]); + return 1; + } +#endif + if (argc != 3) { + fprintf(stderr, "%s: call with two options: src dest\n", argv[0]); + return 1; + } + + if ((za=zip_open(argv[1], ZIP_CHECKCONS))==NULL) { + fprintf(stderr, "%s: %s: can't open file: %s\n", argv[0], argv[1], + zip_err_str[zip_err]); + return 1; + } + + if ((destza=zip_open(argv[2], ZIP_CREATE))==NULL) { + fprintf(stderr, "%s: %s: can't open file: %s\n", argv[0], argv[2], + zip_err_str[zip_err]); + return 1; + } + +#if 0 + for (i=0; i<za->nentry; i++) { + printf("%8d %s\n", za->entry[i].uncomp_size, za->entry[i].fn); + zip_add_zip(destza, za->entry[i].fn, za, i, 0, 0); + } +#endif + + if (zip_add_zip(destza, NULL, NULL, za, 0, 0, 0) == -1) + fprintf(stderr, "%s: %s: can't add file to zip '%s': %s\n", argv[0], + za->entry[0].fn, argv[1], zip_err_str[zip_err]); + +#if 0 + zf1= zf_open_index(za, 1); + if (!zf1) { + fprintf(stderr, "boese, boese\n"); + exit(100); + } + + i = zf_read(zf1, buf1, 100); + if (i < 0) + fprintf(stderr, "read error: %s\n", zip_err_str[zf1->flags]); + else { + buf1[i] = 0; + printf("read %d bytes: '%s'\n", i, buf1); + } + zf2 = zf_open_index(za, 1); + i = zf_read(zf2, buf2, 200); + if (i < 0) + fprintf(stderr, "read error: %s\n", zip_err_str[zf2->flags]); + else { + buf2[i] = 0; + printf("read %d bytes: '%s'\n", i, buf2); + } + i = zf_read(zf1, buf1, 100); + if (i < 0) + fprintf(stderr, "read error: %s\n", zip_err_str[zf1->flags]); + else { + buf1[i] = 0; + printf("read %d bytes: '%s'\n", i, buf1); + } + zf_close(zf1); + zf_close(zf2); +#endif + + if (zip_close(destza)!=0) { + fprintf(stderr, "%s: %s: can't close file: %s\n", argv[0], argv[2], + zip_err_str[zip_err]); + return 1; + } + + if (zip_close(za)!=0) { + fprintf(stderr, "%s: %s: can't close file: %s\n", argv[0], argv[1], + zip_err_str[zip_err]); + return 1; + } + + return 0; +} |
