summaryrefslogtreecommitdiff
path: root/Build/source/utils/lzma-utils/src/lzma
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/lzma-utils/src/lzma')
-rw-r--r--Build/source/utils/lzma-utils/src/lzma/Exception.h45
-rw-r--r--Build/source/utils/lzma-utils/src/lzma/Makefile.am40
-rw-r--r--Build/source/utils/lzma-utils/src/lzma/Makefile.in653
-rw-r--r--Build/source/utils/lzma-utils/src/lzma/lzma.1228
-rw-r--r--Build/source/utils/lzma-utils/src/lzma/lzmp.cpp895
5 files changed, 1861 insertions, 0 deletions
diff --git a/Build/source/utils/lzma-utils/src/lzma/Exception.h b/Build/source/utils/lzma-utils/src/lzma/Exception.h
new file mode 100644
index 00000000000..6bae26f8b90
--- /dev/null
+++ b/Build/source/utils/lzma-utils/src/lzma/Exception.h
@@ -0,0 +1,45 @@
+/* A couple of exceptions for lzmp.
+ *
+ * Copyright (C) 2005 Ville Koskinen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _EXCEPTION_H_
+#define _EXCEPTION_H_
+
+#include <string>
+using std::string;
+
+class Exception
+{
+private:
+ string message;
+public:
+ Exception(char *what): message(what) { }
+ Exception(string what): message(what) { }
+
+ ~Exception() { }
+
+ string what(void) { return message; }
+};
+
+class ArgumentException: public Exception
+{
+public:
+ ArgumentException(char *what): Exception(what) { }
+ ArgumentException(string what): Exception(what) { }
+
+ ~ArgumentException() { }
+};
+
+#endif
+
diff --git a/Build/source/utils/lzma-utils/src/lzma/Makefile.am b/Build/source/utils/lzma-utils/src/lzma/Makefile.am
new file mode 100644
index 00000000000..ff19d581419
--- /dev/null
+++ b/Build/source/utils/lzma-utils/src/lzma/Makefile.am
@@ -0,0 +1,40 @@
+AM_CXXFLAGS = @SDK_CXXFLAGS@ -I../ -I../sdk -I../sdk/7zip
+
+# Avoid dependency on libstdc++:
+#AM_LDFLAGS = -lsupc++ -static-libgcc
+
+bin_PROGRAMS = lzma
+
+lzma_SOURCES = lzmp.cpp Exception.h \
+ ../sdk/Common/C_FileIO.cpp \
+ ../sdk/Common/CRC.cpp \
+ ../sdk/Common/Alloc.cpp \
+ ../sdk/7zip/Common/FileStreams.cpp \
+ ../sdk/7zip/Common/InBuffer.cpp \
+ ../sdk/7zip/Common/OutBuffer.cpp
+
+lzma_LDADD = ../sdk/7zip/Compress/LZMA/libLZMA.a \
+ ../sdk/7zip/Compress/LZ/libLZ.a \
+ ../sdk/7zip/Common/libCommon.a \
+ ../sdk/7zip/Compress/RangeCoder/libRangeCoder.a
+
+dist_man_MANS = lzma.1
+
+# Create symlinks for unlzma and lzcat:
+install-exec-hook:
+ cd $(DESTDIR)$(bindir) && \
+ rm -f unlzma lzcat && \
+ $(LN_S) lzma unlzma && \
+ $(LN_S) lzma lzcat
+
+install-data-hook:
+ cd $(DESTDIR)$(mandir)/man1 && \
+ rm -f unlzma.1 lzcat.1 && \
+ $(LN_S) lzma.1 unlzma.1 && \
+ $(LN_S) lzma.1 lzcat.1
+
+uninstall-hook:
+ cd $(DESTDIR)$(bindir) && \
+ rm -f unlzma lzcat
+ cd $(DESTDIR)$(mandir)/man1 && \
+ rm -f unlzma.1 lzcat.1
diff --git a/Build/source/utils/lzma-utils/src/lzma/Makefile.in b/Build/source/utils/lzma-utils/src/lzma/Makefile.in
new file mode 100644
index 00000000000..a7f72c21bce
--- /dev/null
+++ b/Build/source/utils/lzma-utils/src/lzma/Makefile.in
@@ -0,0 +1,653 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 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@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@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@
+bin_PROGRAMS = lzma$(EXEEXT)
+subdir = src/lzma
+DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_lzma_OBJECTS = lzmp.$(OBJEXT) C_FileIO.$(OBJEXT) CRC.$(OBJEXT) \
+ Alloc.$(OBJEXT) FileStreams.$(OBJEXT) InBuffer.$(OBJEXT) \
+ OutBuffer.$(OBJEXT)
+lzma_OBJECTS = $(am_lzma_OBJECTS)
+lzma_DEPENDENCIES = ../sdk/7zip/Compress/LZMA/libLZMA.a \
+ ../sdk/7zip/Compress/LZ/libLZ.a ../sdk/7zip/Common/libCommon.a \
+ ../sdk/7zip/Compress/RangeCoder/libRangeCoder.a
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+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 = $(lzma_SOURCES)
+DIST_SOURCES = $(lzma_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(dist_man_MANS)
+ETAGS = etags
+CTAGS = ctags
+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@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SDK_CFLAGS = @SDK_CFLAGS@
+SDK_CXXFLAGS = @SDK_CXXFLAGS@
+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_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+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@
+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_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = @SDK_CXXFLAGS@ -I../ -I../sdk -I../sdk/7zip
+lzma_SOURCES = lzmp.cpp Exception.h \
+ ../sdk/Common/C_FileIO.cpp \
+ ../sdk/Common/CRC.cpp \
+ ../sdk/Common/Alloc.cpp \
+ ../sdk/7zip/Common/FileStreams.cpp \
+ ../sdk/7zip/Common/InBuffer.cpp \
+ ../sdk/7zip/Common/OutBuffer.cpp
+
+lzma_LDADD = ../sdk/7zip/Compress/LZMA/libLZMA.a \
+ ../sdk/7zip/Compress/LZ/libLZ.a \
+ ../sdk/7zip/Common/libCommon.a \
+ ../sdk/7zip/Compress/RangeCoder/libRangeCoder.a
+
+dist_man_MANS = lzma.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lzma/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/lzma/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
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+lzma$(EXEEXT): $(lzma_OBJECTS) $(lzma_DEPENDENCIES)
+ @rm -f lzma$(EXEEXT)
+ $(CXXLINK) $(lzma_OBJECTS) $(lzma_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CRC.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/C_FileIO.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileStreams.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InBuffer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OutBuffer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzmp.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+C_FileIO.o: ../sdk/Common/C_FileIO.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT C_FileIO.o -MD -MP -MF $(DEPDIR)/C_FileIO.Tpo -c -o C_FileIO.o `test -f '../sdk/Common/C_FileIO.cpp' || echo '$(srcdir)/'`../sdk/Common/C_FileIO.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/C_FileIO.Tpo $(DEPDIR)/C_FileIO.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/Common/C_FileIO.cpp' object='C_FileIO.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o C_FileIO.o `test -f '../sdk/Common/C_FileIO.cpp' || echo '$(srcdir)/'`../sdk/Common/C_FileIO.cpp
+
+C_FileIO.obj: ../sdk/Common/C_FileIO.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT C_FileIO.obj -MD -MP -MF $(DEPDIR)/C_FileIO.Tpo -c -o C_FileIO.obj `if test -f '../sdk/Common/C_FileIO.cpp'; then $(CYGPATH_W) '../sdk/Common/C_FileIO.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/Common/C_FileIO.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/C_FileIO.Tpo $(DEPDIR)/C_FileIO.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/Common/C_FileIO.cpp' object='C_FileIO.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o C_FileIO.obj `if test -f '../sdk/Common/C_FileIO.cpp'; then $(CYGPATH_W) '../sdk/Common/C_FileIO.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/Common/C_FileIO.cpp'; fi`
+
+CRC.o: ../sdk/Common/CRC.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CRC.o -MD -MP -MF $(DEPDIR)/CRC.Tpo -c -o CRC.o `test -f '../sdk/Common/CRC.cpp' || echo '$(srcdir)/'`../sdk/Common/CRC.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/CRC.Tpo $(DEPDIR)/CRC.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/Common/CRC.cpp' object='CRC.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CRC.o `test -f '../sdk/Common/CRC.cpp' || echo '$(srcdir)/'`../sdk/Common/CRC.cpp
+
+CRC.obj: ../sdk/Common/CRC.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CRC.obj -MD -MP -MF $(DEPDIR)/CRC.Tpo -c -o CRC.obj `if test -f '../sdk/Common/CRC.cpp'; then $(CYGPATH_W) '../sdk/Common/CRC.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/Common/CRC.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/CRC.Tpo $(DEPDIR)/CRC.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/Common/CRC.cpp' object='CRC.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CRC.obj `if test -f '../sdk/Common/CRC.cpp'; then $(CYGPATH_W) '../sdk/Common/CRC.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/Common/CRC.cpp'; fi`
+
+Alloc.o: ../sdk/Common/Alloc.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Alloc.o -MD -MP -MF $(DEPDIR)/Alloc.Tpo -c -o Alloc.o `test -f '../sdk/Common/Alloc.cpp' || echo '$(srcdir)/'`../sdk/Common/Alloc.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Alloc.Tpo $(DEPDIR)/Alloc.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/Common/Alloc.cpp' object='Alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Alloc.o `test -f '../sdk/Common/Alloc.cpp' || echo '$(srcdir)/'`../sdk/Common/Alloc.cpp
+
+Alloc.obj: ../sdk/Common/Alloc.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Alloc.obj -MD -MP -MF $(DEPDIR)/Alloc.Tpo -c -o Alloc.obj `if test -f '../sdk/Common/Alloc.cpp'; then $(CYGPATH_W) '../sdk/Common/Alloc.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/Common/Alloc.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Alloc.Tpo $(DEPDIR)/Alloc.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/Common/Alloc.cpp' object='Alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Alloc.obj `if test -f '../sdk/Common/Alloc.cpp'; then $(CYGPATH_W) '../sdk/Common/Alloc.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/Common/Alloc.cpp'; fi`
+
+FileStreams.o: ../sdk/7zip/Common/FileStreams.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FileStreams.o -MD -MP -MF $(DEPDIR)/FileStreams.Tpo -c -o FileStreams.o `test -f '../sdk/7zip/Common/FileStreams.cpp' || echo '$(srcdir)/'`../sdk/7zip/Common/FileStreams.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/FileStreams.Tpo $(DEPDIR)/FileStreams.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/7zip/Common/FileStreams.cpp' object='FileStreams.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FileStreams.o `test -f '../sdk/7zip/Common/FileStreams.cpp' || echo '$(srcdir)/'`../sdk/7zip/Common/FileStreams.cpp
+
+FileStreams.obj: ../sdk/7zip/Common/FileStreams.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FileStreams.obj -MD -MP -MF $(DEPDIR)/FileStreams.Tpo -c -o FileStreams.obj `if test -f '../sdk/7zip/Common/FileStreams.cpp'; then $(CYGPATH_W) '../sdk/7zip/Common/FileStreams.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/7zip/Common/FileStreams.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/FileStreams.Tpo $(DEPDIR)/FileStreams.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/7zip/Common/FileStreams.cpp' object='FileStreams.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FileStreams.obj `if test -f '../sdk/7zip/Common/FileStreams.cpp'; then $(CYGPATH_W) '../sdk/7zip/Common/FileStreams.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/7zip/Common/FileStreams.cpp'; fi`
+
+InBuffer.o: ../sdk/7zip/Common/InBuffer.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT InBuffer.o -MD -MP -MF $(DEPDIR)/InBuffer.Tpo -c -o InBuffer.o `test -f '../sdk/7zip/Common/InBuffer.cpp' || echo '$(srcdir)/'`../sdk/7zip/Common/InBuffer.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/InBuffer.Tpo $(DEPDIR)/InBuffer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/7zip/Common/InBuffer.cpp' object='InBuffer.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InBuffer.o `test -f '../sdk/7zip/Common/InBuffer.cpp' || echo '$(srcdir)/'`../sdk/7zip/Common/InBuffer.cpp
+
+InBuffer.obj: ../sdk/7zip/Common/InBuffer.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT InBuffer.obj -MD -MP -MF $(DEPDIR)/InBuffer.Tpo -c -o InBuffer.obj `if test -f '../sdk/7zip/Common/InBuffer.cpp'; then $(CYGPATH_W) '../sdk/7zip/Common/InBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/7zip/Common/InBuffer.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/InBuffer.Tpo $(DEPDIR)/InBuffer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/7zip/Common/InBuffer.cpp' object='InBuffer.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InBuffer.obj `if test -f '../sdk/7zip/Common/InBuffer.cpp'; then $(CYGPATH_W) '../sdk/7zip/Common/InBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/7zip/Common/InBuffer.cpp'; fi`
+
+OutBuffer.o: ../sdk/7zip/Common/OutBuffer.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT OutBuffer.o -MD -MP -MF $(DEPDIR)/OutBuffer.Tpo -c -o OutBuffer.o `test -f '../sdk/7zip/Common/OutBuffer.cpp' || echo '$(srcdir)/'`../sdk/7zip/Common/OutBuffer.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/OutBuffer.Tpo $(DEPDIR)/OutBuffer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/7zip/Common/OutBuffer.cpp' object='OutBuffer.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o OutBuffer.o `test -f '../sdk/7zip/Common/OutBuffer.cpp' || echo '$(srcdir)/'`../sdk/7zip/Common/OutBuffer.cpp
+
+OutBuffer.obj: ../sdk/7zip/Common/OutBuffer.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT OutBuffer.obj -MD -MP -MF $(DEPDIR)/OutBuffer.Tpo -c -o OutBuffer.obj `if test -f '../sdk/7zip/Common/OutBuffer.cpp'; then $(CYGPATH_W) '../sdk/7zip/Common/OutBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/7zip/Common/OutBuffer.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/OutBuffer.Tpo $(DEPDIR)/OutBuffer.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../sdk/7zip/Common/OutBuffer.cpp' object='OutBuffer.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o OutBuffer.obj `if test -f '../sdk/7zip/Common/OutBuffer.cpp'; then $(CYGPATH_W) '../sdk/7zip/Common/OutBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/../sdk/7zip/Common/OutBuffer.cpp'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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)
+
+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-binPROGRAMS clean-generic clean-libtool 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
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-ps: 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: uninstall-binPROGRAMS uninstall-man
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-data-am install-exec-am install-strip \
+ uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am \
+ install-data-hook install-dvi install-dvi-am install-exec \
+ install-exec-am install-exec-hook install-html install-html-am \
+ install-info install-info-am install-man install-man1 \
+ 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 \
+ uninstall-binPROGRAMS uninstall-hook uninstall-man \
+ uninstall-man1
+
+
+# Create symlinks for unlzma and lzcat:
+install-exec-hook:
+ cd $(DESTDIR)$(bindir) && \
+ rm -f unlzma lzcat && \
+ $(LN_S) lzma unlzma && \
+ $(LN_S) lzma lzcat
+
+install-data-hook:
+ cd $(DESTDIR)$(mandir)/man1 && \
+ rm -f unlzma.1 lzcat.1 && \
+ $(LN_S) lzma.1 unlzma.1 && \
+ $(LN_S) lzma.1 lzcat.1
+
+uninstall-hook:
+ cd $(DESTDIR)$(bindir) && \
+ rm -f unlzma lzcat
+ cd $(DESTDIR)$(mandir)/man1 && \
+ rm -f unlzma.1 lzcat.1
+# 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/Build/source/utils/lzma-utils/src/lzma/lzma.1 b/Build/source/utils/lzma-utils/src/lzma/lzma.1
new file mode 100644
index 00000000000..dfcbac329b7
--- /dev/null
+++ b/Build/source/utils/lzma-utils/src/lzma/lzma.1
@@ -0,0 +1,228 @@
+.TH LZMA 1 "23 Dec 2005" "LZMA utils"
+
+.SH NAME
+lzma, unlzma, lzcat \- LZMA compression and decompression tool
+
+.SH SYNOPSIS
+.B lzma
+.RB [ \-123456789cdefhkLqtvV "] [" \-S
+.IR suffix "] [" "filenames ..." ]
+.br
+.B unlzma
+.RB [ \-cfhkLqtvV "] [" \-S
+.IR suffix "] [" "filenames ..." ]
+.br
+.B lzcat
+.RB [ \-fhLqV ]
+.RI [ "filenames ..." ]
+
+.SH DESCRIPTION
+LZMA (Lempel-Ziv-Markov chain-Algorithm) is an improved version of
+famous LZ77 compression algorithm. It was improved in way of maximum
+increasing of compression ratio, keeping high decompression speed and
+low memory requirements for decompressing.
+.PP
+.B lzma
+command line tool has a similar interface to
+.BR gzip (1)
+and
+.BR bzip2 (1)
+and is intended to make use of LZMA compression easy for the users who
+are already familiar with gzip and bzip2.
+.PP
+In this manual
+.B lzma
+is compared mostly to bzip2 because that is currently one of the most
+widely used free software to compress tar files made for distribution.
+Comparing lzma to gzip is not practical because neither lzma nor bzip2
+can compete with gzip in compression speed. On the other hand the
+compression ratio of gzip is worse than of lzma and bzip2.
+.PP
+.B lzma
+provides notably better compression ratio than bzip2 especially with
+files having other than plain text content. The other advantage of
+.B lzma
+is fast decompression which is many times quicker than bzip2. The major
+disadvantage is that achieving the highest compression ratios requires
+extensive amount of system resources, both CPU time and RAM. Also
+software to handle LZMA compressed files is not installed by default on
+most distributions.
+.PP
+When compressing or decompressing with
+.BR lzma ,
+the new file will have the same ownership information, permissions and
+timestamps as the original file. However the this information is not
+stored into the compressed file like gzip does.
+
+.SH STREAMED VS. NON-STREAMED
+LZMA files can be either streamed or non-streamed. Non-streamed files
+are created only when the size of the file being compressed is known. In
+practice this means that the source file must be a regular file. In
+other words, if compressing from the standard input or from a named pipe
+(fifo) the compressed file will always be streamed.
+.PP
+Both streamed and non-streamed files are compressed identically; the
+only differences are found from the beginnings and ends of LZMA
+compressed files: Non-streamed files contain the uncompressed size of
+the file in the LZMA file header; streamed files have uncompressed size
+marked as unknown. To know where to stop decoding, streamed files have a
+special End Of Stream marker at the end of the LZMA file. The EOS marker
+makes streamed files five or six bytes bigger than non-streamed.
+.PP
+So in practice creating non-streamed files has two advantages: 1) the
+compressed file is a few bytes smaller and 2) the uncompressed size of
+the file can be checked without decompressing the file. To view the data
+stored in the LZMA header use
+.BR lzmainfo (1).
+
+.SH OPTIONS
+Short options can be grouped like
+.BR \-cd.
+.TP
+.B \-c \-\-stdout \-\-to\-stdout
+The output is written to the standard output. The original files are kept
+unchanged. When compressing to the standard output there can be only one
+input file. This option is implied when input is read from the standard
+input or the script is invoked as
+.BR lzcat .
+.TP
+.B \-d \-\-decompress \-\-uncompress
+Force decompression regardless of the invocation name. This the default
+when called as
+.B unlzma
+or
+.BR lzcat .
+.TP
+.B \-f \-\-force
+Force compression or decompression even if source file is a symlink,
+target exists, or target is a terminal. In contrast to gzip and bzip2,
+if input data is not in LZMA format, \-\-force does not make lzma
+behave like
+.BR cat .
+.B lzma
+never prompts if target file should be overwritten; existing files are
+skipped or, in case of
+.BR \-\-force ,
+overwritten.
+.TP
+.B \-h \-\-help
+Show a summary of supported options and quit.
+.TP
+.B \-k \-\-keep
+Do not delete the input files after compression or decompression.
+.TP
+.B \-L \-\-license
+Show licensing information of
+.BR lzma .
+.TP
+.B \-q \-\-quiet
+Suppress all warnings. You can still check the exit status to detect if
+a warning had been shown.
+.TP
+.BI "\-S \-\-suffix " .suf
+Use
+.I .suf
+instead of the default
+.BR .lzma .
+A null suffix forces unlzma to decompress all the given files
+regardless of the filename suffix.
+.TP
+.B \-t \-\-test
+Check the integrity of the compressed file(s). Without
+.B \-\-verbose
+no output is produced if no errors are found.
+.TP
+.B \-v \-\-verbose
+Show the filename and percentage reduction of each processes file.
+.TP
+.B \-V \-\-version
+Show the version number of
+.BR lzma .
+.TP
+.B \-z \-\-compress
+Force compression regardless of the invocation name.
+.TP
+.BR \-1 " .. " \-9
+Set the compression ratio. See the next chapter for detailed
+information. These options have no effect when decompressing.
+.TP
+.B \-\-fast
+Alias to
+.BR \-1 .
+.TP
+.B \-\-best
+Alias to
+.BR \-9 .
+
+.SH COMPRESSION OPTIONS AND MEMORY USAGE
+The compression options of
+.B lzma
+are divided to two groups. The first two
+.RB ( \-1 " and " \-2 )
+are designed for fast compression speed.
+.BR \-3 " .. " \-9
+provide good to excellent compression ratio but require more CPU time
+and system memory.
+.PP
+For relatively fast compression with medium compression ratio
+.B \-1
+is the recommended setting. It's faster than 'bzip2 \-\-fast' and
+usually creates smaller files than 'bzip2 \-\-best'.
+.B \-2
+makes somewhat smaller files but doubles the compression time close to
+what 'bzip2 \-\-best' takes.
+.PP
+Generally for excellent compression ratio, acceptable compression time
+and memory requirements (about 83 MB for compression, 9 MB for
+decompression) you should use
+.B \-7
+which is also the default.
+.B \-8
+and
+.B \-9
+will give some gain especially with bigger files (>=tens of megabytes)
+but also increase the CPU and memory requirements dramatically. See the
+table below for memory requirements of different compression settings.
+.PP
+ Flag Compress usage Decompress usage
+ -1 2 MB 1 MB
+ -2 12 MB 2 MB
+ -3 12 MB 1 MB
+ -4 16 MB 2 MB
+ -5 26 MB 3 MB
+ -6 45 MB 5 MB
+ -7 83 MB 9 MB
+ -8 159 MB 17 MB
+ -9 311 MB 33 MB
+
+.SH DIAGNOSTICS
+Exit status:
+.br
+.B 0
+\- Everything OK.
+.br
+.B 1
+\- An error occurred.
+.br
+.B 2
+\- Something worth a warning happened but no errors.
+
+.SH AUTHORS
+The LZMA algorithm and the implementation used in LZMA utils was
+developed by Igor Pavlov. The original code is available in LZMA SDK
+which can be found from http://7-zip.org/sdk.html .
+.PP
+.B lzma
+command line tool was written by Ville Koskinen.
+http://tukaani.org/lzma/
+.PP
+This manual page is inspired by manual pages of
+.B gzip
+and
+.BR bzip2 .
+
+.SH SEE ALSO
+.BR lzmadec (1),
+.BR lzmainfo (1),
+.BR gzip (1),
+.BR bzip2 (1)
diff --git a/Build/source/utils/lzma-utils/src/lzma/lzmp.cpp b/Build/source/utils/lzma-utils/src/lzma/lzmp.cpp
new file mode 100644
index 00000000000..4a53de7010b
--- /dev/null
+++ b/Build/source/utils/lzma-utils/src/lzma/lzmp.cpp
@@ -0,0 +1,895 @@
+/*
+ * LZMA command line tool similar to gzip to encode and decode LZMA files.
+ *
+ * Copyright (C) 2005 Ville Koskinen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
+
+#include "sdk/Common/MyInitGuid.h"
+#include "sdk/Common/MyWindows.h"
+
+#include <iostream>
+using std::cout;
+using std::cerr;
+using std::endl;
+
+#include <cstdio>
+#include <cstring>
+
+#include <string>
+using std::string;
+#include <vector>
+using std::vector;
+typedef vector<string> stringVector;
+
+#include <unistd.h>
+#include <getopt.h>
+#include <signal.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <utime.h>
+#include <sys/time.h> // futimes()
+
+// For Solaris
+#ifndef HAVE_FUTIMES
+#define futimes(fd, tv) futimesat(fd, NULL, tv)
+#endif
+
+#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
+#include <fcntl.h>
+#include <io.h>
+#define MY_SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
+#else
+#define MY_SET_BINARY_MODE(file)
+#endif
+
+#include "sdk/7zip/Common/FileStreams.h"
+
+#include "sdk/Common/Types.h"
+
+#include "sdk/7zip/Compress/LZMA/LZMADecoder.h"
+#include "sdk/7zip/Compress/LZMA/LZMAEncoder.h"
+
+#include "Exception.h"
+
+#include "lzma_version.h"
+
+namespace lzma {
+
+const char *PROGRAM_VERSION = PACKAGE_VERSION;
+const char *PROGRAM_COPYRIGHT = "Copyright (C) 2005 Ville Koskinen";
+
+/* LZMA_Alone switches:
+ -a{N}: set compression mode - [0, 2], default: 2 (max)
+ -d{N}: set dictionary - [0,28], default: 23 (8MB)
+ -fb{N}: set number of fast bytes - [5, 255], default: 128
+ -lc{N}: set number of literal context bits - [0, 8], default: 3
+ -lp{N}: set number of literal pos bits - [0, 4], default: 0
+ -pb{N}: set number of pos bits - [0, 4], default: 2
+ -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,
+ pat2h, pat3h, pat4h, hc3, hc4], default: bt4
+*/
+
+struct lzma_option {
+ short compression_mode; // -a
+ short dictionary; // -d
+ short fast_bytes; // -fb
+ wchar_t *match_finder; // -mf
+ short literal_context_bits; // -lc
+ short literal_pos_bits; // -lp
+ short pos_bits; // -pb
+};
+
+/* The following is a mapping from gzip/bzip2 style -1 .. -9 compression modes
+ * to the corresponding LZMA compression modes. Thanks, Larhzu, for coining
+ * these. */
+const lzma_option option_mapping[] = {
+ { 0, 0, 0, NULL, 0, 0, 0}, // -0 (needed for indexing)
+ { 0, 16, 64, L"hc3", 3, 0, 2}, // -1
+ { 0, 20, 64, L"hc4", 3, 0, 2}, // -2
+ { 1, 19, 64, L"bt4", 3, 0, 2}, // -3
+ { 2, 20, 64, L"bt4", 3, 0, 2}, // -4
+ { 2, 21, 128, L"bt4", 3, 0, 2}, // -5
+ { 2, 22, 128, L"bt4", 3, 0, 2}, // -6
+ { 2, 23, 128, L"bt4", 3, 0, 2}, // -7
+ { 2, 24, 255, L"bt4", 3, 0, 2}, // -8
+ { 2, 25, 255, L"bt4", 3, 0, 2}, // -9
+};
+
+struct extension_pair {
+ char *from;
+ char *to;
+};
+
+const extension_pair known_extensions[] = {
+ { ".lzma", "" },
+ { ".tlz", ".tar" },
+ { NULL, NULL }
+};
+
+/* Sorry, I just happen to like enumerations. */
+enum PROGRAM_MODE {
+ PM_COMPRESS = 0,
+ PM_DECOMPRESS,
+ PM_TEST,
+ PM_HELP,
+ PM_LICENSE,
+ PM_VERSION
+};
+
+enum {
+ STATUS_OK = 0,
+ STATUS_ERROR = 1,
+ STATUS_WARNING = 2
+};
+
+/* getopt options. */
+/* struct option { name, has_arg, flag, val } */
+const struct option long_options[] = {
+ { "stdout", 0, 0, 'c' },
+ { "decompress", 0, 0, 'd' },
+ { "compress", 0, 0, 'z' },
+ { "keep", 0, 0, 'k' },
+ { "force", 0, 0, 'f' },
+ { "test", 0, 0, 't' },
+ { "suffix", 1, 0, 'S' },
+ { "quiet", 0, 0, 'q' },
+ { "verbose", 0, 0, 'v' },
+ { "help", 0, 0, 'h' },
+ { "license", 0, 0, 'L' },
+ { "version", 0, 0, 'V' },
+ { "fast", 0, 0, '1' },
+ { "best", 0, 0, '9' },
+ { 0, 0, 0, 0 }
+};
+
+/* getopt option string (for the above options). */
+const char option_string[] = "cdzkftS:qvhLV123456789A:D:F:";
+
+/* Defaults. */
+PROGRAM_MODE program_mode = PM_COMPRESS;
+int verbosity = 0;
+bool stdinput = false;
+bool stdoutput = false;
+bool keep = false;
+bool force = false;
+int compression_mode = 7;
+//char *suffix = strdup(".lzma");
+char *suffix = strdup(known_extensions[0].from);
+lzma_option advanced_options = { -1, -1, -1, NULL, -1, -1, -1 };
+
+void print_help(const char *const argv0)
+{
+ // Help goes to stdout while other messages go to stderr.
+ cout << "\nlzma " << PROGRAM_VERSION
+ << " " << PROGRAM_COPYRIGHT << "\n"
+ "Based on LZMA SDK " << LZMA_SDK_VERSION_STRING << " "
+ << LZMA_SDK_COPYRIGHT_STRING
+ << "\n\nUsage: " << argv0
+ << " [flags and input files in any order]\n"
+" -c --stdout output to standard output\n"
+" -d --decompress force decompression\n"
+" -z --compress force compression\n"
+" -k --keep keep (don't delete) input files\n"
+" -f --force force overwrite of output file and compress links\n"
+" -t --test test compressed file integrity\n"
+" -S .suf --suffix .suf use suffix .suf on compressed files\n"
+" -q --quiet suppress error messages\n"
+" -v --verbose be verbose\n"
+" -h --help print this message\n"
+" -L --license display the license information\n"
+" -V --version display version numbers of LZMA SDK and lzma\n"
+" -1 .. -2 fast compression\n"
+" -3 .. -9 good to excellent compression. -7 is the default.\n"
+" --fast alias for -1\n"
+" --best alias for -9 (usually *not* what you want)\n\n"
+" Memory usage depends a lot on the chosen compression mode -1 .. -9.\n"
+" See the man page lzma(1) for details.\n\n";
+}
+
+void print_license(void)
+{
+ cout << "\n LZMA command line tool " << PROGRAM_VERSION << " - "
+ << PROGRAM_COPYRIGHT
+ << "\n LZMA SDK " << LZMA_SDK_VERSION_STRING << " - "
+ << LZMA_SDK_COPYRIGHT_STRING
+ << "\n This program is a part of the LZMA utils package.\n"
+ " http://tukaani.org/lzma/\n\n"
+" This program is free software; you can redistribute it and/or\n"
+" modify it under the terms of the GNU General Public License\n"
+" as published by the Free Software Foundation; either version 2\n"
+" of the License, or (at your option) any later version.\n"
+"\n"
+" This program is distributed in the hope that it will be useful,\n"
+" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+" GNU General Public License for more details.\n"
+"\n";
+}
+
+void print_version(void)
+{
+ cout << "LZMA command line tool " << PROGRAM_VERSION << "\n"
+ << "LZMA SDK " << LZMA_SDK_VERSION_STRING << "\n";
+}
+
+short str2int (const char *str, const int &min, const int &max)
+{
+ int value = -1;
+ char *endptr = NULL;
+ if (str == NULL || str[0] == '\0')
+ throw ArgumentException("Invalid integer option");
+ value = strtol (str, &endptr, 10);
+ if (*endptr != '\0' || value < min || value > max)
+ throw ArgumentException("Invalid integer option");
+ return value;
+}
+
+void parse_options(int argc, char **argv, stringVector &filenames)
+{
+ /* Snatched from getopt(3). */
+ int c;
+
+ /* Check how we were called */
+ {
+ char *p = strrchr (argv[0], '/'); // Remove path prefix, if any
+ if (p++ == NULL)
+ p = argv[0];
+ if (strstr (p, "un") != NULL) {
+ program_mode = PM_DECOMPRESS;
+ } else if (strstr (p, "cat") != NULL) {
+ program_mode = PM_DECOMPRESS;
+ stdoutput = true;
+ }
+ }
+
+ while (-1 != (c = getopt_long(argc, argv, option_string,
+ long_options, NULL))) {
+ switch (c) {
+ // stdout
+ case 'c':
+ stdoutput = true;
+ break;
+
+ // decompress
+ case 'd':
+ program_mode = PM_DECOMPRESS;
+ break;
+
+ // compress
+ case 'z':
+ program_mode = PM_COMPRESS;
+ break;
+
+ // keep
+ case 'k':
+ keep = true;
+ break;
+
+ // force
+ case 'f':
+ force = true;
+ break;
+
+ // test
+ case 't':
+ program_mode = PM_TEST;
+ break;
+
+ // suffix
+ case 'S':
+ if (optarg) {
+ free(suffix);
+ suffix = strdup(optarg);
+ }
+ break;
+
+ // quiet
+ case 'q':
+ verbosity = 0;
+ break;
+
+ // verbose
+ case 'v':
+ verbosity++;
+ break;
+
+ // help
+ case 'h':
+ program_mode = PM_HELP;
+ break;
+
+ // license
+ case 'L':
+ program_mode = PM_LICENSE;
+ break;
+
+ // version
+ case 'V':
+ program_mode = PM_VERSION;
+ break;
+
+ case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9':
+ compression_mode = c - '0';
+ break;
+
+ // Advanced options //
+ // Compression mode
+ case 'A':
+ advanced_options.compression_mode =
+ str2int (optarg, 0, 2);
+ break;
+
+ // Dictionary size
+ case 'D':
+ advanced_options.dictionary =
+ str2int (optarg, 0, 28);
+ break;
+
+ // Fast bytes
+ case 'F':
+ advanced_options.fast_bytes =
+ str2int (optarg, 0, 273);
+ break;
+
+ default:
+ throw ArgumentException("");
+ break;
+ } // switch(c)
+ } // while(1)
+
+ for (int i = optind; i < argc; i++) {
+ if (strcmp("-", argv[i]) == 0)
+ continue;
+ filenames.push_back(argv[i]);
+ }
+} // parse_options
+
+void set_encoder_properties(NCompress::NLZMA::CEncoder *encoder,
+ lzma_option &opt)
+{
+ /* Almost verbatim from LzmaAlone.cpp. */
+ PROPID propIDs[] =
+ {
+ NCoderPropID::kDictionarySize,
+ NCoderPropID::kPosStateBits,
+ NCoderPropID::kLitContextBits,
+ NCoderPropID::kLitPosBits,
+ NCoderPropID::kAlgorithm,
+ NCoderPropID::kNumFastBytes,
+ NCoderPropID::kMatchFinder,
+ NCoderPropID::kEndMarker
+ };
+ const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
+#define VALUE(x) (advanced_options.x >= 0 ? advanced_options.x : opt.x)
+ PROPVARIANT properties[kNumProps];
+ for (int p = 0; p < 6; p++)
+ properties[p].vt = VT_UI4;
+ properties[0].ulVal = UInt32(1 << VALUE (dictionary));
+ properties[1].ulVal = UInt32(VALUE (pos_bits));
+ properties[2].ulVal = UInt32(VALUE (literal_context_bits));
+ properties[3].ulVal = UInt32(VALUE (literal_pos_bits));
+ properties[4].ulVal = UInt32(VALUE (compression_mode));
+ properties[5].ulVal = UInt32(VALUE (fast_bytes));
+#undef VALUE
+
+ properties[6].vt = VT_BSTR;
+ properties[6].bstrVal = (BSTR)opt.match_finder;
+
+ properties[7].vt = VT_BOOL;
+ properties[7].boolVal = stdinput ? VARIANT_TRUE : VARIANT_FALSE;
+
+ if (encoder->SetCoderProperties(propIDs, properties, kNumProps) != S_OK)
+ throw Exception("SetCoderProperties() error");
+}
+
+void encode(NCompress::NLZMA::CEncoder *encoderSpec,
+ CMyComPtr<ISequentialInStream> inStream,
+ CMyComPtr<ISequentialOutStream> outStream,
+ lzma_option encoder_options,
+ UInt64 fileSize)
+{
+ set_encoder_properties(encoderSpec, encoder_options);
+
+ encoderSpec->WriteCoderProperties(outStream);
+
+ for (int i = 0; i < 8; i++)
+ {
+ Byte b = Byte(fileSize >> (8 * i));
+ if (outStream->Write(&b, sizeof(b), 0) != S_OK)
+ throw Exception("Write error while encoding");
+ }
+
+ HRESULT result = encoderSpec->Code(inStream, outStream, 0, 0, 0);
+
+ if (result == E_OUTOFMEMORY)
+ throw Exception("Cannot allocate memory");
+ else if (result != S_OK) {
+ char buffer[33];
+ snprintf(buffer, 33, "%d", (unsigned int)result);
+ throw Exception(string("Encoder error: ") + buffer);
+ }
+}
+
+void decode(NCompress::NLZMA::CDecoder *decoderSpec,
+ CMyComPtr<ISequentialInStream> inStream,
+ CMyComPtr<ISequentialOutStream> outStream)
+{
+ const UInt32 kPropertiesSize = 5;
+ Byte properties[kPropertiesSize];
+ UInt32 processedSize;
+ UInt64 fileSize = 0;
+
+ if (inStream->Read(properties, kPropertiesSize, &processedSize) != S_OK)
+ throw Exception("Read error");
+ if (processedSize != kPropertiesSize)
+ throw Exception("Read error");
+ if (decoderSpec->SetDecoderProperties2(properties, kPropertiesSize) != S_OK)
+ throw Exception("SetDecoderProperties() error");
+
+ for (int i = 0; i < 8; i++)
+ {
+ Byte b;
+
+ if (inStream->Read(&b, sizeof(b), &processedSize) != S_OK)
+ throw Exception("Read error");
+ if (processedSize != 1)
+ throw Exception("Read error");
+
+ fileSize |= ((UInt64)b) << (8 * i);
+ }
+
+ if (decoderSpec->Code(inStream, outStream, 0, &fileSize, 0) != S_OK)
+ throw Exception("Decoder error");
+}
+
+int open_instream(const string infile,
+ CMyComPtr<ISequentialInStream> &inStream,
+ UInt64 &fileSize)
+{
+ CInFileStream *inStreamSpec = new CInFileStream;
+ inStream = inStreamSpec;
+ if (!inStreamSpec->Open(infile.c_str()))
+ throw Exception("Cannot open input file " + infile);
+
+ inStreamSpec->File.GetLength(fileSize);
+
+ return inStreamSpec->File.GetHandle();
+}
+
+int open_outstream(const string outfile,
+ CMyComPtr<ISequentialOutStream> &outStream)
+{
+ COutFileStream *outStreamSpec = new COutFileStream;
+ outStream = outStreamSpec;
+
+ bool open_by_force = (program_mode == PM_TEST) | force;
+
+ if (!outStreamSpec->Create(outfile.c_str(), open_by_force))
+ throw Exception("Cannot open output file " + outfile);
+
+ return outStreamSpec->File.GetHandle();
+}
+
+double get_ratio(int inhandle, int outhandle)
+{
+ struct stat in_stats, out_stats;
+ fstat(inhandle, &in_stats);
+ fstat(outhandle, &out_stats);
+
+ return (double)out_stats.st_size / (double)in_stats.st_size;
+}
+
+mode_t get_file_mode(string filename)
+{
+ struct stat in_stat;
+ lstat(filename.c_str(), &in_stat);
+
+ return in_stat.st_mode;
+}
+
+bool string_ends_with(string str, string ending)
+{
+ return equal(ending.rbegin(), ending.rend(), str.rbegin());
+}
+
+bool extension_is_known(string filename)
+{
+ bool known_format = false;
+ extension_pair extension; int i = 1;
+
+ extension = known_extensions[0];
+ while (extension.from != NULL) {
+ if (string_ends_with(filename, extension.from)) {
+ known_format = true;
+ break;
+ }
+ extension = known_extensions[i];
+ i++;
+ }
+
+ if (!known_format) {
+ if (!string_ends_with(filename, suffix)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+string replace_extension(string filename)
+{
+ int suffix_starts_at = filename.length() - strlen (suffix);
+ string from_suffix = filename.substr(suffix_starts_at, strlen (suffix));
+ string ret = filename.substr(0, suffix_starts_at);
+ extension_pair extension; int i = 1;
+
+ bool found_replacement = false;
+ extension = known_extensions[0];
+ while (extension.from != NULL) {
+ if (from_suffix.compare(extension.from) == 0) {
+ ret += extension.to;
+ found_replacement = true;
+ break;
+ }
+
+ extension = known_extensions[i];
+ i++;
+ }
+
+ return ret;
+}
+
+string pretty_print_status(string filename, string output_filename,
+ string ratio)
+{
+ string ret = "";
+
+ ret += filename;
+ ret += ":\t ";
+
+ if (program_mode == PM_TEST) {
+ ret += "decoded succesfully";
+
+ return ret;
+ }
+
+ if (!stdinput && !stdoutput) {
+ ret += ratio;
+ ret += " -- ";
+ }
+
+ if (program_mode == PM_COMPRESS) {
+ if (keep) {
+ ret += "encoded succesfully";
+
+ return ret;
+ }
+
+ ret += "replaced with ";
+ ret += output_filename;
+
+ return ret;
+ }
+
+ if (program_mode == PM_DECOMPRESS) {
+ if (keep) {
+ ret += "decoded succesfully";
+
+ return ret;
+ }
+
+ ret += "replaced with ";
+ ret += output_filename;
+
+ return ret;
+ }
+
+ return ret;
+}
+
+static string archive_name; // I know, it is crude, but I haven't found any other
+ // way then making a global variable to transfer filename to handler
+
+void signal_handler (int signum)
+{
+ unlink (archive_name.c_str()); // deleting
+ signal (signum, SIG_DFL); // we return the default function to used signal
+ kill (getpid(), signum); // and then send this signal to the process again
+}
+
+} // namespace lzma
+
+
+int main(int argc, char **argv)
+{
+ using namespace lzma;
+ using std::cerr;
+
+ stringVector filenames;
+
+ signal (SIGTERM,signal_handler);
+ signal (SIGHUP,signal_handler);
+ signal (SIGINT,signal_handler);
+
+ try {
+ parse_options(argc, argv, filenames);
+ }
+ catch (...) {
+ return STATUS_ERROR;
+ }
+
+ if (program_mode == PM_HELP) {
+ print_help(argv[0]);
+ return STATUS_OK;
+ }
+ else if (program_mode == PM_LICENSE) {
+ print_license();
+ return STATUS_OK;
+ }
+ else if (program_mode == PM_VERSION) {
+ print_version();
+ return STATUS_OK;
+ }
+
+ if (filenames.empty()) {
+ stdinput = true;
+ stdoutput = true;
+
+ /* FIXME: get rid of this */
+ filenames.push_back("-");
+ }
+
+ /* Protection: always create new files with 0600 in order to prevent
+ * outsiders from reading incomplete data. */
+ umask(0077);
+
+ bool warning = false;
+
+ for (int i = 0; i < filenames.size(); i++) {
+ CMyComPtr<ISequentialInStream> inStream;
+ CMyComPtr<ISequentialOutStream> outStream;
+ UInt64 fileSize = 0;
+ int inhandle = 0, outhandle = 0;
+ string output_filename;
+
+ if (stdinput) {
+ inStream = new CStdInFileStream;
+ MY_SET_BINARY_MODE(stdin);
+ fileSize = (UInt64)(Int64)-1;
+
+ inhandle = STDIN_FILENO;
+
+ outStream = new CStdOutFileStream;
+ MY_SET_BINARY_MODE(stdout);
+
+ outhandle = STDOUT_FILENO;
+ }
+ else {
+ mode_t infile_mode = get_file_mode(filenames[i]);
+ if (!S_ISREG(infile_mode)) {
+ if (S_ISDIR(infile_mode)) {
+ warning = true;
+ cerr << argv[0] << ": " << filenames[i] << ": "
+ << "cowardly refusing to work on directory"
+ << endl;
+
+ continue;
+ }
+ else if (S_ISLNK(infile_mode)) {
+ if (!stdoutput && !force) {
+ warning = true;
+
+ cerr << argv[0] << ": " << filenames[i] << ": "
+ << "cowardly refusing to work on symbolic link "
+ << "(use --force to force encoding or decoding)"
+ << endl;
+
+ continue;
+ }
+ }
+ else {
+ warning = true;
+
+ cerr << argv[0] << ": " << filenames[i] << ": "
+ << "doesn't exist or is not a regular file"
+ << endl;
+
+ continue;
+ }
+ }
+
+ // Test if the file already ends with *suffix.
+ if (program_mode == PM_COMPRESS && !force
+ && string_ends_with(filenames[i],
+ suffix)) {
+ warning = true;
+
+ cerr << filenames[i] << " already has "
+ << suffix << " suffix -- unchanged\n";
+
+ continue;
+ }
+
+ // Test if the file extension is known.
+ if (program_mode == PM_DECOMPRESS
+ && !extension_is_known(filenames[i])) {
+ warning = true;
+
+ cerr << filenames[i] << ": "
+ << " unknown suffix -- unchanged"
+ << endl;
+
+ continue;
+ }
+
+ try {
+ inhandle = open_instream(filenames[i], inStream, fileSize);
+ }
+ catch (Exception e) {
+ cerr << argv[0] << ": " << e.what() << endl;
+ return STATUS_ERROR;
+ }
+
+ if (stdoutput) {
+ outStream = new CStdOutFileStream;
+ MY_SET_BINARY_MODE(stdout);
+
+ outhandle = STDOUT_FILENO;
+ }
+ else {
+ /* Testing mode is nothing else but decoding
+ * and throwing away the result. */
+ if (program_mode == PM_TEST)
+ output_filename = "/dev/null";
+ else if (program_mode == PM_DECOMPRESS)
+ output_filename = replace_extension(filenames[i]);
+ else
+ output_filename = filenames[i]
+ + suffix;
+ archive_name = output_filename;
+
+ try {
+ outhandle = open_outstream(output_filename, outStream);
+ }
+ catch (Exception e) {
+ cerr << argv[0] << ": " << e.what() << endl;
+ return STATUS_ERROR;
+ }
+ }
+
+ }
+
+ // Unless --force is specified, do not read/write compressed
+ // data from/to a terminal.
+ if (!force) {
+ if (program_mode == PM_COMPRESS && isatty(outhandle)) {
+ cerr << argv[0] << ": compressed data not "
+ "written to a terminal. Use "
+ "-f to force compression.\n"
+ << argv[0] << ": For help, type: "
+ << argv[0] << " -h\n";
+ return STATUS_ERROR;
+ } else if (program_mode == PM_DECOMPRESS
+ && isatty(inhandle)) {
+ cerr << argv[0] << ": compressed data not "
+ "read from a terminal. Use "
+ "-f to force decompression.\n"
+ << argv[0] << ": For help, type: "
+ << argv[0] << " -h\n";
+ return STATUS_ERROR;
+ }
+ }
+
+ if (program_mode == PM_COMPRESS) {
+ NCompress::NLZMA::CEncoder *encoderSpec =
+ new NCompress::NLZMA::CEncoder;
+
+ lzma_option options = option_mapping[compression_mode];
+
+ try {
+ encode(encoderSpec, inStream, outStream, options, fileSize);
+ }
+ catch (Exception e) {
+ cerr << argv[0] << ": " << e.what() << endl;
+ unlink(output_filename.c_str());
+ delete(encoderSpec);
+
+ return STATUS_ERROR;
+ }
+
+ delete(encoderSpec);
+ }
+ else { // PM_DECOMPRESS | PM_TEST
+ NCompress::NLZMA::CDecoder *decoderSpec =
+ new NCompress::NLZMA::CDecoder;
+
+ try {
+ decode(decoderSpec, inStream, outStream);
+ }
+ catch (Exception e) {
+ cerr << argv[0] << ": " << e.what() << endl;
+ unlink(output_filename.c_str());
+ delete(decoderSpec);
+
+ return STATUS_ERROR;
+ }
+
+ delete(decoderSpec);
+ }
+
+ /* Set permissions and owners. */
+ if ( (program_mode == PM_COMPRESS || program_mode == PM_DECOMPRESS )
+ && (!stdinput && !stdoutput) ) {
+
+ int ret = 0;
+ struct stat file_stats;
+ ret = fstat(inhandle, &file_stats);
+
+ ret = fchmod(outhandle, file_stats.st_mode);
+ ret = fchown(outhandle, file_stats.st_uid, file_stats.st_gid);
+ // We need to call fchmod() again, since otherwise the SUID bits
+ // are lost.
+ ret = fchmod(outhandle, file_stats.st_mode);
+
+ struct timeval file_times[2];
+ // Access time
+ file_times[0].tv_sec = file_stats.st_atime;
+ file_times[0].tv_usec = 0;
+ // Modification time
+ file_times[1].tv_sec = file_stats.st_mtime;
+ file_times[1].tv_usec = 0;
+
+ ret = futimes(outhandle, file_times);
+
+ if (!keep)
+ unlink(filenames[i].c_str());
+ }
+
+ if (verbosity > 0) {
+ if (stdoutput) {
+ cerr << filenames[i] << ":\t ";
+ cerr << "decoded succesfully"
+ << endl;
+ }
+
+ else {
+ char buf[10] = { 0 };
+
+ if (program_mode == PM_DECOMPRESS)
+ snprintf(buf, 10, "%.2f%%",
+ (1 - get_ratio(outhandle, inhandle)) * 100);
+ if (program_mode == PM_COMPRESS)
+ snprintf(buf, 10, "%.2f%%",
+ (1 - get_ratio(inhandle, outhandle)) * 100);
+
+ string ratio = buf;
+ cerr << pretty_print_status(filenames[i], output_filename,
+ ratio)
+ << endl;
+ }
+ }
+ }
+
+ if (warning)
+ return STATUS_WARNING;
+
+ return STATUS_OK;
+}
+