diff options
author | Karl Berry <karl@freefriends.org> | 2010-05-26 18:13:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-05-26 18:13:06 +0000 |
commit | 3d8da5c85f9bb90eb80ac3fa22edf45b448140fb (patch) | |
tree | ea7e7459cb562b1bec12164edbcf295647c0202b /Build/source/extra/xz-4.999.9beta/src/xz | |
parent | 102ace285218431079cbea4914f3faaad0c7383e (diff) |
new xz release
git-svn-id: svn://tug.org/texlive/trunk@18518 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/extra/xz-4.999.9beta/src/xz')
25 files changed, 0 insertions, 7357 deletions
diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/Makefile.am b/Build/source/extra/xz-4.999.9beta/src/xz/Makefile.am deleted file mode 100644 index ccdc66cab44..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/Makefile.am +++ /dev/null @@ -1,96 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -bin_PROGRAMS = xz - -xz_SOURCES = \ - args.c \ - args.h \ - coder.c \ - coder.h \ - file_io.c \ - file_io.h \ - hardware.c \ - hardware.h \ - main.c \ - main.h \ - message.c \ - message.h \ - options.c \ - options.h \ - private.h \ - signals.c \ - signals.h \ - suffix.c \ - suffix.h \ - util.c \ - util.h - -if COND_W32 -xz_SOURCES += xz_w32res.rc -endif - -xz_CPPFLAGS = \ - -DLOCALEDIR=\"$(localedir)\" \ - -I$(top_srcdir)/src/common \ - -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib \ - $(STATIC_CPPFLAGS) - -xz_LDFLAGS = $(STATIC_LDFLAGS) -xz_LDADD = $(top_builddir)/src/liblzma/liblzma.la - -if COND_GNULIB -xz_LDADD += $(top_builddir)/lib/libgnu.a -endif - -# libgnu.a may need these libs, so this must be after libgnu.a. -xz_LDADD += $(LTLIBINTL) - - -# Windows resource compiler support -.rc.o: - $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(xz_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) -i $< -o $@ - - -dist_man_MANS = xz.1 - - -## Create symlinks for unxz and xzcat for convenience. Create symlinks also -## for lzma, unlzma, and lzcat for compatibility with LZMA Utils 4.32.x. -xzlinks = unxz xzcat lzma unlzma lzcat - -install-exec-hook: - cd $(DESTDIR)$(bindir) && \ - target=`echo xz | sed '$(transform)'`$(EXEEXT) && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link && \ - $(LN_S) $$target $$link; \ - done - -install-data-hook: - cd $(DESTDIR)$(mandir)/man1 && \ - target=`echo xz | sed '$(transform)'` && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link.1 && \ - $(LN_S) $$target.1 $$link.1; \ - done - -uninstall-hook: - cd $(DESTDIR)$(bindir) && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link; \ - done - cd $(DESTDIR)$(mandir)/man1 && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link.1; \ - done diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/Makefile.in b/Build/source/extra/xz-4.999.9beta/src/xz/Makefile.in deleted file mode 100644 index cb127ade119..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/Makefile.in +++ /dev/null @@ -1,849 +0,0 @@ -# Makefile.in generated by automake 1.11 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@ -bin_PROGRAMS = xz$(EXEEXT) -@COND_W32_TRUE@am__append_1 = xz_w32res.rc -@COND_GNULIB_TRUE@am__append_2 = $(top_builddir)/lib/libgnu.a -subdir = src/xz -DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lc_cpucores.m4 \ - $(top_srcdir)/m4/lc_physmem.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(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)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posix-shell.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/visibility.m4 \ - $(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 = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" -PROGRAMS = $(bin_PROGRAMS) -am__xz_SOURCES_DIST = args.c args.h coder.c coder.h file_io.c \ - file_io.h hardware.c hardware.h main.c main.h message.c \ - message.h options.c options.h private.h signals.c signals.h \ - suffix.c suffix.h util.c util.h xz_w32res.rc -@COND_W32_TRUE@am__objects_1 = xz_w32res.$(OBJEXT) -am_xz_OBJECTS = xz-args.$(OBJEXT) xz-coder.$(OBJEXT) \ - xz-file_io.$(OBJEXT) xz-hardware.$(OBJEXT) xz-main.$(OBJEXT) \ - xz-message.$(OBJEXT) xz-options.$(OBJEXT) xz-signals.$(OBJEXT) \ - xz-suffix.$(OBJEXT) xz-util.$(OBJEXT) $(am__objects_1) -xz_OBJECTS = $(am_xz_OBJECTS) -am__DEPENDENCIES_1 = -xz_DEPENDENCIES = $(top_builddir)/src/liblzma/liblzma.la \ - $(am__append_2) $(am__DEPENDENCIES_1) -xz_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(xz_LDFLAGS) \ - $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/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 = $(xz_SOURCES) -DIST_SOURCES = $(am__xz_SOURCES_DIST) -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -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@ -AM_CFLAGS = @AM_CFLAGS@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNAMIC_CPPFLAGS = @DYNAMIC_CPPFLAGS@ -DYNAMIC_LDFLAGS = @DYNAMIC_LDFLAGS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETOPT_H = @GETOPT_H@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GREP = @GREP@ -HAVE_VISIBILITY = @HAVE_VISIBILITY@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_HOMEPAGE = @PACKAGE_HOMEPAGE@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSIX_SHELL = @POSIX_SHELL@ -POSUB = @POSUB@ -PREFERABLY_POSIX_SHELL = @PREFERABLY_POSIX_SHELL@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -RC = @RC@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATIC_CPPFLAGS = @STATIC_CPPFLAGS@ -STATIC_LDFLAGS = @STATIC_LDFLAGS@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -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@ -acx_pthread_config = @acx_pthread_config@ -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@ -xz = @xz@ -xz_SOURCES = args.c args.h coder.c coder.h file_io.c file_io.h \ - hardware.c hardware.h main.c main.h message.c message.h \ - options.c options.h private.h signals.c signals.h suffix.c \ - suffix.h util.c util.h $(am__append_1) -xz_CPPFLAGS = \ - -DLOCALEDIR=\"$(localedir)\" \ - -I$(top_srcdir)/src/common \ - -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib \ - $(STATIC_CPPFLAGS) - -xz_LDFLAGS = $(STATIC_LDFLAGS) - -# libgnu.a may need these libs, so this must be after libgnu.a. -xz_LDADD = $(top_builddir)/src/liblzma/liblzma.la $(am__append_2) \ - $(LTLIBINTL) -dist_man_MANS = xz.1 -xzlinks = unxz xzcat lzma unlzma lzcat -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj .rc -$(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 src/xz/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/xz/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): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_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 -xz$(EXEEXT): $(xz_OBJECTS) $(xz_DEPENDENCIES) - @rm -f xz$(EXEEXT) - $(xz_LINK) $(xz_OBJECTS) $(xz_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-args.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-coder.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-file_io.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-hardware.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-message.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-options.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-signals.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-suffix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xz-util.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 $@ $< - -xz-args.o: args.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-args.o -MD -MP -MF $(DEPDIR)/xz-args.Tpo -c -o xz-args.o `test -f 'args.c' || echo '$(srcdir)/'`args.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-args.Tpo $(DEPDIR)/xz-args.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='args.c' object='xz-args.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-args.o `test -f 'args.c' || echo '$(srcdir)/'`args.c - -xz-args.obj: args.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-args.obj -MD -MP -MF $(DEPDIR)/xz-args.Tpo -c -o xz-args.obj `if test -f 'args.c'; then $(CYGPATH_W) 'args.c'; else $(CYGPATH_W) '$(srcdir)/args.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-args.Tpo $(DEPDIR)/xz-args.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='args.c' object='xz-args.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-args.obj `if test -f 'args.c'; then $(CYGPATH_W) 'args.c'; else $(CYGPATH_W) '$(srcdir)/args.c'; fi` - -xz-coder.o: coder.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-coder.o -MD -MP -MF $(DEPDIR)/xz-coder.Tpo -c -o xz-coder.o `test -f 'coder.c' || echo '$(srcdir)/'`coder.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-coder.Tpo $(DEPDIR)/xz-coder.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='coder.c' object='xz-coder.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-coder.o `test -f 'coder.c' || echo '$(srcdir)/'`coder.c - -xz-coder.obj: coder.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-coder.obj -MD -MP -MF $(DEPDIR)/xz-coder.Tpo -c -o xz-coder.obj `if test -f 'coder.c'; then $(CYGPATH_W) 'coder.c'; else $(CYGPATH_W) '$(srcdir)/coder.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-coder.Tpo $(DEPDIR)/xz-coder.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='coder.c' object='xz-coder.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-coder.obj `if test -f 'coder.c'; then $(CYGPATH_W) 'coder.c'; else $(CYGPATH_W) '$(srcdir)/coder.c'; fi` - -xz-file_io.o: file_io.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-file_io.o -MD -MP -MF $(DEPDIR)/xz-file_io.Tpo -c -o xz-file_io.o `test -f 'file_io.c' || echo '$(srcdir)/'`file_io.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-file_io.Tpo $(DEPDIR)/xz-file_io.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_io.c' object='xz-file_io.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-file_io.o `test -f 'file_io.c' || echo '$(srcdir)/'`file_io.c - -xz-file_io.obj: file_io.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-file_io.obj -MD -MP -MF $(DEPDIR)/xz-file_io.Tpo -c -o xz-file_io.obj `if test -f 'file_io.c'; then $(CYGPATH_W) 'file_io.c'; else $(CYGPATH_W) '$(srcdir)/file_io.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-file_io.Tpo $(DEPDIR)/xz-file_io.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_io.c' object='xz-file_io.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-file_io.obj `if test -f 'file_io.c'; then $(CYGPATH_W) 'file_io.c'; else $(CYGPATH_W) '$(srcdir)/file_io.c'; fi` - -xz-hardware.o: hardware.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-hardware.o -MD -MP -MF $(DEPDIR)/xz-hardware.Tpo -c -o xz-hardware.o `test -f 'hardware.c' || echo '$(srcdir)/'`hardware.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-hardware.Tpo $(DEPDIR)/xz-hardware.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hardware.c' object='xz-hardware.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-hardware.o `test -f 'hardware.c' || echo '$(srcdir)/'`hardware.c - -xz-hardware.obj: hardware.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-hardware.obj -MD -MP -MF $(DEPDIR)/xz-hardware.Tpo -c -o xz-hardware.obj `if test -f 'hardware.c'; then $(CYGPATH_W) 'hardware.c'; else $(CYGPATH_W) '$(srcdir)/hardware.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-hardware.Tpo $(DEPDIR)/xz-hardware.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hardware.c' object='xz-hardware.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-hardware.obj `if test -f 'hardware.c'; then $(CYGPATH_W) 'hardware.c'; else $(CYGPATH_W) '$(srcdir)/hardware.c'; fi` - -xz-main.o: main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-main.o -MD -MP -MF $(DEPDIR)/xz-main.Tpo -c -o xz-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-main.Tpo $(DEPDIR)/xz-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='xz-main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c - -xz-main.obj: main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-main.obj -MD -MP -MF $(DEPDIR)/xz-main.Tpo -c -o xz-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-main.Tpo $(DEPDIR)/xz-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='xz-main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` - -xz-message.o: message.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-message.o -MD -MP -MF $(DEPDIR)/xz-message.Tpo -c -o xz-message.o `test -f 'message.c' || echo '$(srcdir)/'`message.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-message.Tpo $(DEPDIR)/xz-message.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='message.c' object='xz-message.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-message.o `test -f 'message.c' || echo '$(srcdir)/'`message.c - -xz-message.obj: message.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-message.obj -MD -MP -MF $(DEPDIR)/xz-message.Tpo -c -o xz-message.obj `if test -f 'message.c'; then $(CYGPATH_W) 'message.c'; else $(CYGPATH_W) '$(srcdir)/message.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-message.Tpo $(DEPDIR)/xz-message.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='message.c' object='xz-message.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-message.obj `if test -f 'message.c'; then $(CYGPATH_W) 'message.c'; else $(CYGPATH_W) '$(srcdir)/message.c'; fi` - -xz-options.o: options.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-options.o -MD -MP -MF $(DEPDIR)/xz-options.Tpo -c -o xz-options.o `test -f 'options.c' || echo '$(srcdir)/'`options.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-options.Tpo $(DEPDIR)/xz-options.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='options.c' object='xz-options.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-options.o `test -f 'options.c' || echo '$(srcdir)/'`options.c - -xz-options.obj: options.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-options.obj -MD -MP -MF $(DEPDIR)/xz-options.Tpo -c -o xz-options.obj `if test -f 'options.c'; then $(CYGPATH_W) 'options.c'; else $(CYGPATH_W) '$(srcdir)/options.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-options.Tpo $(DEPDIR)/xz-options.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='options.c' object='xz-options.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-options.obj `if test -f 'options.c'; then $(CYGPATH_W) 'options.c'; else $(CYGPATH_W) '$(srcdir)/options.c'; fi` - -xz-signals.o: signals.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-signals.o -MD -MP -MF $(DEPDIR)/xz-signals.Tpo -c -o xz-signals.o `test -f 'signals.c' || echo '$(srcdir)/'`signals.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-signals.Tpo $(DEPDIR)/xz-signals.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='signals.c' object='xz-signals.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-signals.o `test -f 'signals.c' || echo '$(srcdir)/'`signals.c - -xz-signals.obj: signals.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-signals.obj -MD -MP -MF $(DEPDIR)/xz-signals.Tpo -c -o xz-signals.obj `if test -f 'signals.c'; then $(CYGPATH_W) 'signals.c'; else $(CYGPATH_W) '$(srcdir)/signals.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-signals.Tpo $(DEPDIR)/xz-signals.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='signals.c' object='xz-signals.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-signals.obj `if test -f 'signals.c'; then $(CYGPATH_W) 'signals.c'; else $(CYGPATH_W) '$(srcdir)/signals.c'; fi` - -xz-suffix.o: suffix.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-suffix.o -MD -MP -MF $(DEPDIR)/xz-suffix.Tpo -c -o xz-suffix.o `test -f 'suffix.c' || echo '$(srcdir)/'`suffix.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-suffix.Tpo $(DEPDIR)/xz-suffix.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='suffix.c' object='xz-suffix.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-suffix.o `test -f 'suffix.c' || echo '$(srcdir)/'`suffix.c - -xz-suffix.obj: suffix.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-suffix.obj -MD -MP -MF $(DEPDIR)/xz-suffix.Tpo -c -o xz-suffix.obj `if test -f 'suffix.c'; then $(CYGPATH_W) 'suffix.c'; else $(CYGPATH_W) '$(srcdir)/suffix.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-suffix.Tpo $(DEPDIR)/xz-suffix.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='suffix.c' object='xz-suffix.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-suffix.obj `if test -f 'suffix.c'; then $(CYGPATH_W) 'suffix.c'; else $(CYGPATH_W) '$(srcdir)/suffix.c'; fi` - -xz-util.o: util.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-util.o -MD -MP -MF $(DEPDIR)/xz-util.Tpo -c -o xz-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-util.Tpo $(DEPDIR)/xz-util.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='xz-util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c - -xz-util.obj: util.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xz-util.obj -MD -MP -MF $(DEPDIR)/xz-util.Tpo -c -o xz-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xz-util.Tpo $(DEPDIR)/xz-util.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='xz-util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xz-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-man1: $(dist_man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list=''; test -n "$(man1dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } - -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } - -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 - -distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi - @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 -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) - -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-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 - -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-dvi-am: - -install-exec-am: install-binPROGRAMS - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-exec-hook -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: install-man1 - -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: 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 - - -# Windows resource compiler support -.rc.o: - $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(xz_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) -i $< -o $@ - -install-exec-hook: - cd $(DESTDIR)$(bindir) && \ - target=`echo xz | sed '$(transform)'`$(EXEEXT) && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link && \ - $(LN_S) $$target $$link; \ - done - -install-data-hook: - cd $(DESTDIR)$(mandir)/man1 && \ - target=`echo xz | sed '$(transform)'` && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link.1 && \ - $(LN_S) $$target.1 $$link.1; \ - done - -uninstall-hook: - cd $(DESTDIR)$(bindir) && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link; \ - done - cd $(DESTDIR)$(mandir)/man1 && \ - for name in $(xzlinks); do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link.1; \ - done - -# 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/extra/xz-4.999.9beta/src/xz/args.c b/Build/source/extra/xz-4.999.9beta/src/xz/args.c deleted file mode 100644 index b50e28b7fd9..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/args.c +++ /dev/null @@ -1,530 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file args.c -/// \brief Argument parsing -/// -/// \note Filter-specific options parsing is in options.c. -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - -#include "getopt.h" -#include <ctype.h> - - -bool opt_stdout = false; -bool opt_force = false; -bool opt_keep_original = false; - -// We don't modify or free() this, but we need to assign it in some -// non-const pointers. -const char *stdin_filename = "(stdin)"; - - -static void -parse_real(args_info *args, int argc, char **argv) -{ - enum { - OPT_SUBBLOCK = INT_MIN, - OPT_X86, - OPT_POWERPC, - OPT_IA64, - OPT_ARM, - OPT_ARMTHUMB, - OPT_SPARC, - OPT_DELTA, - OPT_LZMA1, - OPT_LZMA2, - - OPT_FILES, - OPT_FILES0, - }; - - static const char short_opts[] - = "cC:defF:hHlkM:qQrS:tT:vVz0123456789"; - - static const struct option long_opts[] = { - // Operation mode - { "compress", no_argument, NULL, 'z' }, - { "decompress", no_argument, NULL, 'd' }, - { "uncompress", no_argument, NULL, 'd' }, - { "test", no_argument, NULL, 't' }, - { "list", no_argument, NULL, 'l' }, - - // Operation modifiers - { "keep", no_argument, NULL, 'k' }, - { "force", no_argument, NULL, 'f' }, - { "stdout", no_argument, NULL, 'c' }, - { "to-stdout", no_argument, NULL, 'c' }, - { "suffix", required_argument, NULL, 'S' }, - // { "recursive", no_argument, NULL, 'r' }, // TODO - { "files", optional_argument, NULL, OPT_FILES }, - { "files0", optional_argument, NULL, OPT_FILES0 }, - - // Basic compression settings - { "format", required_argument, NULL, 'F' }, - { "check", required_argument, NULL, 'C' }, - { "memory", required_argument, NULL, 'M' }, - { "threads", required_argument, NULL, 'T' }, - - { "extreme", no_argument, NULL, 'e' }, - { "fast", no_argument, NULL, '0' }, - { "best", no_argument, NULL, '9' }, - - // Filters - { "lzma1", optional_argument, NULL, OPT_LZMA1 }, - { "lzma2", optional_argument, NULL, OPT_LZMA2 }, - { "x86", optional_argument, NULL, OPT_X86 }, - { "powerpc", optional_argument, NULL, OPT_POWERPC }, - { "ia64", optional_argument, NULL, OPT_IA64 }, - { "arm", optional_argument, NULL, OPT_ARM }, - { "armthumb", optional_argument, NULL, OPT_ARMTHUMB }, - { "sparc", optional_argument, NULL, OPT_SPARC }, - { "delta", optional_argument, NULL, OPT_DELTA }, - { "subblock", optional_argument, NULL, OPT_SUBBLOCK }, - - // Other options - { "quiet", no_argument, NULL, 'q' }, - { "verbose", no_argument, NULL, 'v' }, - { "no-warn", no_argument, NULL, 'Q' }, - { "help", no_argument, NULL, 'h' }, - { "long-help", no_argument, NULL, 'H' }, - { "version", no_argument, NULL, 'V' }, - - { NULL, 0, NULL, 0 } - }; - - int c; - - while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) - != -1) { - switch (c) { - // Compression preset (also for decompression if --format=raw) - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - coder_set_preset(c - '0'); - break; - - // --memory - case 'M': { - // Support specifying the limit as a percentage of - // installed physical RAM. - size_t len = strlen(optarg); - if (len > 0 && optarg[len - 1] == '%') { - optarg[len - 1] = '\0'; - hardware_memlimit_set_percentage( - str_to_uint64( - "memory%", optarg, 1, 100)); - } else { - // On 32-bit systems, SIZE_MAX would make more - // sense than UINT64_MAX. But use UINT64_MAX - // still so that scripts that assume > 4 GiB - // values don't break. - hardware_memlimit_set(str_to_uint64( - "memory", optarg, - 0, UINT64_MAX)); - } - - break; - } - - // --suffix - case 'S': - suffix_set(optarg); - break; - - case 'T': - hardware_threadlimit_set(str_to_uint64( - "threads", optarg, 0, UINT32_MAX)); - break; - - // --version - case 'V': - // This doesn't return. - message_version(); - - // --stdout - case 'c': - opt_stdout = true; - break; - - // --decompress - case 'd': - opt_mode = MODE_DECOMPRESS; - break; - - // --extreme - case 'e': - coder_set_extreme(); - break; - - // --force - case 'f': - opt_force = true; - break; - - // --help - case 'h': - // This doesn't return. - message_help(false); - - // --long-help - case 'H': - // This doesn't return. - message_help(true); - - // --list - case 'l': - opt_mode = MODE_LIST; - break; - - // --keep - case 'k': - opt_keep_original = true; - break; - - // --quiet - case 'q': - message_verbosity_decrease(); - break; - - case 'Q': - set_exit_no_warn(); - break; - - case 't': - opt_mode = MODE_TEST; - break; - - // --verbose - case 'v': - message_verbosity_increase(); - break; - - case 'z': - opt_mode = MODE_COMPRESS; - break; - - // Filter setup - - case OPT_SUBBLOCK: - coder_add_filter(LZMA_FILTER_SUBBLOCK, - options_subblock(optarg)); - break; - - case OPT_X86: - coder_add_filter(LZMA_FILTER_X86, - options_bcj(optarg)); - break; - - case OPT_POWERPC: - coder_add_filter(LZMA_FILTER_POWERPC, - options_bcj(optarg)); - break; - - case OPT_IA64: - coder_add_filter(LZMA_FILTER_IA64, - options_bcj(optarg)); - break; - - case OPT_ARM: - coder_add_filter(LZMA_FILTER_ARM, - options_bcj(optarg)); - break; - - case OPT_ARMTHUMB: - coder_add_filter(LZMA_FILTER_ARMTHUMB, - options_bcj(optarg)); - break; - - case OPT_SPARC: - coder_add_filter(LZMA_FILTER_SPARC, - options_bcj(optarg)); - break; - - case OPT_DELTA: - coder_add_filter(LZMA_FILTER_DELTA, - options_delta(optarg)); - break; - - case OPT_LZMA1: - coder_add_filter(LZMA_FILTER_LZMA1, - options_lzma(optarg)); - break; - - case OPT_LZMA2: - coder_add_filter(LZMA_FILTER_LZMA2, - options_lzma(optarg)); - break; - - // Other - - // --format - case 'F': { - // Just in case, support both "lzma" and "alone" since - // the latter was used for forward compatibility in - // LZMA Utils 4.32.x. - static const struct { - char str[8]; - enum format_type format; - } types[] = { - { "auto", FORMAT_AUTO }, - { "xz", FORMAT_XZ }, - { "lzma", FORMAT_LZMA }, - { "alone", FORMAT_LZMA }, - // { "gzip", FORMAT_GZIP }, - // { "gz", FORMAT_GZIP }, - { "raw", FORMAT_RAW }, - }; - - size_t i = 0; - while (strcmp(types[i].str, optarg) != 0) - if (++i == ARRAY_SIZE(types)) - message_fatal(_("%s: Unknown file " - "format type"), - optarg); - - opt_format = types[i].format; - break; - } - - // --check - case 'C': { - static const struct { - char str[8]; - lzma_check check; - } types[] = { - { "none", LZMA_CHECK_NONE }, - { "crc32", LZMA_CHECK_CRC32 }, - { "crc64", LZMA_CHECK_CRC64 }, - { "sha256", LZMA_CHECK_SHA256 }, - }; - - size_t i = 0; - while (strcmp(types[i].str, optarg) != 0) { - if (++i == ARRAY_SIZE(types)) - message_fatal(_("%s: Unsupported " - "integrity " - "check type"), optarg); - } - - // Use a separate check in case we are using different - // liblzma than what was used to compile us. - if (!lzma_check_is_supported(types[i].check)) - message_fatal(_("%s: Unsupported integrity " - "check type"), optarg); - - coder_set_check(types[i].check); - break; - } - - case OPT_FILES: - args->files_delim = '\n'; - - // Fall through - - case OPT_FILES0: - if (args->files_name != NULL) - message_fatal(_("Only one file can be " - "specified with `--files'" - "or `--files0'.")); - - if (optarg == NULL) { - args->files_name = (char *)stdin_filename; - args->files_file = stdin; - } else { - args->files_name = optarg; - args->files_file = fopen(optarg, - c == OPT_FILES ? "r" : "rb"); - if (args->files_file == NULL) - message_fatal("%s: %s", optarg, - strerror(errno)); - } - - break; - - default: - message_try_help(); - my_exit(E_ERROR); - } - } - - return; -} - - -static void -parse_environment(args_info *args, char *argv0) -{ - char *env = getenv("XZ_OPT"); - if (env == NULL) - return; - - // We modify the string, so make a copy of it. - env = xstrdup(env); - - // Calculate the number of arguments in env. argc stats at one - // to include space for the program name. - int argc = 1; - bool prev_was_space = true; - for (size_t i = 0; env[i] != '\0'; ++i) { - // NOTE: Cast to unsigned char is needed so that correct - // value gets passed to isspace(), which expects - // unsigned char cast to int. Casting to int is done - // automatically due to integer promotion, but we need to - // force char to unsigned char manually. Otherwise 8-bit - // characters would get promoted to wrong value if - // char is signed. - if (isspace((unsigned char)env[i])) { - prev_was_space = true; - } else if (prev_was_space) { - prev_was_space = false; - - // Keep argc small enough to fit into a singed int - // and to keep it usable for memory allocation. - if (++argc == MIN(INT_MAX, SIZE_MAX / sizeof(char *))) - message_fatal(_("The environment variable " - "XZ_OPT contains too many " - "arguments")); - } - } - - // Allocate memory to hold pointers to the arguments. Add one to get - // space for the terminating NULL (if some systems happen to need it). - char **argv = xmalloc(((size_t)(argc) + 1) * sizeof(char *)); - argv[0] = argv0; - argv[argc] = NULL; - - // Go through the string again. Split the arguments using '\0' - // characters and add pointers to the resulting strings to argv. - argc = 1; - prev_was_space = true; - for (size_t i = 0; env[i] != '\0'; ++i) { - if (isspace((unsigned char)env[i])) { - prev_was_space = true; - env[i] = '\0'; - } else if (prev_was_space) { - prev_was_space = false; - argv[argc++] = env + i; - } - } - - // Parse the argument list we got from the environment. All non-option - // arguments i.e. filenames are ignored. - parse_real(args, argc, argv); - - // Reset the state of the getopt_long() so that we can parse the - // command line options too. There are two incompatible ways to - // do it. -#ifdef HAVE_OPTRESET - // BSD - optind = 1; - optreset = 1; -#else - // GNU, Solaris - optind = 0; -#endif - - // We don't need the argument list from environment anymore. - free(argv); - free(env); - - return; -} - - -extern void -args_parse(args_info *args, int argc, char **argv) -{ - // Initialize those parts of *args that we need later. - args->files_name = NULL; - args->files_file = NULL; - args->files_delim = '\0'; - - // Check how we were called. - { -#ifdef DOSLIKE - // We adjusted argv[0] in the beginning of main() so we don't - // need to do anything here. - const char *name = argv[0]; -#else - // Remove the leading path name, if any. - const char *name = strrchr(argv[0], '/'); - if (name == NULL) - name = argv[0]; - else - ++name; -#endif - - // NOTE: It's possible that name[0] is now '\0' if argv[0] - // is weird, but it doesn't matter here. - - // Look for full command names instead of substrings like - // "un", "cat", and "lz" to reduce possibility of false - // positives when the programs have been renamed. - if (strstr(name, "xzcat") != NULL) { - opt_mode = MODE_DECOMPRESS; - opt_stdout = true; - } else if (strstr(name, "unxz") != NULL) { - opt_mode = MODE_DECOMPRESS; - } else if (strstr(name, "lzcat") != NULL) { - opt_format = FORMAT_LZMA; - opt_mode = MODE_DECOMPRESS; - opt_stdout = true; - } else if (strstr(name, "unlzma") != NULL) { - opt_format = FORMAT_LZMA; - opt_mode = MODE_DECOMPRESS; - } else if (strstr(name, "lzma") != NULL) { - opt_format = FORMAT_LZMA; - } - } - - // First the flags from environment - parse_environment(args, argv[0]); - - // Then from the command line - parse_real(args, argc, argv); - - // Never remove the source file when the destination is not on disk. - // In test mode the data is written nowhere, but setting opt_stdout - // will make the rest of the code behave well. - if (opt_stdout || opt_mode == MODE_TEST) { - opt_keep_original = true; - opt_stdout = true; - } - - // When compressing, if no --format flag was used, or it - // was --format=auto, we compress to the .xz format. - if (opt_mode == MODE_COMPRESS && opt_format == FORMAT_AUTO) - opt_format = FORMAT_XZ; - - // Compression settings need to be validated (options themselves and - // their memory usage) when compressing to any file format. It has to - // be done also when uncompressing raw data, since for raw decoding - // the options given on the command line are used to know what kind - // of raw data we are supposed to decode. - if (opt_mode == MODE_COMPRESS || opt_format == FORMAT_RAW) - coder_set_compression_settings(); - - // If no filenames are given, use stdin. - if (argv[optind] == NULL && args->files_name == NULL) { - // We don't modify or free() the "-" constant. The caller - // modifies this so don't make the struct itself const. - static char *names_stdin[2] = { (char *)"-", NULL }; - args->arg_names = names_stdin; - args->arg_count = 1; - } else { - // We got at least one filename from the command line, or - // --files or --files0 was specified. - args->arg_names = argv + optind; - args->arg_count = argc - optind; - } - - return; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/args.h b/Build/source/extra/xz-4.999.9beta/src/xz/args.h deleted file mode 100644 index 91e43ad65a1..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/args.h +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file args.h -/// \brief Argument parsing -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct { - /// Filenames from command line - char **arg_names; - - /// Number of filenames from command line - size_t arg_count; - - /// Name of the file from which to read filenames. This is NULL - /// if --files or --files0 was not used. - char *files_name; - - /// File opened for reading from which filenames are read. This is - /// non-NULL only if files_name is non-NULL. - FILE *files_file; - - /// Delimiter for filenames read from files_file - char files_delim; - -} args_info; - - -extern bool opt_stdout; -extern bool opt_force; -extern bool opt_keep_original; -// extern bool opt_recursive; - -extern const char *stdin_filename; - -extern void args_parse(args_info *args, int argc, char **argv); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/coder.c b/Build/source/extra/xz-4.999.9beta/src/xz/coder.c deleted file mode 100644 index 7cf6186f806..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/coder.c +++ /dev/null @@ -1,639 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file coder.c -/// \brief Compresses or uncompresses a file -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - - -/// Return value type for coder_init(). -enum coder_init_ret { - CODER_INIT_NORMAL, - CODER_INIT_PASSTHRU, - CODER_INIT_ERROR, -}; - - -enum operation_mode opt_mode = MODE_COMPRESS; - -enum format_type opt_format = FORMAT_AUTO; - - -/// Stream used to communicate with liblzma -static lzma_stream strm = LZMA_STREAM_INIT; - -/// Filters needed for all encoding all formats, and also decoding in raw data -static lzma_filter filters[LZMA_FILTERS_MAX + 1]; - -/// Input and output buffers -static uint8_t in_buf[IO_BUFFER_SIZE]; -static uint8_t out_buf[IO_BUFFER_SIZE]; - -/// Number of filters. Zero indicates that we are using a preset. -static size_t filters_count = 0; - -/// Number of the preset (0-9) -static size_t preset_number = 6; - -/// True if we should auto-adjust the compression settings to use less memory -/// if memory usage limit is too low for the original settings. -static bool auto_adjust = true; - -/// Indicate if no preset has been explicitly given. In that case, if we need -/// to auto-adjust for lower memory usage, we won't print a warning. -static bool preset_default = true; - -/// If a preset is used (no custom filter chain) and preset_extreme is true, -/// a significantly slower compression is used to achieve slightly better -/// compression ratio. -static bool preset_extreme = false; - -/// Integrity check type -#ifdef HAVE_CHECK_CRC64 -static lzma_check check = LZMA_CHECK_CRC64; -#else -static lzma_check check = LZMA_CHECK_CRC32; -#endif - - -extern void -coder_set_check(lzma_check new_check) -{ - check = new_check; - return; -} - - -extern void -coder_set_preset(size_t new_preset) -{ - preset_number = new_preset; - preset_default = false; - return; -} - - -extern void -coder_set_extreme(void) -{ - preset_extreme = true; - return; -} - - -extern void -coder_add_filter(lzma_vli id, void *options) -{ - if (filters_count == LZMA_FILTERS_MAX) - message_fatal(_("Maximum number of filters is four")); - - filters[filters_count].id = id; - filters[filters_count].options = options; - ++filters_count; - - return; -} - - -static void lzma_attribute((noreturn)) -memlimit_too_small(uint64_t memory_usage, uint64_t memory_limit) -{ - message_fatal(_("Memory usage limit (%" PRIu64 " MiB) is too small " - "for the given filter setup (%" PRIu64 " MiB)"), - memory_limit >> 20, memory_usage >> 20); -} - - -extern void -coder_set_compression_settings(void) -{ - // Options for LZMA1 or LZMA2 in case we are using a preset. - static lzma_options_lzma opt_lzma; - - if (filters_count == 0) { - // We are using a preset. This is not a good idea in raw mode - // except when playing around with things. Different versions - // of this software may use different options in presets, and - // thus make uncompressing the raw data difficult. - if (opt_format == FORMAT_RAW) { - // The message is shown only if warnings are allowed - // but the exit status isn't changed. - message(V_WARNING, _("Using a preset in raw mode " - "is discouraged.")); - message(V_WARNING, _("The exact options of the " - "presets may vary between software " - "versions.")); - } - - // Get the preset for LZMA1 or LZMA2. - if (preset_extreme) - preset_number |= LZMA_PRESET_EXTREME; - - if (lzma_lzma_preset(&opt_lzma, preset_number)) - message_bug(); - - // Use LZMA2 except with --format=lzma we use LZMA1. - filters[0].id = opt_format == FORMAT_LZMA - ? LZMA_FILTER_LZMA1 : LZMA_FILTER_LZMA2; - filters[0].options = &opt_lzma; - filters_count = 1; - } else { - preset_default = false; - } - - // Terminate the filter options array. - filters[filters_count].id = LZMA_VLI_UNKNOWN; - - // If we are using the .lzma format, allow exactly one filter - // which has to be LZMA1. - if (opt_format == FORMAT_LZMA && (filters_count != 1 - || filters[0].id != LZMA_FILTER_LZMA1)) - message_fatal(_("The .lzma format supports only " - "the LZMA1 filter")); - - // If we are using the .xz format, make sure that there is no LZMA1 - // filter to prevent LZMA_PROG_ERROR. - if (opt_format == FORMAT_XZ) - for (size_t i = 0; i < filters_count; ++i) - if (filters[i].id == LZMA_FILTER_LZMA1) - message_fatal(_("LZMA1 cannot be used " - "with the .xz format")); - - // Print the selected filter chain. - message_filters(V_DEBUG, filters); - - // If using --format=raw, we can be decoding. The memusage function - // also validates the filter chain and the options used for the - // filters. - const uint64_t memory_limit = hardware_memlimit_get(); - uint64_t memory_usage; - if (opt_mode == MODE_COMPRESS) - memory_usage = lzma_raw_encoder_memusage(filters); - else - memory_usage = lzma_raw_decoder_memusage(filters); - - if (memory_usage == UINT64_MAX) - message_fatal("Unsupported filter chain or filter options"); - - // Print memory usage info. - message(V_DEBUG, _("%s MiB (%s B) of memory is required per thread, " - "limit is %s MiB (%s B)"), - uint64_to_str(memory_usage >> 20, 0), - uint64_to_str(memory_usage, 1), - uint64_to_str(memory_limit >> 20, 2), - uint64_to_str(memory_limit, 3)); - - if (memory_usage > memory_limit) { - // If --no-auto-adjust was used or we didn't find LZMA1 or - // LZMA2 as the last filter, give an error immediatelly. - // --format=raw implies --no-auto-adjust. - if (!auto_adjust || opt_format == FORMAT_RAW) - memlimit_too_small(memory_usage, memory_limit); - - assert(opt_mode == MODE_COMPRESS); - - // Look for the last filter if it is LZMA2 or LZMA1, so - // we can make it use less RAM. With other filters we don't - // know what to do. - size_t i = 0; - while (filters[i].id != LZMA_FILTER_LZMA2 - && filters[i].id != LZMA_FILTER_LZMA1) { - if (filters[i].id == LZMA_VLI_UNKNOWN) - memlimit_too_small(memory_usage, memory_limit); - - ++i; - } - - // Decrease the dictionary size until we meet the memory - // usage limit. First round down to full mebibytes. - lzma_options_lzma *opt = filters[i].options; - const uint32_t orig_dict_size = opt->dict_size; - opt->dict_size &= ~((UINT32_C(1) << 20) - 1); - while (true) { - // If it is below 1 MiB, auto-adjusting failed. We - // could be more sophisticated and scale it down even - // more, but let's see if many complain about this - // version. - // - // FIXME: Displays the scaled memory usage instead - // of the original. - if (opt->dict_size < (UINT32_C(1) << 20)) - memlimit_too_small(memory_usage, memory_limit); - - memory_usage = lzma_raw_encoder_memusage(filters); - if (memory_usage == UINT64_MAX) - message_bug(); - - // Accept it if it is low enough. - if (memory_usage <= memory_limit) - break; - - // Otherwise 1 MiB down and try again. I hope this - // isn't too slow method for cases where the original - // dict_size is very big. - opt->dict_size -= UINT32_C(1) << 20; - } - - // Tell the user that we decreased the dictionary size. - // However, omit the message if no preset or custom chain - // was given. FIXME: Always warn? - if (!preset_default) - message(V_WARNING, "Adjusted LZMA%c dictionary size " - "from %s MiB to %s MiB to not exceed " - "the memory usage limit of %s MiB", - filters[i].id == LZMA_FILTER_LZMA2 - ? '2' : '1', - uint64_to_str(orig_dict_size >> 20, 0), - uint64_to_str(opt->dict_size >> 20, 1), - uint64_to_str(memory_limit >> 20, 2)); - } - -/* - // Limit the number of worker threads so that memory usage - // limit isn't exceeded. - assert(memory_usage > 0); - size_t thread_limit = memory_limit / memory_usage; - if (thread_limit == 0) - thread_limit = 1; - - if (opt_threads > thread_limit) - opt_threads = thread_limit; -*/ - - return; -} - - -/// Return true if the data in in_buf seems to be in the .xz format. -static bool -is_format_xz(void) -{ - return strm.avail_in >= 6 && memcmp(in_buf, "\3757zXZ", 6) == 0; -} - - -/// Return true if the data in in_buf seems to be in the .lzma format. -static bool -is_format_lzma(void) -{ - // The .lzma header is 13 bytes. - if (strm.avail_in < 13) - return false; - - // Decode the LZMA1 properties. - lzma_filter filter = { .id = LZMA_FILTER_LZMA1 }; - if (lzma_properties_decode(&filter, NULL, in_buf, 5) != LZMA_OK) - return false; - - // A hack to ditch tons of false positives: We allow only dictionary - // sizes that are 2^n or 2^n + 2^(n-1) or UINT32_MAX. LZMA_Alone - // created only files with 2^n, but accepts any dictionary size. - // If someone complains, this will be reconsidered. - lzma_options_lzma *opt = filter.options; - const uint32_t dict_size = opt->dict_size; - free(opt); - - if (dict_size != UINT32_MAX) { - uint32_t d = dict_size - 1; - d |= d >> 2; - d |= d >> 3; - d |= d >> 4; - d |= d >> 8; - d |= d >> 16; - ++d; - if (d != dict_size || dict_size == 0) - return false; - } - - // Another hack to ditch false positives: Assume that if the - // uncompressed size is known, it must be less than 256 GiB. - // Again, if someone complains, this will be reconsidered. - uint64_t uncompressed_size = 0; - for (size_t i = 0; i < 8; ++i) - uncompressed_size |= (uint64_t)(in_buf[5 + i]) << (i * 8); - - if (uncompressed_size != UINT64_MAX - && uncompressed_size > (UINT64_C(1) << 38)) - return false; - - return true; -} - - -/// Detect the input file type (for now, this done only when decompressing), -/// and initialize an appropriate coder. Return value indicates if a normal -/// liblzma-based coder was initialized (CODER_INIT_NORMAL), if passthru -/// mode should be used (CODER_INIT_PASSTHRU), or if an error occurred -/// (CODER_INIT_ERROR). -static enum coder_init_ret -coder_init(file_pair *pair) -{ - lzma_ret ret = LZMA_PROG_ERROR; - - if (opt_mode == MODE_COMPRESS) { - switch (opt_format) { - case FORMAT_AUTO: - // args.c ensures this. - assert(0); - break; - - case FORMAT_XZ: - ret = lzma_stream_encoder(&strm, filters, check); - break; - - case FORMAT_LZMA: - ret = lzma_alone_encoder(&strm, filters[0].options); - break; - - case FORMAT_RAW: - ret = lzma_raw_encoder(&strm, filters); - break; - } - } else { - const uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK - | LZMA_CONCATENATED; - - // We abuse FORMAT_AUTO to indicate unknown file format, - // for which we may consider passthru mode. - enum format_type init_format = FORMAT_AUTO; - - switch (opt_format) { - case FORMAT_AUTO: - if (is_format_xz()) - init_format = FORMAT_XZ; - else if (is_format_lzma()) - init_format = FORMAT_LZMA; - break; - - case FORMAT_XZ: - if (is_format_xz()) - init_format = FORMAT_XZ; - break; - - case FORMAT_LZMA: - if (is_format_lzma()) - init_format = FORMAT_LZMA; - break; - - case FORMAT_RAW: - init_format = FORMAT_RAW; - break; - } - - switch (init_format) { - case FORMAT_AUTO: - // Uknown file format. If --decompress --stdout - // --force have been given, then we copy the input - // as is to stdout. Checking for MODE_DECOMPRESS - // is needed, because we don't want to do use - // passthru mode with --test. - if (opt_mode == MODE_DECOMPRESS - && opt_stdout && opt_force) - return CODER_INIT_PASSTHRU; - - ret = LZMA_FORMAT_ERROR; - break; - - case FORMAT_XZ: - ret = lzma_stream_decoder(&strm, - hardware_memlimit_get(), flags); - break; - - case FORMAT_LZMA: - ret = lzma_alone_decoder(&strm, - hardware_memlimit_get()); - break; - - case FORMAT_RAW: - // Memory usage has already been checked in - // coder_set_compression_settings(). - ret = lzma_raw_decoder(&strm, filters); - break; - } - } - - if (ret != LZMA_OK) { - message_error("%s: %s", pair->src_name, message_strm(ret)); - return CODER_INIT_ERROR; - } - - return CODER_INIT_NORMAL; -} - - -/// Compress or decompress using liblzma. -static bool -coder_normal(file_pair *pair) -{ - // Encoder needs to know when we have given all the input to it. - // The decoders need to know it too when we are using - // LZMA_CONCATENATED. We need to check for src_eof here, because - // the first input chunk has been already read, and that may - // have been the only chunk we will read. - lzma_action action = pair->src_eof ? LZMA_FINISH : LZMA_RUN; - - lzma_ret ret; - - // Assume that something goes wrong. - bool success = false; - - strm.next_out = out_buf; - strm.avail_out = IO_BUFFER_SIZE; - - while (!user_abort) { - // Fill the input buffer if it is empty and we haven't reached - // end of file yet. - if (strm.avail_in == 0 && !pair->src_eof) { - strm.next_in = in_buf; - strm.avail_in = io_read(pair, in_buf, IO_BUFFER_SIZE); - - if (strm.avail_in == SIZE_MAX) - break; - - if (pair->src_eof) - action = LZMA_FINISH; - } - - // Let liblzma do the actual work. - ret = lzma_code(&strm, action); - - // Write out if the output buffer became full. - if (strm.avail_out == 0) { - if (opt_mode != MODE_TEST && io_write(pair, out_buf, - IO_BUFFER_SIZE - strm.avail_out)) - break; - - strm.next_out = out_buf; - strm.avail_out = IO_BUFFER_SIZE; - } - - if (ret != LZMA_OK) { - // Determine if the return value indicates that we - // won't continue coding. - const bool stop = ret != LZMA_NO_CHECK - && ret != LZMA_UNSUPPORTED_CHECK; - - if (stop) { - // Write the remaining bytes even if something - // went wrong, because that way the user gets - // as much data as possible, which can be good - // when trying to get at least some useful - // data out of damaged files. - if (opt_mode != MODE_TEST && io_write(pair, - out_buf, IO_BUFFER_SIZE - - strm.avail_out)) - break; - } - - if (ret == LZMA_STREAM_END) { - // Check that there is no trailing garbage. - // This is needed for LZMA_Alone and raw - // streams. - if (strm.avail_in == 0 && !pair->src_eof) { - // Try reading one more byte. - // Hopefully we don't get any more - // input, and thus pair->src_eof - // becomes true. - strm.avail_in = io_read( - pair, in_buf, 1); - if (strm.avail_in == SIZE_MAX) - break; - - assert(strm.avail_in == 0 - || strm.avail_in == 1); - } - - if (strm.avail_in == 0) { - assert(pair->src_eof); - success = true; - break; - } - - // We hadn't reached the end of the file. - ret = LZMA_DATA_ERROR; - assert(stop); - } - - // If we get here and stop is true, something went - // wrong and we print an error. Otherwise it's just - // a warning and coding can continue. - if (stop) { - message_error("%s: %s", pair->src_name, - message_strm(ret)); - } else { - message_warning("%s: %s", pair->src_name, - message_strm(ret)); - - // When compressing, all possible errors set - // stop to true. - assert(opt_mode != MODE_COMPRESS); - } - - if (ret == LZMA_MEMLIMIT_ERROR) { - // Figure out how much memory it would have - // actually needed. - uint64_t memusage = lzma_memusage(&strm); - uint64_t memlimit = hardware_memlimit_get(); - - // Round the memory limit down and usage up. - // This way we don't display a ridiculous - // message like "Limit was 9 MiB, but 9 MiB - // would have been needed". - memusage = (memusage + 1024 * 1024 - 1) - / (1024 * 1024); - memlimit /= 1024 * 1024; - - message_error(_("Limit was %s MiB, " - "but %s MiB would " - "have been needed"), - uint64_to_str(memlimit, 0), - uint64_to_str(memusage, 1)); - } - - if (stop) - break; - } - - // Show progress information under certain conditions. - message_progress_update(); - } - - return success; -} - - -/// Copy from input file to output file without processing the data in any -/// way. This is used only when trying to decompress unrecognized files -/// with --decompress --stdout --force, so the output is always stdout. -static bool -coder_passthru(file_pair *pair) -{ - while (strm.avail_in != 0) { - if (user_abort) - return false; - - if (io_write(pair, in_buf, strm.avail_in)) - return false; - - strm.total_in += strm.avail_in; - strm.total_out = strm.total_in; - message_progress_update(); - - strm.avail_in = io_read(pair, in_buf, IO_BUFFER_SIZE); - if (strm.avail_in == SIZE_MAX) - return false; - } - - return true; -} - - -extern void -coder_run(const char *filename) -{ - // Try to open the input and output files. - file_pair *pair = io_open(filename); - if (pair == NULL) - return; - - // Initialize the progress indicator. - const uint64_t in_size = pair->src_st.st_size <= (off_t)(0) - ? 0 : (uint64_t)(pair->src_st.st_size); - message_progress_start(&strm, pair->src_name, in_size); - - // Assume that something goes wrong. - bool success = false; - - // Read the first chunk of input data. This is needed to detect - // the input file type (for now, only for decompression). - strm.next_in = in_buf; - strm.avail_in = io_read(pair, in_buf, IO_BUFFER_SIZE); - - switch (coder_init(pair)) { - case CODER_INIT_NORMAL: - success = coder_normal(pair); - break; - - case CODER_INIT_PASSTHRU: - success = coder_passthru(pair); - break; - - case CODER_INIT_ERROR: - break; - } - - message_progress_end(success); - - // Close the file pair. It needs to know if coding was successful to - // know if the source or target file should be unlinked. - io_close(pair, success); - - return; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/coder.h b/Build/source/extra/xz-4.999.9beta/src/xz/coder.h deleted file mode 100644 index 0d3af6ad449..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/coder.h +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file coder.h -/// \brief Compresses or uncompresses a file -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -enum operation_mode { - MODE_COMPRESS, - MODE_DECOMPRESS, - MODE_TEST, - MODE_LIST, -}; - - -// NOTE: The order of these is significant in suffix.c. -enum format_type { - FORMAT_AUTO, - FORMAT_XZ, - FORMAT_LZMA, - // HEADER_GZIP, - FORMAT_RAW, -}; - - -/// Operation mode of the command line tool. This is set in args.c and read -/// in several files. -extern enum operation_mode opt_mode; - -/// File format to use when encoding or what format(s) to accept when -/// decoding. This is a global because it's needed also in suffix.c. -/// This is set in args.c. -extern enum format_type opt_format; - - -/// Set the integrity check type used when compressing -extern void coder_set_check(lzma_check check); - -/// Set preset number -extern void coder_set_preset(size_t new_preset); - -/// Enable extreme mode -extern void coder_set_extreme(void); - -/// Add a filter to the custom filter chain -extern void coder_add_filter(lzma_vli id, void *options); - -/// -extern void coder_set_compression_settings(void); - -/// Compress or decompress the given file -extern void coder_run(const char *filename); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/file_io.c b/Build/source/extra/xz-4.999.9beta/src/xz/file_io.c deleted file mode 100644 index 4c52da56c59..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/file_io.c +++ /dev/null @@ -1,719 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file file_io.c -/// \brief File opening, unlinking, and closing -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - -#include <fcntl.h> - -#ifdef DOSLIKE -# include <io.h> -#endif - -#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES) -# include <sys/time.h> -#elif defined(HAVE_UTIME) -# include <utime.h> -#endif - -#ifndef O_BINARY -# define O_BINARY 0 -#endif - -#ifndef O_NOCTTY -# define O_NOCTTY 0 -#endif - -#ifndef DOSLIKE -# include "open_stdxxx.h" -static bool warn_fchown; -#endif - - -extern void -io_init(void) -{ -#ifndef DOSLIKE - // Make sure that stdin, stdout, and and stderr are connected to - // a valid file descriptor. Exit immediatelly with exit code ERROR - // if we cannot make the file descriptors valid. Maybe we should - // print an error message, but our stderr could be screwed anyway. - open_stdxxx(E_ERROR); - - // If fchown() fails setting the owner, we warn about it only if - // we are root. - warn_fchown = geteuid() == 0; -#endif - -#ifdef __DJGPP__ - // Avoid doing useless things when statting files. - // This isn't important but doesn't hurt. - _djstat_flags = _STAT_INODE | _STAT_EXEC_EXT - | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; -#endif - - return; -} - - -/// \brief Unlinks a file -/// -/// This tries to verify that the file being unlinked really is the file that -/// we want to unlink by verifying device and inode numbers. There's still -/// a small unavoidable race, but this is much better than nothing (the file -/// could have been moved/replaced even hours earlier). -static void -io_unlink(const char *name, const struct stat *known_st) -{ -#ifdef DOSLIKE - // On Windows, st_ino is meaningless, so don't bother testing it. - // Just silence a compiler warning. - (void)known_st; -#else - struct stat new_st; - - if (lstat(name, &new_st) - || new_st.st_dev != known_st->st_dev - || new_st.st_ino != known_st->st_ino) - message_error(_("%s: File seems to be moved, not removing"), - name); - else -#endif - // There's a race condition between lstat() and unlink() - // but at least we have tried to avoid removing wrong file. - if (unlink(name)) - message_error(_("%s: Cannot remove: %s"), - name, strerror(errno)); - - return; -} - - -/// \brief Copies owner/group and permissions -/// -/// \todo ACL and EA support -/// -static void -io_copy_attrs(const file_pair *pair) -{ - // Skip chown and chmod on Windows. -#ifndef DOSLIKE - // This function is more tricky than you may think at first. - // Blindly copying permissions may permit users to access the - // destination file who didn't have permission to access the - // source file. - - // Try changing the owner of the file. If we aren't root or the owner - // isn't already us, fchown() probably doesn't succeed. We warn - // about failing fchown() only if we are root. - if (fchown(pair->dest_fd, pair->src_st.st_uid, -1) && warn_fchown) - message_warning(_("%s: Cannot set the file owner: %s"), - pair->dest_name, strerror(errno)); - - mode_t mode; - - if (fchown(pair->dest_fd, -1, pair->src_st.st_gid)) { - message_warning(_("%s: Cannot set the file group: %s"), - pair->dest_name, strerror(errno)); - // We can still safely copy some additional permissions: - // `group' must be at least as strict as `other' and - // also vice versa. - // - // NOTE: After this, the owner of the source file may - // get additional permissions. This shouldn't be too bad, - // because the owner would have had permission to chmod - // the original file anyway. - mode = ((pair->src_st.st_mode & 0070) >> 3) - & (pair->src_st.st_mode & 0007); - mode = (pair->src_st.st_mode & 0700) | (mode << 3) | mode; - } else { - // Drop the setuid, setgid, and sticky bits. - mode = pair->src_st.st_mode & 0777; - } - - if (fchmod(pair->dest_fd, mode)) - message_warning(_("%s: Cannot set the file permissions: %s"), - pair->dest_name, strerror(errno)); -#endif - - // Copy the timestamps. We have several possible ways to do this, of - // which some are better in both security and precision. - // - // First, get the nanosecond part of the timestamps. As of writing, - // it's not standardized by POSIX, and there are several names for - // the same thing in struct stat. - long atime_nsec; - long mtime_nsec; - -# if defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC) - // GNU and Solaris - atime_nsec = pair->src_st.st_atim.tv_nsec; - mtime_nsec = pair->src_st.st_mtim.tv_nsec; - -# elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC) - // BSD - atime_nsec = pair->src_st.st_atimespec.tv_nsec; - mtime_nsec = pair->src_st.st_mtimespec.tv_nsec; - -# elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC) - // GNU and BSD without extensions - atime_nsec = pair->src_st.st_atimensec; - mtime_nsec = pair->src_st.st_mtimensec; - -# elif defined(HAVE_STRUCT_STAT_ST_UATIME) - // Tru64 - atime_nsec = pair->src_st.st_uatime * 1000; - mtime_nsec = pair->src_st.st_umtime * 1000; - -# elif defined(HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC) - // UnixWare - atime_nsec = pair->src_st.st_atim.st__tim.tv_nsec; - mtime_nsec = pair->src_st.st_mtim.st__tim.tv_nsec; - -# else - // Safe fallback - atime_nsec = 0; - mtime_nsec = 0; -# endif - - // Construct a structure to hold the timestamps and call appropriate - // function to set the timestamps. -#if defined(HAVE_FUTIMENS) - // Use nanosecond precision. - struct timespec tv[2]; - tv[0].tv_sec = pair->src_st.st_atime; - tv[0].tv_nsec = atime_nsec; - tv[1].tv_sec = pair->src_st.st_mtime; - tv[1].tv_nsec = mtime_nsec; - - (void)futimens(pair->dest_fd, tv); - -#elif defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES) - // Use microsecond precision. - struct timeval tv[2]; - tv[0].tv_sec = pair->src_st.st_atime; - tv[0].tv_usec = atime_nsec / 1000; - tv[1].tv_sec = pair->src_st.st_mtime; - tv[1].tv_usec = mtime_nsec / 1000; - -# if defined(HAVE_FUTIMES) - (void)futimes(pair->dest_fd, tv); -# elif defined(HAVE_FUTIMESAT) - (void)futimesat(pair->dest_fd, NULL, tv); -# else - // Argh, no function to use a file descriptor to set the timestamp. - (void)utimes(pair->dest_name, tv); -# endif - -#elif defined(HAVE_UTIME) - // Use one-second precision. utime() doesn't support using file - // descriptor either. Some systems have broken utime() prototype - // so don't make this const. - struct utimbuf buf = { - .actime = pair->src_st.st_atime, - .modtime = pair->src_st.st_mtime, - }; - - // Avoid warnings. - (void)atime_nsec; - (void)mtime_nsec; - - (void)utime(pair->dest_name, &buf); -#endif - - return; -} - - -/// Opens the source file. Returns false on success, true on error. -static bool -io_open_src(file_pair *pair) -{ - // There's nothing to open when reading from stdin. - if (pair->src_name == stdin_filename) { - pair->src_fd = STDIN_FILENO; -#ifdef DOSLIKE - setmode(STDIN_FILENO, O_BINARY); -#endif - return false; - } - - // We accept only regular files if we are writing the output - // to disk too, and if --force was not given. - const bool reg_files_only = !opt_stdout && !opt_force; - - // Flags for open() - int flags = O_RDONLY | O_BINARY | O_NOCTTY; - -#ifndef DOSLIKE - // If we accept only regular files, we need to be careful to avoid - // problems with special files like devices and FIFOs. O_NONBLOCK - // prevents blocking when opening such files. When we want to accept - // special files, we must not use O_NONBLOCK, or otherwise we won't - // block waiting e.g. FIFOs to become readable. - if (reg_files_only) - flags |= O_NONBLOCK; -#endif - -#if defined(O_NOFOLLOW) - if (reg_files_only) - flags |= O_NOFOLLOW; -#elif !defined(DOSLIKE) - // Some POSIX-like systems lack O_NOFOLLOW (it's not required - // by POSIX). Check for symlinks with a separate lstat() on - // these systems. - if (reg_files_only) { - struct stat st; - if (lstat(pair->src_name, &st)) { - message_error("%s: %s", pair->src_name, - strerror(errno)); - return true; - - } else if (S_ISLNK(st.st_mode)) { - message_warning(_("%s: Is a symbolic link, " - "skipping"), pair->src_name); - return true; - } - } -#endif - - // Try to open the file. If we are accepting non-regular files, - // unblock the caught signals so that open() can be interrupted - // if it blocks e.g. due to a FIFO file. - if (!reg_files_only) - signals_unblock(); - - // Maybe this wouldn't need a loop, since all the signal handlers for - // which we don't use SA_RESTART set user_abort to true. But it - // doesn't hurt to have it just in case. - do { - pair->src_fd = open(pair->src_name, flags); - } while (pair->src_fd == -1 && errno == EINTR && !user_abort); - - if (!reg_files_only) - signals_block(); - - if (pair->src_fd == -1) { - // If we were interrupted, don't display any error message. - if (errno == EINTR) { - // All the signals that don't have SA_RESTART - // set user_abort. - assert(user_abort); - return true; - } - -#ifdef O_NOFOLLOW - // Give an understandable error message in if reason - // for failing was that the file was a symbolic link. - // - // Note that at least Linux, OpenBSD, Solaris, and Darwin - // use ELOOP to indicate if O_NOFOLLOW was the reason - // that open() failed. Because there may be - // directories in the pathname, ELOOP may occur also - // because of a symlink loop in the directory part. - // So ELOOP doesn't tell us what actually went wrong. - // - // FreeBSD associates EMLINK with O_NOFOLLOW and - // Tru64 uses ENOTSUP. We use these directly here - // and skip the lstat() call and the associated race. - // I want to hear if there are other kernels that - // fail with something else than ELOOP with O_NOFOLLOW. - bool was_symlink = false; - -# if defined(__FreeBSD__) || defined(__DragonFly__) - if (errno == EMLINK) - was_symlink = true; - -# elif defined(__digital__) && defined(__unix__) - if (errno == ENOTSUP) - was_symlink = true; - -# elif defined(__NetBSD__) - // FIXME? As of 2008-11-20, NetBSD doesn't document what - // errno is used with O_NOFOLLOW. It seems to be EFTYPE, - // but since it isn't documented, it may be wrong to rely - // on it here. - if (errno == EFTYPE) - was_symlink = true; - -# else - if (errno == ELOOP && reg_files_only) { - const int saved_errno = errno; - struct stat st; - if (lstat(pair->src_name, &st) == 0 - && S_ISLNK(st.st_mode)) - was_symlink = true; - - errno = saved_errno; - } -# endif - - if (was_symlink) - message_warning(_("%s: Is a symbolic link, " - "skipping"), pair->src_name); - else -#endif - // Something else than O_NOFOLLOW failing - // (assuming that the race conditions didn't - // confuse us). - message_error("%s: %s", pair->src_name, - strerror(errno)); - - return true; - } - -#ifndef DOSLIKE - // Drop O_NONBLOCK, which is used only when we are accepting only - // regular files. After the open() call, we want things to block - // instead of giving EAGAIN. - if (reg_files_only) { - flags = fcntl(pair->src_fd, F_GETFL); - if (flags == -1) - goto error_msg; - - flags &= ~O_NONBLOCK; - - if (fcntl(pair->src_fd, F_SETFL, flags)) - goto error_msg; - } -#endif - - // Stat the source file. We need the result also when we copy - // the permissions, and when unlinking. - if (fstat(pair->src_fd, &pair->src_st)) - goto error_msg; - - if (S_ISDIR(pair->src_st.st_mode)) { - message_warning(_("%s: Is a directory, skipping"), - pair->src_name); - goto error; - } - - if (reg_files_only) { - if (!S_ISREG(pair->src_st.st_mode)) { - message_warning(_("%s: Not a regular file, " - "skipping"), pair->src_name); - goto error; - } - - // These are meaningless on Windows. -#ifndef DOSLIKE - if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) { - // gzip rejects setuid and setgid files even - // when --force was used. bzip2 doesn't check - // for them, but calls fchown() after fchmod(), - // and many systems automatically drop setuid - // and setgid bits there. - // - // We accept setuid and setgid files if - // --force was used. We drop these bits - // explicitly in io_copy_attr(). - message_warning(_("%s: File has setuid or " - "setgid bit set, skipping"), - pair->src_name); - goto error; - } - - if (pair->src_st.st_mode & S_ISVTX) { - message_warning(_("%s: File has sticky bit " - "set, skipping"), - pair->src_name); - goto error; - } - - if (pair->src_st.st_nlink > 1) { - message_warning(_("%s: Input file has more " - "than one hard link, " - "skipping"), pair->src_name); - goto error; - } -#endif - } - - return false; - -error_msg: - message_error("%s: %s", pair->src_name, strerror(errno)); -error: - (void)close(pair->src_fd); - return true; -} - - -/// \brief Closes source file of the file_pair structure -/// -/// \param pair File whose src_fd should be closed -/// \param success If true, the file will be removed from the disk if -/// closing succeeds and --keep hasn't been used. -static void -io_close_src(file_pair *pair, bool success) -{ - if (pair->src_fd != STDIN_FILENO && pair->src_fd != -1) { -#ifdef DOSLIKE - (void)close(pair->src_fd); -#endif - - // If we are going to unlink(), do it before closing the file. - // This way there's no risk that someone replaces the file and - // happens to get same inode number, which would make us - // unlink() wrong file. - // - // NOTE: DOS-like systems are an exception to this, because - // they don't allow unlinking files that are open. *sigh* - if (success && !opt_keep_original) - io_unlink(pair->src_name, &pair->src_st); - -#ifndef DOSLIKE - (void)close(pair->src_fd); -#endif - } - - return; -} - - -static bool -io_open_dest(file_pair *pair) -{ - if (opt_stdout || pair->src_fd == STDIN_FILENO) { - // We don't modify or free() this. - pair->dest_name = (char *)"(stdout)"; - pair->dest_fd = STDOUT_FILENO; -#ifdef DOSLIKE - setmode(STDOUT_FILENO, O_BINARY); -#endif - return false; - } - - pair->dest_name = suffix_get_dest_name(pair->src_name); - if (pair->dest_name == NULL) - return true; - - // If --force was used, unlink the target file first. - if (opt_force && unlink(pair->dest_name) && errno != ENOENT) { - message_error("%s: Cannot unlink: %s", - pair->dest_name, strerror(errno)); - free(pair->dest_name); - return true; - } - - if (opt_force && unlink(pair->dest_name) && errno != ENOENT) { - message_error("%s: Cannot unlink: %s", pair->dest_name, - strerror(errno)); - free(pair->dest_name); - return true; - } - - // Open the file. - const int flags = O_WRONLY | O_BINARY | O_NOCTTY | O_CREAT | O_EXCL; - const mode_t mode = S_IRUSR | S_IWUSR; - pair->dest_fd = open(pair->dest_name, flags, mode); - - if (pair->dest_fd == -1) { - // Don't bother with error message if user requested - // us to exit anyway. - if (!user_abort) - message_error("%s: %s", pair->dest_name, - strerror(errno)); - - free(pair->dest_name); - return true; - } - - // If this really fails... well, we have a safe fallback. - if (fstat(pair->dest_fd, &pair->dest_st)) { - pair->dest_st.st_dev = 0; - pair->dest_st.st_ino = 0; - } - - return false; -} - - -/// \brief Closes destination file of the file_pair structure -/// -/// \param pair File whose dest_fd should be closed -/// \param success If false, the file will be removed from the disk. -/// -/// \return Zero if closing succeeds. On error, -1 is returned and -/// error message printed. -static int -io_close_dest(file_pair *pair, bool success) -{ - if (pair->dest_fd == -1 || pair->dest_fd == STDOUT_FILENO) - return 0; - - if (close(pair->dest_fd)) { - message_error(_("%s: Closing the file failed: %s"), - pair->dest_name, strerror(errno)); - - // Closing destination file failed, so we cannot trust its - // contents. Get rid of junk: - io_unlink(pair->dest_name, &pair->dest_st); - free(pair->dest_name); - return -1; - } - - // If the operation using this file wasn't successful, we git rid - // of the junk file. - if (!success) - io_unlink(pair->dest_name, &pair->dest_st); - - free(pair->dest_name); - - return 0; -} - - -extern file_pair * -io_open(const char *src_name) -{ - if (is_empty_filename(src_name)) - return NULL; - - // Since we have only one file open at a time, we can use - // a statically allocated structure. - static file_pair pair; - - pair = (file_pair){ - .src_name = src_name, - .dest_name = NULL, - .src_fd = -1, - .dest_fd = -1, - .src_eof = false, - }; - - // Block the signals, for which we have a custom signal handler, so - // that we don't need to worry about EINTR. - signals_block(); - - file_pair *ret = NULL; - if (!io_open_src(&pair)) { - // io_open_src() may have unblocked the signals temporarily, - // and thus user_abort may have got set even if open() - // succeeded. - if (user_abort || io_open_dest(&pair)) - io_close_src(&pair, false); - else - ret = &pair; - } - - signals_unblock(); - - return ret; -} - - -extern void -io_close(file_pair *pair, bool success) -{ - signals_block(); - - if (success && pair->dest_fd != STDOUT_FILENO) - io_copy_attrs(pair); - - // Close the destination first. If it fails, we must not remove - // the source file! - if (io_close_dest(pair, success)) - success = false; - - // Close the source file, and unlink it if the operation using this - // file pair was successful and we haven't requested to keep the - // source file. - io_close_src(pair, success); - - signals_unblock(); - - return; -} - - -extern size_t -io_read(file_pair *pair, uint8_t *buf, size_t size) -{ - // We use small buffers here. - assert(size < SSIZE_MAX); - - size_t left = size; - - while (left > 0) { - const ssize_t amount = read(pair->src_fd, buf, left); - - if (amount == 0) { - pair->src_eof = true; - break; - } - - if (amount == -1) { - if (errno == EINTR) { - if (user_abort) - return SIZE_MAX; - - continue; - } - - message_error(_("%s: Read error: %s"), - pair->src_name, strerror(errno)); - - // FIXME Is this needed? - pair->src_eof = true; - - return SIZE_MAX; - } - - buf += (size_t)(amount); - left -= (size_t)(amount); - } - - return size - left; -} - - -extern bool -io_write(const file_pair *pair, const uint8_t *buf, size_t size) -{ - assert(size < SSIZE_MAX); - - while (size > 0) { - const ssize_t amount = write(pair->dest_fd, buf, size); - if (amount == -1) { - if (errno == EINTR) { - if (user_abort) - return -1; - - continue; - } - - // Handle broken pipe specially. gzip and bzip2 - // don't print anything on SIGPIPE. In addition, - // gzip --quiet uses exit status 2 (warning) on - // broken pipe instead of whatever raise(SIGPIPE) - // would make it return. It is there to hide "Broken - // pipe" message on some old shells (probably old - // GNU bash). - // - // We don't do anything special with --quiet, which - // is what bzip2 does too. If we get SIGPIPE, we - // will handle it like other signals by setting - // user_abort, and get EPIPE here. - if (errno != EPIPE) - message_error(_("%s: Write error: %s"), - pair->dest_name, strerror(errno)); - - return true; - } - - buf += (size_t)(amount); - size -= (size_t)(amount); - } - - return false; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/file_io.h b/Build/source/extra/xz-4.999.9beta/src/xz/file_io.h deleted file mode 100644 index b0bbe11a834..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/file_io.h +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file file_io.h -/// \brief I/O types and functions -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -// Some systems have suboptimal BUFSIZ. Use a bit bigger value on them. -#if BUFSIZ <= 1024 -# define IO_BUFFER_SIZE 8192 -#else -# define IO_BUFFER_SIZE BUFSIZ -#endif - - -typedef struct { - /// Name of the source filename (as given on the command line) or - /// pointer to static "(stdin)" when reading from standard input. - const char *src_name; - - /// Destination filename converted from src_name or pointer to static - /// "(stdout)" when writing to standard output. - char *dest_name; - - /// File descriptor of the source file - int src_fd; - - /// File descriptor of the target file - int dest_fd; - - /// Stat of the source file. - struct stat src_st; - - /// Stat of the destination file. - struct stat dest_st; - - /// True once end of the source file has been detected. - bool src_eof; - -} file_pair; - - -/// \brief Initialize the I/O module -extern void io_init(void); - - -/// \brief Opens a file pair -extern file_pair *io_open(const char *src_name); - - -/// \brief Closes the file descriptors and frees possible allocated memory -/// -/// The success argument determines if source or destination file gets -/// unlinked: -/// - false: The destination file is unlinked. -/// - true: The source file is unlinked unless writing to stdout or --keep -/// was used. -extern void io_close(file_pair *pair, bool success); - - -/// \brief Reads from the source file to a buffer -/// -/// \param pair File pair having the source file open for reading -/// \param buf Destination buffer to hold the read data -/// \param size Size of the buffer; assumed be smaller than SSIZE_MAX -/// -/// \return On success, number of bytes read is returned. On end of -/// file zero is returned and pair->src_eof set to true. -/// On error, SIZE_MAX is returned and error message printed. -extern size_t io_read(file_pair *pair, uint8_t *buf, size_t size); - - -/// \brief Writes a buffer to the destination file -/// -/// \param pair File pair having the destination file open for writing -/// \param buf Buffer containing the data to be written -/// \param size Size of the buffer; assumed be smaller than SSIZE_MAX -/// -/// \return On success, zero is returned. On error, -1 is returned -/// and error message printed. -extern bool io_write(const file_pair *pair, const uint8_t *buf, size_t size); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/hardware.c b/Build/source/extra/xz-4.999.9beta/src/xz/hardware.c deleted file mode 100644 index 72dc2cb10ca..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/hardware.c +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file hardware.c -/// \brief Detection of available hardware resources -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" -#include "physmem.h" -#include "cpucores.h" - - -/// Maximum number of free *coder* threads. This can be set with -/// the --threads=NUM command line option. -static uint32_t threadlimit; - -/// Memory usage limit -static uint64_t memlimit; - - -extern void -hardware_threadlimit_set(uint32_t new_threadlimit) -{ - if (new_threadlimit == 0) { - // The default is the number of available CPU cores. - threadlimit = cpucores(); - if (threadlimit == 0) - threadlimit = 1; - } else { - threadlimit = new_threadlimit; - } - - return; -} - - -extern uint32_t -hardware_threadlimit_get(void) -{ - return threadlimit; -} - - -extern void -hardware_memlimit_set(uint64_t new_memlimit) -{ - if (new_memlimit == 0) { - // The default is 40 % of total installed physical RAM. - hardware_memlimit_set_percentage(40); - } else { - memlimit = new_memlimit; - } - - return; -} - - -extern void -hardware_memlimit_set_percentage(uint32_t percentage) -{ - assert(percentage > 0); - assert(percentage <= 100); - - uint64_t mem = physmem(); - - // If we cannot determine the amount of RAM, assume 32 MiB. Maybe - // even that is too much on some systems. But on most systems it's - // far too little, and can be annoying. - if (mem == 0) - mem = UINT64_C(32) * 1024 * 1024; - - memlimit = percentage * mem / 100; - return; -} - - -extern uint64_t -hardware_memlimit_get(void) -{ - return memlimit; -} - - -extern void -hardware_init(void) -{ - hardware_memlimit_set(0); - hardware_threadlimit_set(0); - return; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/hardware.h b/Build/source/extra/xz-4.999.9beta/src/xz/hardware.h deleted file mode 100644 index b2cf34cbc8c..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/hardware.h +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file hardware.h -/// \brief Detection of available hardware resources -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// Initialize some hardware-specific variables, which are needed by other -/// hardware_* functions. -extern void hardware_init(void); - - -/// Set custom value for maximum number of coder threads. -extern void hardware_threadlimit_set(uint32_t threadlimit); - -/// Get the maximum number of coder threads. Some additional helper threads -/// are allowed on top of this). -extern uint32_t hardware_threadlimit_get(void); - - -/// Set custom memory usage limit. This is used for both encoding and -/// decoding. Zero indicates resetting the limit back to defaults. -extern void hardware_memlimit_set(uint64_t memlimit); - -/// Set custom memory usage limit as a percentage of installed RAM. -/// The percentage must be in the range [1, 100]. -extern void hardware_memlimit_set_percentage(uint32_t percentage); - -/// Get the current memory usage limit. -extern uint64_t hardware_memlimit_get(void); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/main.c b/Build/source/extra/xz-4.999.9beta/src/xz/main.c deleted file mode 100644 index 4121f8d48bc..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/main.c +++ /dev/null @@ -1,312 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file main.c -/// \brief main() -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" -#include <ctype.h> - - -/// Exit status to use. This can be changed with set_exit_status(). -static enum exit_status_type exit_status = E_SUCCESS; - -/// True if --no-warn is specified. When this is true, we don't set -/// the exit status to E_WARNING when something worth a warning happens. -static bool no_warn = false; - - -extern void -set_exit_status(enum exit_status_type new_status) -{ - assert(new_status == E_WARNING || new_status == E_ERROR); - - if (exit_status != E_ERROR) - exit_status = new_status; - - return; -} - - -extern void -set_exit_no_warn(void) -{ - no_warn = true; - return; -} - - -extern void -my_exit(enum exit_status_type status) -{ - // Close stdout. If something goes wrong, print an error message - // to stderr. - { - const int ferror_err = ferror(stdout); - const int fclose_err = fclose(stdout); - if (ferror_err || fclose_err) { - // If it was fclose() that failed, we have the reason - // in errno. If only ferror() indicated an error, - // we have no idea what the reason was. - message(V_ERROR, "%s: %s", _("Writing to standard " - "output failed"), - fclose_err ? strerror(errno) - : _("Unknown error")); - status = E_ERROR; - } - } - - // Close stderr. If something goes wrong, there's nothing where we - // could print an error message. Just set the exit status. - { - const int ferror_err = ferror(stderr); - const int fclose_err = fclose(stderr); - if (fclose_err || ferror_err) - status = E_ERROR; - } - - // Suppress the exit status indicating a warning if --no-warn - // was specified. - if (status == E_WARNING && no_warn) - status = E_SUCCESS; - - // If we have got a signal, raise it to kill the program. - // Otherwise we just call exit(). - signals_exit(); - exit(status); -} - - -static const char * -read_name(const args_info *args) -{ - // FIXME: Maybe we should have some kind of memory usage limit here - // like the tool has for the actual compression and uncompression. - // Giving some huge text file with --files0 makes us to read the - // whole file in RAM. - static char *name = NULL; - static size_t size = 256; - - // Allocate the initial buffer. This is never freed, since after it - // is no longer needed, the program exits very soon. It is safe to - // use xmalloc() and xrealloc() in this function, because while - // executing this function, no files are open for writing, and thus - // there's no need to cleanup anything before exiting. - if (name == NULL) - name = xmalloc(size); - - // Write position in name - size_t pos = 0; - - // Read one character at a time into name. - while (!user_abort) { - const int c = fgetc(args->files_file); - - if (ferror(args->files_file)) { - // Take care of EINTR since we have established - // the signal handlers already. - if (errno == EINTR) - continue; - - message_error(_("%s: Error reading filenames: %s"), - args->files_name, strerror(errno)); - return NULL; - } - - if (feof(args->files_file)) { - if (pos != 0) - message_error(_("%s: Unexpected end of input " - "when reading filenames"), - args->files_name); - - return NULL; - } - - if (c == args->files_delim) { - // We allow consecutive newline (--files) or '\0' - // characters (--files0), and ignore such empty - // filenames. - if (pos == 0) - continue; - - // A non-empty name was read. Terminate it with '\0' - // and return it. - name[pos] = '\0'; - return name; - } - - if (c == '\0') { - // A null character was found when using --files, - // which expects plain text input separated with - // newlines. - message_error(_("%s: Null character found when " - "reading filenames; maybe you meant " - "to use `--files0' instead " - "of `--files'?"), args->files_name); - return NULL; - } - - name[pos++] = c; - - // Allocate more memory if needed. There must always be space - // at least for one character to allow terminating the string - // with '\0'. - if (pos == size) { - size *= 2; - name = xrealloc(name, size); - } - } - - return NULL; -} - - -int -main(int argc, char **argv) -{ - // Initialize the file I/O as the very first step. This makes sure - // that stdin, stdout, and stderr are something valid. - io_init(); - -#ifdef DOSLIKE - // Adjust argv[0] to make it look nicer in messages, and also to - // help the code in args.c. - { - // Strip the leading path. - char *p = argv[0] + strlen(argv[0]); - while (argv[0] < p && p[-1] != '/' && p[-1] != '\\') - --p; - - argv[0] = p; - - // Strip the .exe suffix. - p = strrchr(p, '.'); - if (p != NULL) - *p = '\0'; - - // Make it lowercase. - for (p = argv[0]; *p != '\0'; ++p) - if (*p >= 'A' && *p <= 'Z') - *p = *p - 'A' + 'a'; - } -#endif - - // Set up the locale. - setlocale(LC_ALL, ""); - -#ifdef ENABLE_NLS - // Set up the message translations too. - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); -#endif - - // Set the program invocation name used in various messages, and - // do other message handling related initializations. - message_init(argv[0]); - - // Set hardware-dependent default values. These can be overriden - // on the command line, thus this must be done before parse_args(). - hardware_init(); - - // Parse the command line arguments and get an array of filenames. - // This doesn't return if something is wrong with the command line - // arguments. If there are no arguments, one filename ("-") is still - // returned to indicate stdin. - args_info args; - args_parse(&args, argc, argv); - - // Tell the message handling code how many input files there are if - // we know it. This way the progress indicator can show it. - if (args.files_name != NULL) - message_set_files(0); - else - message_set_files(args.arg_count); - - // Refuse to write compressed data to standard output if it is - // a terminal and --force wasn't used. - if (opt_mode == MODE_COMPRESS && !opt_force) { - if (opt_stdout || (args.arg_count == 1 - && strcmp(args.arg_names[0], "-") == 0)) { - if (is_tty_stdout()) { - message_try_help(); - my_exit(E_ERROR); - } - } - } - - if (opt_mode == MODE_LIST) { - message_fatal("--list is not implemented yet."); - } - - // Hook the signal handlers. We don't need these before we start - // the actual action, so this is done after parsing the command - // line arguments. - signals_init(); - - // Process the files given on the command line. Note that if no names - // were given, parse_args() gave us a fake "-" filename. - for (size_t i = 0; i < args.arg_count && !user_abort; ++i) { - if (strcmp("-", args.arg_names[i]) == 0) { - // Processing from stdin to stdout. Unless --force - // was used, check that we aren't writing compressed - // data to a terminal or reading it from terminal. - if (!opt_force) { - if (opt_mode == MODE_COMPRESS) { - if (is_tty_stdout()) - continue; - } else if (is_tty_stdin()) { - continue; - } - } - - // It doesn't make sense to compress data from stdin - // if we are supposed to read filenames from stdin - // too (enabled with --files or --files0). - if (args.files_name == stdin_filename) { - message_error(_("Cannot read data from " - "standard input when " - "reading filenames " - "from standard input")); - continue; - } - - // Replace the "-" with a special pointer, which is - // recognized by coder_run() and other things. - // This way error messages get a proper filename - // string and the code still knows that it is - // handling the special case of stdin. - args.arg_names[i] = (char *)stdin_filename; - } - - // Do the actual compression or uncompression. - coder_run(args.arg_names[i]); - } - - // If --files or --files0 was used, process the filenames from the - // given file or stdin. Note that here we don't consider "-" to - // indicate stdin like we do with the command line arguments. - if (args.files_name != NULL) { - // read_name() checks for user_abort so we don't need to - // check it as loop termination condition. - while (true) { - const char *name = read_name(&args); - if (name == NULL) - break; - - // read_name() doesn't return empty names. - assert(name[0] != '\0'); - coder_run(name); - } - - if (args.files_name != stdin_filename) - (void)fclose(args.files_file); - } - - my_exit(exit_status); -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/main.h b/Build/source/extra/xz-4.999.9beta/src/xz/main.h deleted file mode 100644 index 8fd923930f9..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/main.h +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file main.h -/// \brief Miscellanous declarations -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// Possible exit status values. These are the same as used by gzip and bzip2. -enum exit_status_type { - E_SUCCESS = 0, - E_ERROR = 1, - E_WARNING = 2, -}; - - -/// Sets the exit status after a warning or error has occurred. If new_status -/// is E_WARNING and the old exit status was already E_ERROR, the exit -/// status is not changed. -extern void set_exit_status(enum exit_status_type new_status); - - -/// Use E_SUCCESS instead of E_WARNING if something worth a warning occurs -/// but nothing worth an error has occurred. This is called when --no-warn -/// is specified. -extern void set_exit_no_warn(void); - - -/// Exits the program using the given status. This takes care of closing -/// stdin, stdout, and stderr and catches possible errors. If we had got -/// a signal, this function will raise it so that to the parent process it -/// appears that we were killed by the signal sent by the user. -extern void my_exit(enum exit_status_type status) lzma_attribute((noreturn)); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/message.c b/Build/source/extra/xz-4.999.9beta/src/xz/message.c deleted file mode 100644 index 19aff9bdb41..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/message.c +++ /dev/null @@ -1,1172 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file message.c -/// \brief Printing messages to stderr -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif - -#include <stdarg.h> - - -/// Name of the program which is prefixed to the error messages. -static const char *argv0; - -/// Number of the current file -static unsigned int files_pos = 0; - -/// Total number of input files; zero if unknown. -static unsigned int files_total; - -/// Verbosity level -static enum message_verbosity verbosity = V_WARNING; - -/// Filename which we will print with the verbose messages -static const char *filename; - -/// True once the a filename has been printed to stderr as part of progress -/// message. If automatic progress updating isn't enabled, this becomes true -/// after the first progress message has been printed due to user sending -/// SIGINFO, SIGUSR1, or SIGALRM. Once this variable is true, we will print -/// an empty line before the next filename to make the output more readable. -static bool first_filename_printed = false; - -/// This is set to true when we have printed the current filename to stderr -/// as part of a progress message. This variable is useful only if not -/// updating progress automatically: if user sends many SIGINFO, SIGUSR1, or -/// SIGALRM signals, we won't print the name of the same file multiple times. -static bool current_filename_printed = false; - -/// True if we should print progress indicator and update it automatically -/// if also verbose >= V_VERBOSE. -static bool progress_automatic; - -/// True if message_progress_start() has been called but -/// message_progress_end() hasn't been called yet. -static bool progress_started = false; - -/// This is true when a progress message was printed and the cursor is still -/// on the same line with the progress message. In that case, a newline has -/// to be printed before any error messages. -static bool progress_active = false; - -/// Pointer to lzma_stream used to do the encoding or decoding. -static lzma_stream *progress_strm; - -/// Expected size of the input stream is needed to show completion percentage -/// and estimate remaining time. -static uint64_t expected_in_size; - -/// Time when we started processing the file -static uint64_t start_time; - - -// Use alarm() and SIGALRM when they are supported. This has two minor -// advantages over the alternative of polling gettimeofday(): -// - It is possible for the user to send SIGINFO, SIGUSR1, or SIGALRM to -// get intermediate progress information even when --verbose wasn't used -// or stderr is not a terminal. -// - alarm() + SIGALRM seems to have slightly less overhead than polling -// gettimeofday(). -#ifdef SIGALRM - -/// The signal handler for SIGALRM sets this to true. It is set back to false -/// once the progress message has been updated. -static volatile sig_atomic_t progress_needs_updating = false; - -/// Signal handler for SIGALRM -static void -progress_signal_handler(int sig lzma_attribute((unused))) -{ - progress_needs_updating = true; - return; -} - -#else - -/// This is true when progress message printing is wanted. Using the same -/// variable name as above to avoid some ifdefs. -static bool progress_needs_updating = false; - -/// Elapsed time when the next progress message update should be done. -static uint64_t progress_next_update; - -#endif - - -/// Get the current time as microseconds since epoch -static uint64_t -my_time(void) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return (uint64_t)(tv.tv_sec) * UINT64_C(1000000) + tv.tv_usec; -} - - -/// Wrapper for snprintf() to help constructing a string in pieces. -static void lzma_attribute((format(printf, 3, 4))) -my_snprintf(char **pos, size_t *left, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - const int len = vsnprintf(*pos, *left, fmt, ap); - va_end(ap); - - // If an error occurred, we want the caller to think that the whole - // buffer was used. This way no more data will be written to the - // buffer. We don't need better error handling here. - if (len < 0 || (size_t)(len) >= *left) { - *left = 0; - } else { - *pos += len; - *left -= len; - } - - return; -} - - -extern void -message_init(const char *given_argv0) -{ - // Name of the program - argv0 = given_argv0; - - // If --verbose is used, we use a progress indicator if and only - // if stderr is a terminal. If stderr is not a terminal, we print - // verbose information only after finishing the file. As a special - // exception, even if --verbose was not used, user can send SIGALRM - // to make us print progress information once without automatic - // updating. - progress_automatic = isatty(STDERR_FILENO); - - // Commented out because COLUMNS is rarely exported to environment. - // Most users have at least 80 columns anyway, let's think something - // fancy here if enough people complain. -/* - if (progress_automatic) { - // stderr is a terminal. Check the COLUMNS environment - // variable to see if the terminal is wide enough. If COLUMNS - // doesn't exist or it has some unparseable value, we assume - // that the terminal is wide enough. - const char *columns_str = getenv("COLUMNS"); - if (columns_str != NULL) { - char *endptr; - const long columns = strtol(columns_str, &endptr, 10); - if (*endptr != '\0' || columns < 80) - progress_automatic = false; - } - } -*/ - -#ifdef SIGALRM - // At least DJGPP lacks SA_RESTART. It's not essential for us (the - // rest of the code can handle interrupted system calls), so just - // define it zero. -# ifndef SA_RESTART -# define SA_RESTART 0 -# endif - // Establish the signal handlers which set a flag to tell us that - // progress info should be updated. Since these signals don't - // require any quick action, we set SA_RESTART. - static const int sigs[] = { -#ifdef SIGALRM - SIGALRM, -#endif -#ifdef SIGINFO - SIGINFO, -#endif -#ifdef SIGUSR1 - SIGUSR1, -#endif - }; - - struct sigaction sa; - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; - sa.sa_handler = &progress_signal_handler; - - for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) - if (sigaction(sigs[i], &sa, NULL)) - message_signal_handler(); -#endif - - return; -} - - -extern void -message_verbosity_increase(void) -{ - if (verbosity < V_DEBUG) - ++verbosity; - - return; -} - - -extern void -message_verbosity_decrease(void) -{ - if (verbosity > V_SILENT) - --verbosity; - - return; -} - - -extern void -message_set_files(unsigned int files) -{ - files_total = files; - return; -} - - -/// Prints the name of the current file if it hasn't been printed already, -/// except if we are processing exactly one stream from stdin to stdout. -/// I think it looks nicer to not print "(stdin)" when --verbose is used -/// in a pipe and no other files are processed. -static void -print_filename(void) -{ - if (!current_filename_printed - && (files_total != 1 || filename != stdin_filename)) { - signals_block(); - - // If a file was already processed, put an empty line - // before the next filename to improve readability. - if (first_filename_printed) - fputc('\n', stderr); - - first_filename_printed = true; - current_filename_printed = true; - - // If we don't know how many files there will be due - // to usage of --files or --files0. - if (files_total == 0) - fprintf(stderr, "%s (%u)\n", filename, - files_pos); - else - fprintf(stderr, "%s (%u/%u)\n", filename, - files_pos, files_total); - - signals_unblock(); - } - - return; -} - - -extern void -message_progress_start( - lzma_stream *strm, const char *src_name, uint64_t in_size) -{ - // Store the pointer to the lzma_stream used to do the coding. - // It is needed to find out the position in the stream. - progress_strm = strm; - - // Store the processing start time of the file and its expected size. - // If we aren't printing any statistics, then these are unused. But - // since it is possible that the user sends us a signal to show - // statistics, we need to have these available anyway. - start_time = my_time(); - filename = src_name; - expected_in_size = in_size; - - // Indicate that progress info may need to be printed before - // printing error messages. - progress_started = true; - - // Indicate the name of this file hasn't been printed to - // stderr yet. - current_filename_printed = false; - - // Start numbering the files starting from one. - ++files_pos; - - // If progress indicator is wanted, print the filename and possibly - // the file count now. - if (verbosity >= V_VERBOSE && progress_automatic) { - // Print the filename to stderr if that is appropriate with - // the current settings. - print_filename(); - - // Start the timer to display the first progress message - // after one second. An alternative would be to show the - // first message almost immediatelly, but delaying by one - // second looks better to me, since extremely early - // progress info is pretty much useless. -#ifdef SIGALRM - // First disable a possibly existing alarm. - alarm(0); - progress_needs_updating = false; - alarm(1); -#else - progress_needs_updating = true; - progress_next_update = 1000000; -#endif - } - - return; -} - - -/// Make the string indicating completion percentage. -static const char * -progress_percentage(uint64_t in_pos, bool final) -{ - static char buf[sizeof("100.0 %")]; - - double percentage; - - if (final) { - // Use floating point conversion of snprintf() also for - // 100.0 % instead of fixed string, because the decimal - // separator isn't a dot in all locales. - percentage = 100.0; - } else { - // If the size of the input file is unknown or the size told us is - // clearly wrong since we have processed more data than the alleged - // size of the file, show a static string indicating that we have - // no idea of the completion percentage. - if (expected_in_size == 0 || in_pos > expected_in_size) - return "--- %"; - - // Never show 100.0 % before we actually are finished. - percentage = (double)(in_pos) / (double)(expected_in_size) - * 99.9; - } - - snprintf(buf, sizeof(buf), "%.1f %%", percentage); - - return buf; -} - - -static void -progress_sizes_helper(char **pos, size_t *left, uint64_t value, bool final) -{ - // Allow high precision only for the final message, since it looks - // stupid for in-progress information. - if (final) { - // At maximum of four digits is allowed for exact byte count. - if (value < 10000) { - my_snprintf(pos, left, "%s B", - uint64_to_str(value, 0)); - return; - } - - // At maximum of five significant digits is allowed for KiB. - if (value < UINT64_C(10239900)) { - my_snprintf(pos, left, "%s KiB", double_to_str( - (double)(value) / 1024.0)); - return; - } - } - - // Otherwise we use MiB. - my_snprintf(pos, left, "%s MiB", - double_to_str((double)(value) / (1024.0 * 1024.0))); - - return; -} - - -/// Make the string containing the amount of input processed, amount of -/// output produced, and the compression ratio. -static const char * -progress_sizes(uint64_t compressed_pos, uint64_t uncompressed_pos, bool final) -{ - // This is enough to hold sizes up to about 99 TiB if thousand - // separator is used, or about 1 PiB without thousand separator. - // After that the progress indicator will look a bit silly, since - // the compression ratio no longer fits with three decimal places. - static char buf[44]; - - char *pos = buf; - size_t left = sizeof(buf); - - // Print the sizes. If this the final message, use more reasonable - // units than MiB if the file was small. - progress_sizes_helper(&pos, &left, compressed_pos, final); - my_snprintf(&pos, &left, " / "); - progress_sizes_helper(&pos, &left, uncompressed_pos, final); - - // Avoid division by zero. If we cannot calculate the ratio, set - // it to some nice number greater than 10.0 so that it gets caught - // in the next if-clause. - const double ratio = uncompressed_pos > 0 - ? (double)(compressed_pos) / (double)(uncompressed_pos) - : 16.0; - - // If the ratio is very bad, just indicate that it is greater than - // 9.999. This way the length of the ratio field stays fixed. - if (ratio > 9.999) - snprintf(pos, left, " > %.3f", 9.999); - else - snprintf(pos, left, " = %.3f", ratio); - - return buf; -} - - -/// Make the string containing the processing speed of uncompressed data. -static const char * -progress_speed(uint64_t uncompressed_pos, uint64_t elapsed) -{ - // Don't print the speed immediatelly, since the early values look - // like somewhat random. - if (elapsed < 3000000) - return ""; - - static const char unit[][8] = { - "KiB/s", - "MiB/s", - "GiB/s", - }; - - size_t unit_index = 0; - - // Calculate the speed as KiB/s. - double speed = (double)(uncompressed_pos) - / ((double)(elapsed) * (1024.0 / 1e6)); - - // Adjust the unit of the speed if needed. - while (speed > 999.0) { - speed /= 1024.0; - if (++unit_index == ARRAY_SIZE(unit)) - return ""; // Way too fast ;-) - } - - // Use decimal point only if the number is small. Examples: - // - 0.1 KiB/s - // - 9.9 KiB/s - // - 99 KiB/s - // - 999 KiB/s - static char buf[sizeof("999 GiB/s")]; - snprintf(buf, sizeof(buf), "%.*f %s", - speed > 9.9 ? 0 : 1, speed, unit[unit_index]); - return buf; -} - - -/// Make a string indicating elapsed or remaining time. The format is either -/// M:SS or H:MM:SS depending on if the time is an hour or more. -static const char * -progress_time(uint64_t useconds) -{ - // 9999 hours = 416 days - static char buf[sizeof("9999:59:59")]; - - uint32_t seconds = useconds / 1000000; - - // Don't show anything if the time is zero or ridiculously big. - if (seconds == 0 || seconds > ((9999 * 60) + 59) * 60 + 59) - return ""; - - uint32_t minutes = seconds / 60; - seconds %= 60; - - if (minutes >= 60) { - const uint32_t hours = minutes / 60; - minutes %= 60; - snprintf(buf, sizeof(buf), - "%" PRIu32 ":%02" PRIu32 ":%02" PRIu32, - hours, minutes, seconds); - } else { - snprintf(buf, sizeof(buf), "%" PRIu32 ":%02" PRIu32, - minutes, seconds); - } - - return buf; -} - - -/// Make the string to contain the estimated remaining time, or if the amount -/// of input isn't known, how much time has elapsed. -static const char * -progress_remaining(uint64_t in_pos, uint64_t elapsed) -{ - // Show the amount of time spent so far when making an estimate of - // remaining time wouldn't be reasonable: - // - Input size is unknown. - // - Input has grown bigger since we started (de)compressing. - // - We haven't processed much data yet, so estimate would be - // too inaccurate. - // - Only a few seconds has passed since we started (de)compressing, - // so estimate would be too inaccurate. - if (expected_in_size == 0 || in_pos > expected_in_size - || in_pos < (UINT64_C(1) << 19) || elapsed < 8000000) - return progress_time(elapsed); - - // Calculate the estimate. Don't give an estimate of zero seconds, - // since it is possible that all the input has been already passed - // to the library, but there is still quite a bit of output pending. - uint32_t remaining = (double)(expected_in_size - in_pos) - * ((double)(elapsed) / 1e6) / (double)(in_pos); - if (remaining < 1) - remaining = 1; - - static char buf[sizeof("9 h 55 min")]; - - // Select appropriate precision for the estimated remaining time. - if (remaining <= 10) { - // At maximum of 10 seconds remaining. - // Show the number of seconds as is. - snprintf(buf, sizeof(buf), "%" PRIu32 " s", remaining); - - } else if (remaining <= 50) { - // At maximum of 50 seconds remaining. - // Round up to the next multiple of five seconds. - remaining = (remaining + 4) / 5 * 5; - snprintf(buf, sizeof(buf), "%" PRIu32 " s", remaining); - - } else if (remaining <= 590) { - // At maximum of 9 minutes and 50 seconds remaining. - // Round up to the next multiple of ten seconds. - remaining = (remaining + 9) / 10 * 10; - snprintf(buf, sizeof(buf), "%" PRIu32 " min %" PRIu32 " s", - remaining / 60, remaining % 60); - - } else if (remaining <= 59 * 60) { - // At maximum of 59 minutes remaining. - // Round up to the next multiple of a minute. - remaining = (remaining + 59) / 60; - snprintf(buf, sizeof(buf), "%" PRIu32 " min", remaining); - - } else if (remaining <= 9 * 3600 + 50 * 60) { - // At maximum of 9 hours and 50 minutes left. - // Round up to the next multiple of ten minutes. - remaining = (remaining + 599) / 600 * 10; - snprintf(buf, sizeof(buf), "%" PRIu32 " h %" PRIu32 " min", - remaining / 60, remaining % 60); - - } else if (remaining <= 23 * 3600) { - // At maximum of 23 hours remaining. - // Round up to the next multiple of an hour. - remaining = (remaining + 3599) / 3600; - snprintf(buf, sizeof(buf), "%" PRIu32 " h", remaining); - - } else if (remaining <= 9 * 24 * 3600 + 23 * 3600) { - // At maximum of 9 days and 23 hours remaining. - // Round up to the next multiple of an hour. - remaining = (remaining + 3599) / 3600; - snprintf(buf, sizeof(buf), "%" PRIu32 " d %" PRIu32 " h", - remaining / 24, remaining % 24); - - } else if (remaining <= 999 * 24 * 3600) { - // At maximum of 999 days remaining. ;-) - // Round up to the next multiple of a day. - remaining = (remaining + 24 * 3600 - 1) / (24 * 3600); - snprintf(buf, sizeof(buf), "%" PRIu32 " d", remaining); - - } else { - // The estimated remaining time is so big that it's better - // that we just show the elapsed time. - return progress_time(elapsed); - } - - return buf; -} - - -/// Calculate the elapsed time as microseconds. -static uint64_t -progress_elapsed(void) -{ - return my_time() - start_time; -} - - -/// Get information about position in the stream. This is currently simple, -/// but it will become more complicated once we have multithreading support. -static void -progress_pos(uint64_t *in_pos, - uint64_t *compressed_pos, uint64_t *uncompressed_pos) -{ - *in_pos = progress_strm->total_in; - - if (opt_mode == MODE_COMPRESS) { - *compressed_pos = progress_strm->total_out; - *uncompressed_pos = progress_strm->total_in; - } else { - *compressed_pos = progress_strm->total_in; - *uncompressed_pos = progress_strm->total_out; - } - - return; -} - - -extern void -message_progress_update(void) -{ - if (!progress_needs_updating) - return; - - // Calculate how long we have been processing this file. - const uint64_t elapsed = progress_elapsed(); - -#ifndef SIGALRM - if (progress_next_update > elapsed) - return; - - progress_next_update = elapsed + 1000000; -#endif - - // Get our current position in the stream. - uint64_t in_pos; - uint64_t compressed_pos; - uint64_t uncompressed_pos; - progress_pos(&in_pos, &compressed_pos, &uncompressed_pos); - - // Block signals so that fprintf() doesn't get interrupted. - signals_block(); - - // Print the filename if it hasn't been printed yet. - print_filename(); - - // Print the actual progress message. The idea is that there is at - // least three spaces between the fields in typical situations, but - // even in rare situations there is at least one space. - fprintf(stderr, " %7s %43s %9s %10s\r", - progress_percentage(in_pos, false), - progress_sizes(compressed_pos, uncompressed_pos, false), - progress_speed(uncompressed_pos, elapsed), - progress_remaining(in_pos, elapsed)); - -#ifdef SIGALRM - // Updating the progress info was finished. Reset - // progress_needs_updating to wait for the next SIGALRM. - // - // NOTE: This has to be done before alarm(1) or with (very) bad - // luck we could be setting this to false after the alarm has already - // been triggered. - progress_needs_updating = false; - - if (verbosity >= V_VERBOSE && progress_automatic) { - // Mark that the progress indicator is active, so if an error - // occurs, the error message gets printed cleanly. - progress_active = true; - - // Restart the timer so that progress_needs_updating gets - // set to true after about one second. - alarm(1); - } else { - // The progress message was printed because user had sent us - // SIGALRM. In this case, each progress message is printed - // on its own line. - fputc('\n', stderr); - } -#else - // When SIGALRM isn't supported and we get here, it's always due to - // automatic progress update. We set progress_active here too like - // described above. - assert(verbosity >= V_VERBOSE); - assert(progress_automatic); - progress_active = true; -#endif - - signals_unblock(); - - return; -} - - -static void -progress_flush(bool finished) -{ - if (!progress_started || verbosity < V_VERBOSE) - return; - - uint64_t in_pos; - uint64_t compressed_pos; - uint64_t uncompressed_pos; - progress_pos(&in_pos, &compressed_pos, &uncompressed_pos); - - // Avoid printing intermediate progress info if some error occurs - // in the beginning of the stream. (If something goes wrong later in - // the stream, it is sometimes useful to tell the user where the - // error approximately occurred, especially if the error occurs - // after a time-consuming operation.) - if (!finished && !progress_active - && (compressed_pos == 0 || uncompressed_pos == 0)) - return; - - progress_active = false; - - const uint64_t elapsed = progress_elapsed(); - const char *elapsed_str = progress_time(elapsed); - - signals_block(); - - // When using the auto-updating progress indicator, the final - // statistics are printed in the same format as the progress - // indicator itself. - if (progress_automatic) { - // Using floating point conversion for the percentage instead - // of static "100.0 %" string, because the decimal separator - // isn't a dot in all locales. - fprintf(stderr, " %7s %43s %9s %10s\n", - progress_percentage(in_pos, finished), - progress_sizes(compressed_pos, uncompressed_pos, true), - progress_speed(uncompressed_pos, elapsed), - elapsed_str); - } else { - // The filename is always printed. - fprintf(stderr, "%s: ", filename); - - // Percentage is printed only if we didn't finish yet. - // FIXME: This may look weird when size of the input - // isn't known. - if (!finished) - fprintf(stderr, "%s, ", - progress_percentage(in_pos, false)); - - // Size information is always printed. - fprintf(stderr, "%s", progress_sizes( - compressed_pos, uncompressed_pos, true)); - - // The speed and elapsed time aren't always shown. - const char *speed = progress_speed(uncompressed_pos, elapsed); - if (speed[0] != '\0') - fprintf(stderr, ", %s", speed); - - if (elapsed_str[0] != '\0') - fprintf(stderr, ", %s", elapsed_str); - - fputc('\n', stderr); - } - - signals_unblock(); - - return; -} - - -extern void -message_progress_end(bool success) -{ - assert(progress_started); - progress_flush(success); - progress_started = false; - return; -} - - -static void -vmessage(enum message_verbosity v, const char *fmt, va_list ap) -{ - if (v <= verbosity) { - signals_block(); - - progress_flush(false); - - fprintf(stderr, "%s: ", argv0); - vfprintf(stderr, fmt, ap); - fputc('\n', stderr); - - signals_unblock(); - } - - return; -} - - -extern void -message(enum message_verbosity v, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vmessage(v, fmt, ap); - va_end(ap); - return; -} - - -extern void -message_warning(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vmessage(V_WARNING, fmt, ap); - va_end(ap); - - set_exit_status(E_WARNING); - return; -} - - -extern void -message_error(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vmessage(V_ERROR, fmt, ap); - va_end(ap); - - set_exit_status(E_ERROR); - return; -} - - -extern void -message_fatal(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vmessage(V_ERROR, fmt, ap); - va_end(ap); - - my_exit(E_ERROR); -} - - -extern void -message_bug(void) -{ - message_fatal(_("Internal error (bug)")); -} - - -extern void -message_signal_handler(void) -{ - message_fatal(_("Cannot establish signal handlers")); -} - - -extern const char * -message_strm(lzma_ret code) -{ - switch (code) { - case LZMA_NO_CHECK: - return _("No integrity check; not verifying file integrity"); - - case LZMA_UNSUPPORTED_CHECK: - return _("Unsupported type of integrity check; " - "not verifying file integrity"); - - case LZMA_MEM_ERROR: - return strerror(ENOMEM); - - case LZMA_MEMLIMIT_ERROR: - return _("Memory usage limit reached"); - - case LZMA_FORMAT_ERROR: - return _("File format not recognized"); - - case LZMA_OPTIONS_ERROR: - return _("Unsupported options"); - - case LZMA_DATA_ERROR: - return _("Compressed data is corrupt"); - - case LZMA_BUF_ERROR: - return _("Unexpected end of input"); - - case LZMA_OK: - case LZMA_STREAM_END: - case LZMA_GET_CHECK: - case LZMA_PROG_ERROR: - return _("Internal error (bug)"); - } - - return NULL; -} - - -extern void -message_filters(enum message_verbosity v, const lzma_filter *filters) -{ - if (v > verbosity) - return; - - fprintf(stderr, _("%s: Filter chain:"), argv0); - - for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) { - fprintf(stderr, " --"); - - switch (filters[i].id) { - case LZMA_FILTER_LZMA1: - case LZMA_FILTER_LZMA2: { - const lzma_options_lzma *opt = filters[i].options; - const char *mode; - const char *mf; - - switch (opt->mode) { - case LZMA_MODE_FAST: - mode = "fast"; - break; - - case LZMA_MODE_NORMAL: - mode = "normal"; - break; - - default: - mode = "UNKNOWN"; - break; - } - - switch (opt->mf) { - case LZMA_MF_HC3: - mf = "hc3"; - break; - - case LZMA_MF_HC4: - mf = "hc4"; - break; - - case LZMA_MF_BT2: - mf = "bt2"; - break; - - case LZMA_MF_BT3: - mf = "bt3"; - break; - - case LZMA_MF_BT4: - mf = "bt4"; - break; - - default: - mf = "UNKNOWN"; - break; - } - - fprintf(stderr, "lzma%c=dict=%" PRIu32 - ",lc=%" PRIu32 ",lp=%" PRIu32 - ",pb=%" PRIu32 - ",mode=%s,nice=%" PRIu32 ",mf=%s" - ",depth=%" PRIu32, - filters[i].id == LZMA_FILTER_LZMA2 - ? '2' : '1', - opt->dict_size, - opt->lc, opt->lp, opt->pb, - mode, opt->nice_len, mf, opt->depth); - break; - } - - case LZMA_FILTER_X86: - fprintf(stderr, "x86"); - break; - - case LZMA_FILTER_POWERPC: - fprintf(stderr, "powerpc"); - break; - - case LZMA_FILTER_IA64: - fprintf(stderr, "ia64"); - break; - - case LZMA_FILTER_ARM: - fprintf(stderr, "arm"); - break; - - case LZMA_FILTER_ARMTHUMB: - fprintf(stderr, "armthumb"); - break; - - case LZMA_FILTER_SPARC: - fprintf(stderr, "sparc"); - break; - - case LZMA_FILTER_DELTA: { - const lzma_options_delta *opt = filters[i].options; - fprintf(stderr, "delta=dist=%" PRIu32, opt->dist); - break; - } - - default: - fprintf(stderr, "UNKNOWN"); - break; - } - } - - fputc('\n', stderr); - return; -} - - -extern void -message_try_help(void) -{ - // Print this with V_WARNING instead of V_ERROR to prevent it from - // showing up when --quiet has been specified. - message(V_WARNING, _("Try `%s --help' for more information."), argv0); - return; -} - - -extern void -message_version(void) -{ - // It is possible that liblzma version is different than the command - // line tool version, so print both. - printf("xz (" PACKAGE_NAME ") " LZMA_VERSION_STRING "\n"); - printf("liblzma %s\n", lzma_version_string()); - my_exit(E_SUCCESS); -} - - -extern void -message_help(bool long_help) -{ - printf(_("Usage: %s [OPTION]... [FILE]...\n" - "Compress or decompress FILEs in the .xz format.\n\n"), - argv0); - - puts(_("Mandatory arguments to long options are mandatory for " - "short options too.\n")); - - if (long_help) - puts(_(" Operation mode:\n")); - - puts(_( -" -z, --compress force compression\n" -" -d, --decompress force decompression\n" -" -t, --test test compressed file integrity\n" -" -l, --list list information about files")); - - if (long_help) - puts(_("\n Operation modifiers:\n")); - - puts(_( -" -k, --keep keep (don't delete) input files\n" -" -f, --force force overwrite of output file and (de)compress links\n" -" -c, --stdout write to standard output and don't delete input files")); - - if (long_help) - puts(_( -" -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n" -" --files=[FILE] read filenames to process from FILE; if FILE is\n" -" omitted, filenames are read from the standard input;\n" -" filenames must be terminated with the newline character\n" -" --files0=[FILE] like --files but use the null character as terminator")); - - if (long_help) { - puts(_("\n Basic file format and compression options:\n")); - puts(_( -" -F, --format=FMT file format to encode or decode; possible values are\n" -" `auto' (default), `xz', `lzma', and `raw'\n" -" -C, --check=CHECK integrity check type: `crc32', `crc64' (default),\n" -" or `sha256'")); - } - - puts(_( -" -0 .. -9 compression preset; 0-2 fast compression, 3-5 good\n" -" compression, 6-9 excellent compression; default is 6")); - - puts(_( -" -e, --extreme use more CPU time when encoding to increase compression\n" -" ratio without increasing memory usage of the decoder")); - - if (long_help) - puts(_( -" -M, --memory=NUM use roughly NUM bytes of memory at maximum; 0 indicates\n" -" the default setting, which depends on the operation mode\n" -" and the amount of physical memory (RAM)")); - - if (long_help) { - puts(_( -"\n Custom filter chain for compression (alternative for using presets):")); - -#if defined(HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1) \ - || defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2) - puts(_( -"\n" -" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" -" --lzma2[=OPTS] more of the following options (valid values; default):\n" -" preset=NUM reset options to preset number NUM (0-9)\n" -" dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n" -" lc=NUM number of literal context bits (0-4; 3)\n" -" lp=NUM number of literal position bits (0-4; 0)\n" -" pb=NUM number of position bits (0-4; 2)\n" -" mode=MODE compression mode (fast, normal; normal)\n" -" nice=NUM nice length of a match (2-273; 64)\n" -" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n" -" depth=NUM maximum search depth; 0=automatic (default)")); -#endif - - puts(_( -"\n" -" --x86[=OPTS] x86 BCJ filter\n" -" --powerpc[=OPTS] PowerPC BCJ filter (big endian only)\n" -" --ia64[=OPTS] IA64 (Itanium) BCJ filter\n" -" --arm[=OPTS] ARM BCJ filter (little endian only)\n" -" --armthumb[=OPTS] ARM-Thumb BCJ filter (little endian only)\n" -" --sparc[=OPTS] SPARC BCJ filter\n" -" Valid OPTS for all BCJ filters:\n" -" start=NUM start offset for conversions (default=0)")); - -#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA) - puts(_( -"\n" -" --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" -" dist=NUM distance between bytes being subtracted\n" -" from each other (1-256; 1)")); -#endif - -#if defined(HAVE_ENCODER_SUBBLOCK) || defined(HAVE_DECODER_SUBBLOCK) - puts(_( -"\n" -" --subblock[=OPTS] Subblock filter; valid OPTS (valid values; default):\n" -" size=NUM number of bytes of data per subblock\n" -" (1 - 256Mi; 4Ki)\n" -" rle=NUM run-length encoder chunk size (0-256; 0)")); -#endif - } - - if (long_help) - puts(_("\n Other options:\n")); - - puts(_( -" -q, --quiet suppress warnings; specify twice to suppress errors too\n" -" -v, --verbose be verbose; specify twice for even more verbose")); - - if (long_help) - puts(_( -" -Q, --no-warn make warnings not affect the exit status")); - - if (long_help) - puts(_( -"\n" -" -h, --help display the short help (lists only the basic options)\n" -" -H, --long-help display this long help")); - else - puts(_( -" -h, --help display this short help\n" -" -H, --long-help display the long help (lists also the advanced options)")); - - puts(_( -" -V, --version display the version number")); - - puts(_("\nWith no FILE, or when FILE is -, read standard input.\n")); - - if (long_help) { - printf(_( -"On this system and configuration, this program will use at maximum of roughly\n" -"%s MiB RAM and "), uint64_to_str(hardware_memlimit_get() / (1024 * 1024), 0)); - printf(N_("one thread.\n\n", "%s threads.\n\n", - hardware_threadlimit_get()), - uint64_to_str(hardware_threadlimit_get(), 0)); - } - - printf(_("Report bugs to <%s> (in English or Finnish).\n"), - PACKAGE_BUGREPORT); - printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_HOMEPAGE); - - my_exit(E_SUCCESS); -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/message.h b/Build/source/extra/xz-4.999.9beta/src/xz/message.h deleted file mode 100644 index 16e38b757cf..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/message.h +++ /dev/null @@ -1,132 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file message.h -/// \brief Printing messages to stderr -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// Verbosity levels -enum message_verbosity { - V_SILENT, ///< No messages - V_ERROR, ///< Only error messages - V_WARNING, ///< Errors and warnings - V_VERBOSE, ///< Errors, warnings, and verbose statistics - V_DEBUG, ///< Debugging, FIXME remove? -}; - - -/// \brief Initializes the message functions -/// -/// \param argv0 Name of the program i.e. argv[0] from main() -/// \param verbosity Verbosity level -/// -/// If an error occurs, this function doesn't return. -/// -extern void message_init(const char *argv0); - - -/// Increase verbosity level by one step unless it was at maximum. -extern void message_verbosity_increase(void); - -/// Decrease verbosity level by one step unless it was at minimum. -extern void message_verbosity_decrease(void); - - -/// Set the total number of files to be processed (stdin is counted as a file -/// here). The default is one. -extern void message_set_files(unsigned int files); - - -/// \brief Print a message if verbosity level is at least "verbosity" -/// -/// This doesn't touch the exit status. -extern void message(enum message_verbosity verbosity, const char *fmt, ...) - lzma_attribute((format(printf, 2, 3))); - - -/// \brief Prints a warning and possibly sets exit status -/// -/// The message is printed only if verbosity level is at least V_WARNING. -/// The exit status is set to WARNING unless it was already at ERROR. -extern void message_warning(const char *fmt, ...) - lzma_attribute((format(printf, 1, 2))); - - -/// \brief Prints an error message and sets exit status -/// -/// The message is printed only if verbosity level is at least V_ERROR. -/// The exit status is set to ERROR. -extern void message_error(const char *fmt, ...) - lzma_attribute((format(printf, 1, 2))); - - -/// \brief Prints an error message and exits with EXIT_ERROR -/// -/// The message is printed only if verbosity level is at least V_ERROR. -extern void message_fatal(const char *fmt, ...) - lzma_attribute((format(printf, 1, 2))) - lzma_attribute((noreturn)); - - -/// Print an error message that an internal error occurred and exit with -/// EXIT_ERROR. -extern void message_bug(void) lzma_attribute((noreturn)); - - -/// Print a message that establishing signal handlers failed, and exit with -/// exit status ERROR. -extern void message_signal_handler(void) lzma_attribute((noreturn)); - - -/// Convert lzma_ret to a string. -extern const char *message_strm(lzma_ret code); - - -/// Print the filter chain. -extern void message_filters( - enum message_verbosity v, const lzma_filter *filters); - - -/// Print a message that user should try --help. -extern void message_try_help(void); - - -/// Prints the version number to stdout and exits with exit status SUCCESS. -extern void message_version(void) lzma_attribute((noreturn)); - - -/// Print the help message. -extern void message_help(bool long_help) lzma_attribute((noreturn)); - - -/// \brief Start progress info handling -/// -/// This must be paired with a call to message_progress_end() before the -/// given *strm becomes invalid. -/// -/// \param strm Pointer to lzma_stream used for the coding. -/// \param filename Name of the input file. stdin_filename is -/// handled specially. -/// \param in_size Size of the input file, or zero if unknown. -/// -extern void message_progress_start( - lzma_stream *strm, const char *filename, uint64_t in_size); - - -/// Update the progress info if in verbose mode and enough time has passed -/// since the previous update. This can be called only when -/// message_progress_start() has already been used. -extern void message_progress_update(void); - - -/// \brief Finishes the progress message if we were in verbose mode -/// -/// \param finished True if the whole stream was successfully coded -/// and output written to the output stream. -/// -extern void message_progress_end(bool finished); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/options.c b/Build/source/extra/xz-4.999.9beta/src/xz/options.c deleted file mode 100644 index 8ac6750403f..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/options.c +++ /dev/null @@ -1,438 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file options.c -/// \brief Parser for filter-specific options -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - - -/////////////////// -// Generic stuff // -/////////////////// - -typedef struct { - const char *name; - uint64_t id; -} name_id_map; - - -typedef struct { - const char *name; - const name_id_map *map; - uint64_t min; - uint64_t max; -} option_map; - - -/// Parses option=value pairs that are separated with colons, semicolons, -/// or commas: opt=val:opt=val;opt=val,opt=val -/// -/// Each option is a string, that is converted to an integer using the -/// index where the option string is in the array. -/// -/// Value can be -/// - a string-id map mapping a list of possible string values to integers -/// (opts[i].map != NULL, opts[i].min and opts[i].max are ignored); -/// - a number with minimum and maximum value limit -/// (opts[i].map == NULL && opts[i].min != UINT64_MAX); -/// - a string that will be parsed by the filter-specific code -/// (opts[i].map == NULL && opts[i].min == UINT64_MAX, opts[i].max ignored) -/// -/// When parsing both option and value succeed, a filter-specific function -/// is called, which should update the given value to filter-specific -/// options structure. -/// -/// \param str String containing the options from the command line -/// \param opts Filter-specific option map -/// \param set Filter-specific function to update filter_options -/// \param filter_options Pointer to filter-specific options structure -/// -/// \return Returns only if no errors occur. -/// -static void -parse_options(const char *str, const option_map *opts, - void (*set)(void *filter_options, - uint32_t key, uint64_t value, const char *valuestr), - void *filter_options) -{ - if (str == NULL || str[0] == '\0') - return; - - char *s = xstrdup(str); - char *name = s; - - while (true) { - if (*name == ',') { - if (*++name == '\0') - break; - - continue; - } - - char *split = strchr(name, ','); - if (split != NULL) - *split = '\0'; - - char *value = strchr(name, '='); - if (value != NULL) - *value++ = '\0'; - - if (value == NULL || value[0] == '\0') - message_fatal(_("%s: Options must be `name=value' " - "pairs separated with commas"), str); - - // Look for the option name from the option map. - bool found = false; - for (size_t i = 0; opts[i].name != NULL; ++i) { - if (strcmp(name, opts[i].name) != 0) - continue; - - if (opts[i].map != NULL) { - // value is a string which we should map - // to an integer. - size_t j; - for (j = 0; opts[i].map[j].name != NULL; ++j) { - if (strcmp(opts[i].map[j].name, value) - == 0) - break; - } - - if (opts[i].map[j].name == NULL) - message_fatal(_("%s: Invalid option " - "value"), value); - - set(filter_options, i, opts[i].map[j].id, - value); - - } else if (opts[i].min == UINT64_MAX) { - // value is a special string that will be - // parsed by set(). - set(filter_options, i, 0, value); - - } else { - // value is an integer. - const uint64_t v = str_to_uint64(name, value, - opts[i].min, opts[i].max); - set(filter_options, i, v, value); - } - - found = true; - break; - } - - if (!found) - message_fatal(_("%s: Invalid option name"), name); - - if (split == NULL) - break; - - name = split + 1; - } - - free(s); - return; -} - - -////////////// -// Subblock // -////////////// - -enum { - OPT_SIZE, - OPT_RLE, - OPT_ALIGN, -}; - - -static void -set_subblock(void *options, uint32_t key, uint64_t value, - const char *valuestr lzma_attribute((unused))) -{ - lzma_options_subblock *opt = options; - - switch (key) { - case OPT_SIZE: - opt->subblock_data_size = value; - break; - - case OPT_RLE: - opt->rle = value; - break; - - case OPT_ALIGN: - opt->alignment = value; - break; - } -} - - -extern lzma_options_subblock * -options_subblock(const char *str) -{ - static const option_map opts[] = { - { "size", NULL, LZMA_SUBBLOCK_DATA_SIZE_MIN, - LZMA_SUBBLOCK_DATA_SIZE_MAX }, - { "rle", NULL, LZMA_SUBBLOCK_RLE_OFF, - LZMA_SUBBLOCK_RLE_MAX }, - { "align",NULL, LZMA_SUBBLOCK_ALIGNMENT_MIN, - LZMA_SUBBLOCK_ALIGNMENT_MAX }, - { NULL, NULL, 0, 0 } - }; - - lzma_options_subblock *options - = xmalloc(sizeof(lzma_options_subblock)); - *options = (lzma_options_subblock){ - .allow_subfilters = false, - .alignment = LZMA_SUBBLOCK_ALIGNMENT_DEFAULT, - .subblock_data_size = LZMA_SUBBLOCK_DATA_SIZE_DEFAULT, - .rle = LZMA_SUBBLOCK_RLE_OFF, - }; - - parse_options(str, opts, &set_subblock, options); - - return options; -} - - -/////////// -// Delta // -/////////// - -enum { - OPT_DIST, -}; - - -static void -set_delta(void *options, uint32_t key, uint64_t value, - const char *valuestr lzma_attribute((unused))) -{ - lzma_options_delta *opt = options; - switch (key) { - case OPT_DIST: - opt->dist = value; - break; - } -} - - -extern lzma_options_delta * -options_delta(const char *str) -{ - static const option_map opts[] = { - { "dist", NULL, LZMA_DELTA_DIST_MIN, - LZMA_DELTA_DIST_MAX }, - { NULL, NULL, 0, 0 } - }; - - lzma_options_delta *options = xmalloc(sizeof(lzma_options_delta)); - *options = (lzma_options_delta){ - // It's hard to give a useful default for this. - .type = LZMA_DELTA_TYPE_BYTE, - .dist = LZMA_DELTA_DIST_MIN, - }; - - parse_options(str, opts, &set_delta, options); - - return options; -} - - -///////// -// BCJ // -///////// - -enum { - OPT_START_OFFSET, -}; - - -static void -set_bcj(void *options, uint32_t key, uint64_t value, - const char *valuestr lzma_attribute((unused))) -{ - lzma_options_bcj *opt = options; - switch (key) { - case OPT_START_OFFSET: - opt->start_offset = value; - break; - } -} - - -extern lzma_options_bcj * -options_bcj(const char *str) -{ - static const option_map opts[] = { - { "start", NULL, 0, UINT32_MAX }, - { NULL, NULL, 0, 0 } - }; - - lzma_options_bcj *options = xmalloc(sizeof(lzma_options_bcj)); - *options = (lzma_options_bcj){ - .start_offset = 0, - }; - - parse_options(str, opts, &set_bcj, options); - - return options; -} - - -////////// -// LZMA // -////////// - -enum { - OPT_PRESET, - OPT_DICT, - OPT_LC, - OPT_LP, - OPT_PB, - OPT_MODE, - OPT_NICE, - OPT_MF, - OPT_DEPTH, -}; - - -static void lzma_attribute((noreturn)) -error_lzma_preset(const char *valuestr) -{ - message_fatal(_("Unsupported LZMA1/LZMA2 preset: %s"), valuestr); -} - - -static void -set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr) -{ - lzma_options_lzma *opt = options; - - switch (key) { - case OPT_PRESET: { - if (valuestr[0] < '0' || valuestr[0] > '9') - error_lzma_preset(valuestr); - - uint32_t preset = valuestr[0] - '0'; - - // Currently only "e" is supported as a modifier, - // so keep this simple for now. - if (valuestr[1] != '\0') { - if (valuestr[1] == 'e') - preset |= LZMA_PRESET_EXTREME; - else - error_lzma_preset(valuestr); - - if (valuestr[2] != '\0') - error_lzma_preset(valuestr); - } - - if (lzma_lzma_preset(options, preset)) - error_lzma_preset(valuestr); - - break; - } - - case OPT_DICT: - opt->dict_size = value; - break; - - case OPT_LC: - opt->lc = value; - break; - - case OPT_LP: - opt->lp = value; - break; - - case OPT_PB: - opt->pb = value; - break; - - case OPT_MODE: - opt->mode = value; - break; - - case OPT_NICE: - opt->nice_len = value; - break; - - case OPT_MF: - opt->mf = value; - break; - - case OPT_DEPTH: - opt->depth = value; - break; - } -} - - -extern lzma_options_lzma * -options_lzma(const char *str) -{ - static const name_id_map modes[] = { - { "fast", LZMA_MODE_FAST }, - { "normal", LZMA_MODE_NORMAL }, - { NULL, 0 } - }; - - static const name_id_map mfs[] = { - { "hc3", LZMA_MF_HC3 }, - { "hc4", LZMA_MF_HC4 }, - { "bt2", LZMA_MF_BT2 }, - { "bt3", LZMA_MF_BT3 }, - { "bt4", LZMA_MF_BT4 }, - { NULL, 0 } - }; - - static const option_map opts[] = { - { "preset", NULL, UINT64_MAX, 0 }, - { "dict", NULL, LZMA_DICT_SIZE_MIN, - (UINT32_C(1) << 30) + (UINT32_C(1) << 29) }, - { "lc", NULL, LZMA_LCLP_MIN, LZMA_LCLP_MAX }, - { "lp", NULL, LZMA_LCLP_MIN, LZMA_LCLP_MAX }, - { "pb", NULL, LZMA_PB_MIN, LZMA_PB_MAX }, - { "mode", modes, 0, 0 }, - { "nice", NULL, 2, 273 }, - { "mf", mfs, 0, 0 }, - { "depth", NULL, 0, UINT32_MAX }, - { NULL, NULL, 0, 0 } - }; - - lzma_options_lzma *options = xmalloc(sizeof(lzma_options_lzma)); - *options = (lzma_options_lzma){ - .dict_size = LZMA_DICT_SIZE_DEFAULT, - .preset_dict = NULL, - .preset_dict_size = 0, - .lc = LZMA_LC_DEFAULT, - .lp = LZMA_LP_DEFAULT, - .pb = LZMA_PB_DEFAULT, - .persistent = false, - .mode = LZMA_MODE_NORMAL, - .nice_len = 64, - .mf = LZMA_MF_BT4, - .depth = 0, - }; - - parse_options(str, opts, &set_lzma, options); - - if (options->lc + options->lp > LZMA_LCLP_MAX) - message_fatal(_("The sum of lc and lp must be at " - "maximum of 4")); - - const uint32_t nice_len_min = options->mf & 0x0F; - if (options->nice_len < nice_len_min) - message_fatal(_("The selected match finder requires at " - "least nice=%" PRIu32), nice_len_min); - - return options; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/options.h b/Build/source/extra/xz-4.999.9beta/src/xz/options.h deleted file mode 100644 index e7389c8e99c..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/options.h +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file options.h -/// \brief Parser for filter-specific options -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// \brief Parser for Subblock options -/// -/// \return Pointer to allocated options structure. -/// Doesn't return on error. -extern lzma_options_subblock *options_subblock(const char *str); - - -/// \brief Parser for Delta options -/// -/// \return Pointer to allocated options structure. -/// Doesn't return on error. -extern lzma_options_delta *options_delta(const char *str); - - -/// \brief Parser for BCJ options -/// -/// \return Pointer to allocated options structure. -/// Doesn't return on error. -extern lzma_options_bcj *options_bcj(const char *str); - - -/// \brief Parser for LZMA options -/// -/// \return Pointer to allocated options structure. -/// Doesn't return on error. -extern lzma_options_lzma *options_lzma(const char *str); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/private.h b/Build/source/extra/xz-4.999.9beta/src/xz/private.h deleted file mode 100644 index 6141b88c416..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/private.h +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file private.h -/// \brief Common includes, definions, and prototypes -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "sysdefs.h" -#include "mythread.h" -#include "lzma.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <signal.h> -#include <locale.h> -#include <stdio.h> -#include <unistd.h> - -#ifdef ENABLE_NLS -# include <libintl.h> -# define _(msgid) gettext(msgid) -# define N_(msgid1, msgid2, n) ngettext(msgid1, msgid2, n) -#else -# define _(msgid) (msgid) -# define N_(msgid1, msgid2, n) ((n) == 1 ? (msgid1) : (msgid2)) -#endif - -#ifndef STDIN_FILENO -# define STDIN_FILENO (fileno(stdin)) -#endif - -#ifndef STDOUT_FILENO -# define STDOUT_FILENO (fileno(stdout)) -#endif - -#ifndef STDERR_FILENO -# define STDERR_FILENO (fileno(stderr)) -#endif - -#include "main.h" -#include "coder.h" -#include "message.h" -#include "args.h" -#include "hardware.h" -#include "file_io.h" -#include "options.h" -#include "signals.h" -#include "suffix.h" -#include "util.h" diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/signals.c b/Build/source/extra/xz-4.999.9beta/src/xz/signals.c deleted file mode 100644 index c9acab26a00..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/signals.c +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file signals.c -/// \brief Handling signals to abort operation -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - - -volatile sig_atomic_t user_abort = false; - - -#ifndef _WIN32 - -/// If we were interrupted by a signal, we store the signal number so that -/// we can raise that signal to kill the program when all cleanups have -/// been done. -static volatile sig_atomic_t exit_signal = 0; - -/// Mask of signals for which have have established a signal handler to set -/// user_abort to true. -static sigset_t hooked_signals; - -/// signals_block() and signals_unblock() can be called recursively. -static size_t signals_block_count = 0; - - -static void -signal_handler(int sig) -{ - exit_signal = sig; - user_abort = true; - return; -} - - -extern void -signals_init(void) -{ - // List of signals for which we establish the signal handler. - static const int sigs[] = { - SIGINT, - SIGTERM, -#ifdef SIGHUP - SIGHUP, -#endif -#ifdef SIGPIPE - SIGPIPE, -#endif -#ifdef SIGXCPU - SIGXCPU, -#endif -#ifdef SIGXFSZ - SIGXFSZ, -#endif - }; - - // Mask of the signals for which we have established a signal handler. - sigemptyset(&hooked_signals); - for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) - sigaddset(&hooked_signals, sigs[i]); - - struct sigaction sa; - - // All the signals that we handle we also blocked while the signal - // handler runs. - sa.sa_mask = hooked_signals; - - // Don't set SA_RESTART, because we want EINTR so that we can check - // for user_abort and cleanup before exiting. We block the signals - // for which we have established a handler when we don't want EINTR. - sa.sa_flags = 0; - sa.sa_handler = &signal_handler; - - for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) { - // If the parent process has left some signals ignored, - // we don't unignore them. - struct sigaction old; - if (sigaction(sigs[i], NULL, &old) == 0 - && old.sa_handler == SIG_IGN) - continue; - - // Establish the signal handler. - if (sigaction(sigs[i], &sa, NULL)) - message_signal_handler(); - } - - return; -} - - -extern void -signals_block(void) -{ - if (signals_block_count++ == 0) { - const int saved_errno = errno; - mythread_sigmask(SIG_BLOCK, &hooked_signals, NULL); - errno = saved_errno; - } - - return; -} - - -extern void -signals_unblock(void) -{ - assert(signals_block_count > 0); - - if (--signals_block_count == 0) { - const int saved_errno = errno; - mythread_sigmask(SIG_UNBLOCK, &hooked_signals, NULL); - errno = saved_errno; - } - - return; -} - - -extern void -signals_exit(void) -{ - const int sig = exit_signal; - - if (sig != 0) { - struct sigaction sa; - sa.sa_handler = SIG_DFL; - sigfillset(&sa.sa_mask); - sa.sa_flags = 0; - sigaction(sig, &sa, NULL); - raise(exit_signal); - } - - return; -} - -#else - -// While Windows has some very basic signal handling functions as required -// by C89, they are not really used, or so I understood. Instead, we use -// SetConsoleCtrlHandler() to catch user pressing C-c. - -#include <windows.h> - - -static BOOL WINAPI -signal_handler(DWORD type lzma_attribute((unused))) -{ - // Since we don't get a signal number which we could raise() at - // signals_exit() like on POSIX, just set the exit status to - // indicate an error, so that we cannot return with zero exit status. - set_exit_status(E_ERROR); - user_abort = true; - return TRUE; -} - - -extern void -signals_init(void) -{ - if (!SetConsoleCtrlHandler(&signal_handler, TRUE)) - message_signal_handler(); - - return; -} - -#endif diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/signals.h b/Build/source/extra/xz-4.999.9beta/src/xz/signals.h deleted file mode 100644 index 48945b22403..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/signals.h +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file signals.h -/// \brief Handling signals to abort operation -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// If this is true, we will clean up the possibly incomplete output file, -/// return to main() as soon as practical. That is, the code needs to poll -/// this variable in various places. -extern volatile sig_atomic_t user_abort; - - -/// Initialize the signal handler, which will set user_abort to true when -/// user e.g. presses C-c. -extern void signals_init(void); - - -#ifndef _WIN32 - -/// Block the signals which don't have SA_RESTART and which would just set -/// user_abort to true. This is handy when we don't want to handle EINTR -/// and don't want SA_RESTART either. -extern void signals_block(void); - -/// Unblock the signals blocked by signals_block(). -extern void signals_unblock(void); - -/// If user has sent us a signal earlier to terminate the process, -/// re-raise that signal to actually terminate the process. -extern void signals_exit(void); - -#else - -#define signals_block() do { } while (0) -#define signals_unblock() do { } while (0) -#define signals_exit() do { } while (0) - -#endif diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/suffix.c b/Build/source/extra/xz-4.999.9beta/src/xz/suffix.c deleted file mode 100644 index f9052832634..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/suffix.c +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file suffix.c -/// \brief Checks filename suffix and creates the destination filename -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - -// For case-insensitive filename suffix on case-insensitive systems -#ifdef DOSLIKE -# define strcmp strcasecmp -#endif - - -static char *custom_suffix = NULL; - - -struct suffix_pair { - const char *compressed; - const char *uncompressed; -}; - - -/// \brief Checks if src_name has given compressed_suffix -/// -/// \param suffix Filename suffix to look for -/// \param src_name Input filename -/// \param src_len strlen(src_name) -/// -/// \return If src_name has the suffix, src_len - strlen(suffix) is -/// returned. It's always a positive integer. Otherwise zero -/// is returned. -static size_t -test_suffix(const char *suffix, const char *src_name, size_t src_len) -{ - const size_t suffix_len = strlen(suffix); - - // The filename must have at least one character in addition to - // the suffix. src_name may contain path to the filename, so we - // need to check for directory separator too. - if (src_len <= suffix_len || src_name[src_len - suffix_len - 1] == '/') - return 0; - - if (strcmp(suffix, src_name + src_len - suffix_len) == 0) - return src_len - suffix_len; - - return 0; -} - - -/// \brief Removes the filename suffix of the compressed file -/// -/// \return Name of the uncompressed file, or NULL if file has unknown -/// suffix. -static char * -uncompressed_name(const char *src_name, const size_t src_len) -{ - static const struct suffix_pair suffixes[] = { - { ".xz", "" }, - { ".txz", ".tar" }, // .txz abbreviation for .txt.gz is rare. - { ".lzma", "" }, - { ".tlz", ".tar" }, - // { ".gz", "" }, - // { ".tgz", ".tar" }, - }; - - const char *new_suffix = ""; - size_t new_len = 0; - - if (opt_format == FORMAT_RAW) { - // Don't check for known suffixes when --format=raw was used. - if (custom_suffix == NULL) { - message_error(_("%s: With --format=raw, " - "--suffix=.SUF is required unless " - "writing to stdout"), src_name); - return NULL; - } - } else { - for (size_t i = 0; i < ARRAY_SIZE(suffixes); ++i) { - new_len = test_suffix(suffixes[i].compressed, - src_name, src_len); - if (new_len != 0) { - new_suffix = suffixes[i].uncompressed; - break; - } - } - } - - if (new_len == 0 && custom_suffix != NULL) - new_len = test_suffix(custom_suffix, src_name, src_len); - - if (new_len == 0) { - message_warning(_("%s: Filename has an unknown suffix, " - "skipping"), src_name); - return NULL; - } - - const size_t new_suffix_len = strlen(new_suffix); - char *dest_name = xmalloc(new_len + new_suffix_len + 1); - - memcpy(dest_name, src_name, new_len); - memcpy(dest_name + new_len, new_suffix, new_suffix_len); - dest_name[new_len + new_suffix_len] = '\0'; - - return dest_name; -} - - -/// \brief Appends suffix to src_name -/// -/// In contrast to uncompressed_name(), we check only suffixes that are valid -/// for the specified file format. -static char * -compressed_name(const char *src_name, const size_t src_len) -{ - // The order of these must match the order in args.h. - static const struct suffix_pair all_suffixes[][3] = { - { - { ".xz", "" }, - { ".txz", ".tar" }, - { NULL, NULL } - }, { - { ".lzma", "" }, - { ".tlz", ".tar" }, - { NULL, NULL } -/* - }, { - { ".gz", "" }, - { ".tgz", ".tar" }, - { NULL, NULL } -*/ - }, { - // --format=raw requires specifying the suffix - // manually or using stdout. - { NULL, NULL } - } - }; - - // args.c ensures this. - assert(opt_format != FORMAT_AUTO); - - const size_t format = opt_format - 1; - const struct suffix_pair *const suffixes = all_suffixes[format]; - - for (size_t i = 0; suffixes[i].compressed != NULL; ++i) { - if (test_suffix(suffixes[i].compressed, src_name, src_len) - != 0) { - message_warning(_("%s: File already has `%s' " - "suffix, skipping"), src_name, - suffixes[i].compressed); - return NULL; - } - } - - // TODO: Hmm, maybe it would be better to validate this in args.c, - // since the suffix handling when decoding is weird now. - if (opt_format == FORMAT_RAW && custom_suffix == NULL) { - message_error(_("%s: With --format=raw, " - "--suffix=.SUF is required unless " - "writing to stdout"), src_name); - return NULL; - } - - const char *suffix = custom_suffix != NULL - ? custom_suffix : suffixes[0].compressed; - const size_t suffix_len = strlen(suffix); - - char *dest_name = xmalloc(src_len + suffix_len + 1); - - memcpy(dest_name, src_name, src_len); - memcpy(dest_name + src_len, suffix, suffix_len); - dest_name[src_len + suffix_len] = '\0'; - - return dest_name; -} - - -extern char * -suffix_get_dest_name(const char *src_name) -{ - assert(src_name != NULL); - - // Length of the name is needed in all cases to locate the end of - // the string to compare the suffix, so calculate the length here. - const size_t src_len = strlen(src_name); - - return opt_mode == MODE_COMPRESS - ? compressed_name(src_name, src_len) - : uncompressed_name(src_name, src_len); -} - - -extern void -suffix_set(const char *suffix) -{ - // Empty suffix and suffixes having a slash are rejected. Such - // suffixes would break things later. - if (suffix[0] == '\0' || strchr(suffix, '/') != NULL) - message_fatal(_("%s: Invalid filename suffix"), optarg); - - // Replace the old custom_suffix (if any) with the new suffix. - free(custom_suffix); - custom_suffix = xstrdup(suffix); - return; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/suffix.h b/Build/source/extra/xz-4.999.9beta/src/xz/suffix.h deleted file mode 100644 index 5537d7324f4..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/suffix.h +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file suffix.h -/// \brief Checks filename suffix and creates the destination filename -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// \brief Get the name of the destination file -/// -/// Depending on the global variable opt_mode, this tries to find a matching -/// counterpart for src_name. If the name can be constructed, it is allocated -/// and returned (caller must free it). On error, a message is printed and -/// NULL is returned. -extern char *suffix_get_dest_name(const char *src_name); - - -/// \brief Set a custom filename suffix -/// -/// This function calls xstrdup() for the given suffix, thus the caller -/// doesn't need to keep the memory allocated. There can be only one custom -/// suffix, thus if this is called multiple times, the old suffixes are freed -/// and forgotten. -extern void suffix_set(const char *suffix); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/util.c b/Build/source/extra/xz-4.999.9beta/src/xz/util.c deleted file mode 100644 index d160ea0d600..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/util.c +++ /dev/null @@ -1,229 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file util.c -/// \brief Miscellaneous utility functions -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "private.h" - - -// Thousand separator for format strings is not supported outside POSIX. -// This is used in uint64_to_str() and double_to_str(). -#ifdef DOSLIKE -# define THOUSAND "" -#else -# define THOUSAND "'" -#endif - - -extern void * -xrealloc(void *ptr, size_t size) -{ - assert(size > 0); - - ptr = realloc(ptr, size); - if (ptr == NULL) - message_fatal("%s", strerror(errno)); - - return ptr; -} - - -extern char * -xstrdup(const char *src) -{ - assert(src != NULL); - const size_t size = strlen(src) + 1; - char *dest = xmalloc(size); - return memcpy(dest, src, size); -} - - -extern uint64_t -str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max) -{ - uint64_t result = 0; - - // Skip blanks. - while (*value == ' ' || *value == '\t') - ++value; - - // Accept special value "max". Supporting "min" doesn't seem useful. - if (strcmp(value, "max") == 0) - return max; - - if (*value < '0' || *value > '9') - message_fatal(_("%s: Value is not a non-negative " - "decimal integer"), value); - - do { - // Don't overflow. - if (result > (UINT64_MAX - 9) / 10) - goto error; - - result *= 10; - result += *value - '0'; - ++value; - } while (*value >= '0' && *value <= '9'); - - if (*value != '\0') { - // Look for suffix. - static const struct { - const char name[4]; - uint64_t multiplier; - } suffixes[] = { - { "k", UINT64_C(1000) }, - { "kB", UINT64_C(1000) }, - { "M", UINT64_C(1000000) }, - { "MB", UINT64_C(1000000) }, - { "G", UINT64_C(1000000000) }, - { "GB", UINT64_C(1000000000) }, - { "Ki", UINT64_C(1024) }, - { "KiB", UINT64_C(1024) }, - { "Mi", UINT64_C(1048576) }, - { "MiB", UINT64_C(1048576) }, - { "Gi", UINT64_C(1073741824) }, - { "GiB", UINT64_C(1073741824) } - }; - - uint64_t multiplier = 0; - for (size_t i = 0; i < ARRAY_SIZE(suffixes); ++i) { - if (strcmp(value, suffixes[i].name) == 0) { - multiplier = suffixes[i].multiplier; - break; - } - } - - if (multiplier == 0) { - message(V_ERROR, _("%s: Invalid multiplier suffix. " - "Valid suffixes:"), value); - message_fatal("`k' (10^3), `M' (10^6), `G' (10^9) " - "`Ki' (2^10), `Mi' (2^20), " - "`Gi' (2^30)"); - } - - // Don't overflow here either. - if (result > UINT64_MAX / multiplier) - goto error; - - result *= multiplier; - } - - if (result < min || result > max) - goto error; - - return result; - -error: - message_fatal(_("Value of the option `%s' must be in the range " - "[%" PRIu64 ", %" PRIu64 "]"), - name, min, max); -} - - -extern const char * -uint64_to_str(uint64_t value, uint32_t slot) -{ - // 2^64 with thousand separators is 26 bytes plus trailing '\0'. - static char bufs[4][32]; - - assert(slot < ARRAY_SIZE(bufs)); - - snprintf(bufs[slot], sizeof(bufs[slot]), "%" THOUSAND PRIu64, value); - return bufs[slot]; -} - - -extern const char * -double_to_str(double value) -{ - // 64 bytes is surely enough, since it won't fit in some other - // fields anyway. - static char buf[64]; - - snprintf(buf, sizeof(buf), "%" THOUSAND ".1f", value); - return buf; -} - - -/* -/// \brief Simple quoting to get rid of ASCII control characters -/// -/// This is not so cool and locale-dependent, but should be good enough -/// At least we don't print any control characters on the terminal. -/// -extern char * -str_quote(const char *str) -{ - size_t dest_len = 0; - bool has_ctrl = false; - - while (str[dest_len] != '\0') - if (*(unsigned char *)(str + dest_len++) < 0x20) - has_ctrl = true; - - char *dest = malloc(dest_len + 1); - if (dest != NULL) { - if (has_ctrl) { - for (size_t i = 0; i < dest_len; ++i) - if (*(unsigned char *)(str + i) < 0x20) - dest[i] = '?'; - else - dest[i] = str[i]; - - dest[dest_len] = '\0'; - - } else { - // Usually there are no control characters, - // so we can optimize. - memcpy(dest, str, dest_len + 1); - } - } - - return dest; -} -*/ - - -extern bool -is_empty_filename(const char *filename) -{ - if (filename[0] == '\0') { - message_error(_("Empty filename, skipping")); - return true; - } - - return false; -} - - -extern bool -is_tty_stdin(void) -{ - const bool ret = isatty(STDIN_FILENO); - - if (ret) - message_error(_("Compressed data not read from a terminal " - "unless `--force' is used.")); - - return ret; -} - - -extern bool -is_tty_stdout(void) -{ - const bool ret = isatty(STDOUT_FILENO); - - if (ret) - message_error(_("Compressed data not written to a terminal " - "unless `--force' is used.")); - - return ret; -} diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/util.h b/Build/source/extra/xz-4.999.9beta/src/xz/util.h deleted file mode 100644 index 3657eb80da4..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/util.h +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file util.h -/// \brief Miscellaneous utility functions -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -/// \brief Safe malloc() that never returns NULL -/// -/// \note xmalloc(), xrealloc(), and xstrdup() must not be used when -/// there are files open for writing, that should be cleaned up -/// before exiting. -#define xmalloc(size) xrealloc(NULL, size) - - -/// \brief Safe realloc() that never returns NULL -extern void *xrealloc(void *ptr, size_t size); - - -/// \brief Safe strdup() that never returns NULL -extern char *xstrdup(const char *src); - - -/// \brief Fancy version of strtoull() -/// -/// \param name Name of the option to show in case of an error -/// \param value String containing the number to be parsed; may -/// contain suffixes "k", "M", "G", "Ki", "Mi", or "Gi" -/// \param min Minimum valid value -/// \param max Maximum valid value -/// -/// \return Parsed value that is in the range [min, max]. Does not return -/// if an error occurs. -/// -extern uint64_t str_to_uint64(const char *name, const char *value, - uint64_t min, uint64_t max); - - -/// \brief Convert uint64_t to a string -/// -/// Convert the given value to a string with locale-specific thousand -/// separators, if supported by the snprintf() implementation. The string -/// is stored into an internal static buffer indicated by the slot argument. -/// A pointer to the selected buffer is returned. -/// -/// This function exists, because non-POSIX systems don't support thousand -/// separator in format strings. Solving the problem in a simple way doesn't -/// work, because it breaks gettext (specifically, the xgettext tool). -extern const char *uint64_to_str(uint64_t value, uint32_t slot); - - -/// \brief Convert double to a string with one decimal place -/// -/// This is like uint64_to_str() except that this converts a double and -/// uses exactly one decimal place. -extern const char *double_to_str(double value); - - -/// \brief Check if filename is empty and print an error message -extern bool is_empty_filename(const char *filename); - - -/// \brief Test if stdin is a terminal -/// -/// If stdin is a terminal, an error message is printed and exit status set -/// to EXIT_ERROR. -extern bool is_tty_stdin(void); - - -/// \brief Test if stdout is a terminal -/// -/// If stdout is a terminal, an error message is printed and exit status set -/// to EXIT_ERROR. -extern bool is_tty_stdout(void); diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/xz.1 b/Build/source/extra/xz-4.999.9beta/src/xz/xz.1 deleted file mode 100644 index 2fef75f43a5..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/xz.1 +++ /dev/null @@ -1,1250 +0,0 @@ -'\" t -.\" -.\" Author: Lasse Collin -.\" -.\" This file has been put into the public domain. -.\" You can do whatever you want with this file. -.\" -.TH XZ 1 "2009-08-27" "Tukaani" "XZ Utils" -.SH NAME -xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files -.SH SYNOPSIS -.B xz -.RI [ option ]... -.RI [ file ]... -.PP -.B unxz -is equivalent to -.BR "xz \-\-decompress" . -.br -.B xzcat -is equivalent to -.BR "xz \-\-decompress \-\-stdout" . -.br -.B lzma -is equivalent to -.BR "xz \-\-format=lzma" . -.br -.B unlzma -is equivalent to -.BR "xz \-\-format=lzma \-\-decompress" . -.br -.B lzcat -is equivalent to -.BR "xz \-\-format=lzma \-\-decompress \-\-stdout" . -.PP -When writing scripts that need to decompress files, it is recommended to -always use the name -.B xz -with appropriate arguments -.RB ( "xz \-d" -or -.BR "xz \-dc" ) -instead of the names -.B unxz -and -.BR xzcat. -.SH DESCRIPTION -.B xz -is a general-purpose data compression tool with command line syntax similar to -.BR gzip (1) -and -.BR bzip2 (1). -The native file format is the -.B .xz -format, but also the legacy -.B .lzma -format and raw compressed streams with no container format headers -are supported. -.PP -.B xz -compresses or decompresses each -.I file -according to the selected operation mode. -If no -.I files -are given or -.I file -is -.BR \- , -.B xz -reads from standard input and writes the processed data to standard output. -.B xz -will refuse (display an error and skip the -.IR file ) -to write compressed data to standard output if it is a terminal. Similarly, -.B xz -will refuse to read compressed data from standard input if it is a terminal. -.PP -Unless -.B \-\-stdout -is specified, -.I files -other than -.B \- -are written to a new file whose name is derived from the source -.I file -name: -.IP \(bu 3 -When compressing, the suffix of the target file format -.RB ( .xz -or -.BR .lzma ) -is appended to the source filename to get the target filename. -.IP \(bu 3 -When decompressing, the -.B .xz -or -.B .lzma -suffix is removed from the filename to get the target filename. -.B xz -also recognizes the suffixes -.B .txz -and -.BR .tlz , -and replaces them with the -.B .tar -suffix. -.PP -If the target file already exists, an error is displayed and the -.I file -is skipped. -.PP -Unless writing to standard output, -.B xz -will display a warning and skip the -.I file -if any of the following applies: -.IP \(bu 3 -.I File -is not a regular file. Symbolic links are not followed, thus they -are never considered to be regular files. -.IP \(bu 3 -.I File -has more than one hardlink. -.IP \(bu 3 -.I File -has setuid, setgid, or sticky bit set. -.IP \(bu 3 -The operation mode is set to compress, and the -.I file -already has a suffix of the target file format -.RB ( .xz -or -.B .txz -when compressing to the -.B .xz -format, and -.B .lzma -or -.B .tlz -when compressing to the -.B .lzma -format). -.IP \(bu 3 -The operation mode is set to decompress, and the -.I file -doesn't have a suffix of any of the supported file formats -.RB ( .xz , -.BR .txz , -.BR .lzma , -or -.BR .tlz ). -.PP -After successfully compressing or decompressing the -.IR file , -.B xz -copies the owner, group, permissions, access time, and modification time -from the source -.I file -to the target file. If copying the group fails, the permissions are modified -so that the target file doesn't become accessible to users who didn't have -permission to access the source -.IR file . -.B xz -doesn't support copying other metadata like access control lists -or extended attributes yet. -.PP -Once the target file has been successfully closed, the source -.I file -is removed unless -.B \-\-keep -was specified. The source -.I file -is never removed if the output is written to standard output. -.PP -Sending -.B SIGINFO -or -.B SIGUSR1 -to the -.B xz -process makes it print progress information to standard error. -This has only limited use since when standard error is a terminal, using -.B \-\-verbose -will display an automatically updating progress indicator. -.SS "Memory usage" -The memory usage of -.B xz -varies from a few hundred kilobytes to several gigabytes depending on -the compression settings. The settings used when compressing a file -affect also the memory usage of the decompressor. Typically the decompressor -needs only 5\ % to 20\ % of the amount of RAM that the compressor needed when -creating the file. Still, the worst-case memory usage of the decompressor -is several gigabytes. -.PP -To prevent uncomfortable surprises caused by huge memory usage, -.B xz -has a built-in memory usage limiter. The default limit is 40 % of total -physical RAM. While operating systems provide ways to limit the memory usage -of processes, relying on it wasn't deemed to be flexible enough. -.PP -When compressing, if the selected compression settings exceed the memory -usage limit, the settings are automatically adjusted downwards and a notice -about this is displayed. As an exception, if the memory usage limit is -exceeded when compressing with -.BR \-\-format=raw , -an error is displayed and -.B xz -will exit with exit status -.BR 1 . -.PP -If source -.I file -cannot be decompressed without exceeding the memory usage limit, an error -message is displayed and the file is skipped. Note that compressed files -may contain many blocks, which may have been compressed with different -settings. Typically all blocks will have roughly the same memory requirements, -but it is possible that a block later in the file will exceed the memory usage -limit, and an error about too low memory usage limit gets displayed after some -data has already been decompressed. -.PP -The absolute value of the active memory usage limit can be seen near -the bottom of the output of -.BR \-\-long\-help . -The default limit can be overriden with -\fB\-\-memory=\fIlimit\fR. -.SH OPTIONS -.SS "Integer suffixes and special values" -In most places where an integer argument is expected, an optional suffix -is supported to easily indicate large integers. There must be no space -between the integer and the suffix. -.TP -.BR k " or " kB -The integer is multiplied by 1,000 (10^3). For example, -.B "5k" -or -.B "5kB" -equals -.BR "5000" . -.TP -.BR Ki " or " KiB -The integer is multiplied by 1,024 (2^10). -.TP -.BR M " or " MB -The integer is multiplied by 1,000,000 (10^6). -.TP -.BR Mi " or " MiB -The integer is multiplied by 1,048,576 (2^20). -.TP -.BR G " or " GB -The integer is multiplied by 1,000,000,000 (10^9). -.TP -.BR Gi " or " GiB -The integer is multiplied by 1,073,741,824 (2^30). -.PP -A special value -.B max -can be used to indicate the maximum integer value supported by the option. -.SS "Operation mode" -If multiple operation mode options are given, the last one takes effect. -.TP -.BR \-z ", " \-\-compress -Compress. This is the default operation mode when no operation mode option -is specified, and no other operation mode is implied from the command name -(for example, -.B unxz -implies -.BR \-\-decompress ). -.TP -.BR \-d ", " \-\-decompress ", " \-\-uncompress -Decompress. -.TP -.BR \-t ", " \-\-test -Test the integrity of compressed -.IR files . -No files are created or removed. This option is equivalent to -.B "\-\-decompress \-\-stdout" -except that the decompressed data is discarded instead of being -written to standard output. -.TP -.BR \-l ", " \-\-list -View information about the compressed files. No uncompressed output is -produced, and no files are created or removed. In list mode, the program -cannot read the compressed data from standard input or from other -unseekable sources. -.IP -.B "This feature has not been implemented yet." -.SS "Operation modifiers" -.TP -.BR \-k ", " \-\-keep -Keep (don't delete) the input files. -.TP -.BR \-f ", " \-\-force -This option has several effects: -.RS -.IP \(bu 3 -If the target file already exists, delete it before compressing or -decompressing. -.IP \(bu 3 -Compress or decompress even if the input is not a regular file, -has more than one hardlink, or has setuid, setgid, or sticky bit set. -The setuid, setgid, and sticky bits are not copied to the target file. -.IP \(bu 3 -If combined with -.B \-\-decompress -.BR \-\-stdout -and -.B xz -doesn't recognize the type of the source file, -.B xz -will copy the source file as is to standard output. This allows using -.B xzcat -.B \--force -like -.BR cat (1) -for files that have not been compressed with -.BR xz . -Note that in future, -.B xz -might support new compressed file formats, which may make -.B xz -decompress more types of files instead of copying them as is to -standard output. -.BI \-\-format= format -can be used to restrict -.B xz -to decompress only a single file format. -.IP \(bu 3 -Allow writing compressed data to a terminal, and reading compressed data -from a terminal. -.RE -.TP -.BR \-c ", " \-\-stdout ", " \-\-to-stdout -Write the compressed or decompressed data to standard output instead of -a file. This implies -.BR \-\-keep . -.TP -\fB\-S\fR \fI.suf\fR, \fB\-\-suffix=\fI.suf -When compressing, use -.I .suf -as the suffix for the target file instead of -.B .xz -or -.BR .lzma . -If not writing to standard output and the source file already has the suffix -.IR .suf , -a warning is displayed and the file is skipped. -.IP -When decompressing, recognize also files with the suffix -.I .suf -in addition to files with the -.BR .xz , -.BR .txz , -.BR .lzma , -or -.B .tlz -suffix. If the source file has the suffix -.IR .suf , -the suffix is removed to get the target filename. -.IP -When compressing or decompressing raw streams -.RB ( \-\-format=raw ), -the suffix must always be specified unless writing to standard output, -because there is no default suffix for raw streams. -.TP -\fB\-\-files\fR[\fB=\fIfile\fR] -Read the filenames to process from -.IR file ; -if -.I file -is omitted, filenames are read from standard input. Filenames must be -terminated with the newline character. If filenames are given also as -command line arguments, they are processed before the filenames read from -.IR file . -.TP -\fB\-\-files0\fR[\fB=\fIfile\fR] -This is identical to \fB\-\-files\fR[\fB=\fIfile\fR] except that the -filenames must be terminated with the null character. -.SS "Basic file format and compression options" -.TP -\fB\-F\fR \fIformat\fR, \fB\-\-format=\fIformat -Specify the file format to compress or decompress: -.RS -.IP \(bu 3 -.BR auto : -This is the default. When compressing, -.B auto -is equivalent to -.BR xz . -When decompressing, the format of the input file is autodetected. Note that -raw streams (created with -.BR \-\-format=raw ) -cannot be autodetected. -.IP \(bu 3 -.BR xz : -Compress to the -.B .xz -file format, or accept only -.B .xz -files when decompressing. -.IP \(bu 3 -.B lzma -or -.BR alone : -Compress to the legacy -.B .lzma -file format, or accept only -.B .lzma -files when decompressing. The alternative name -.B alone -is provided for backwards compatibility with LZMA Utils. -.IP \(bu 3 -.BR raw : -Compress or uncompress a raw stream (no headers). This is meant for advanced -users only. To decode raw streams, you need to set not only -.B \-\-format=raw -but also specify the filter chain, which would normally be stored in the -container format headers. -.RE -.TP -\fB\-C\fR \fIcheck\fR, \fB\-\-check=\fIcheck -Specify the type of the integrity check, which is calculated from the -uncompressed data. This option has an effect only when compressing into the -.B .xz -format; the -.B .lzma -format doesn't support integrity checks. -The integrity check (if any) is verified when the -.B .xz -file is decompressed. -.IP -Supported -.I check -types: -.RS -.IP \(bu 3 -.BR none : -Don't calculate an integrity check at all. This is usually a bad idea. This -can be useful when integrity of the data is verified by other means anyway. -.IP \(bu 3 -.BR crc32 : -Calculate CRC32 using the polynomial from IEEE-802.3 (Ethernet). -.IP \(bu 3 -.BR crc64 : -Calculate CRC64 using the polynomial from ECMA-182. This is the default, since -it is slightly better than CRC32 at detecting damaged files and the speed -difference is negligible. -.IP \(bu 3 -.BR sha256 : -Calculate SHA-256. This is somewhat slower than CRC32 and CRC64. -.RE -.IP -Integrity of the -.B .xz -headers is always verified with CRC32. It is not possible to change or -disable it. -.TP -.BR \-0 " ... " \-9 -Select compression preset. If a preset level is specified multiple times, -the last one takes effect. -.IP -The compression preset levels can be categorised roughly into three -categories: -.RS -.IP "\fB\-0\fR ... \fB\-2" -Fast presets with relatively low memory usage. -.B \-1 -and -.B \-2 -should give compression speed and ratios comparable to -.B "bzip2 \-1" -and -.BR "bzip2 \-9" , -respectively. -Currently -.B \-0 -is not very good (not much faster than -.B \-1 -but much worse compression). In future, -.B \-0 -may be indicate some fast algorithm instead of LZMA2. -.IP "\fB\-3\fR ... \fB\-5" -Good compression ratio with low to medium memory usage. -These are significantly slower than levels 0\-2. -.IP "\fB\-6\fR ... \fB\-9" -Excellent compression with medium to high memory usage. These are also -slower than the lower preset levels. The default is -.BR \-6 . -Unless you want to maximize the compression ratio, you probably don't want -a higher preset level than -.B \-7 -due to speed and memory usage. -.RE -.IP -The exact compression settings (filter chain) used by each preset may -vary between -.B xz -versions. The settings may also vary between files being compressed, if -.B xz -determines that modified settings will probably give better compression -ratio without significantly affecting compression time or memory usage. -.IP -Because the settings may vary, the memory usage may vary too. The following -table lists the maximum memory usage of each preset level, which won't be -exceeded even in future versions of -.BR xz . -.IP -.B "FIXME: The table below is just a rough idea." -.RS -.RS -.TS -tab(;); -c c c -n n n. -Preset;Compression;Decompression -\-0;6 MiB;1 MiB -\-1;6 MiB;1 MiB -\-2;10 MiB;1 MiB -\-3;20 MiB;2 MiB -\-4;30 MiB;3 MiB -\-5;60 MiB;6 MiB -\-6;100 MiB;10 MiB -\-7;200 MiB;20 MiB -\-8;400 MiB;40 MiB -\-9;800 MiB;80 MiB -.TE -.RE -.RE -.IP -When compressing, -.B xz -automatically adjusts the compression settings downwards if -the memory usage limit would be exceeded, so it is safe to specify -a high preset level even on systems that don't have lots of RAM. -.TP -.BR \-\-fast " and " \-\-best -These are somewhat misleading aliases for -.B \-0 -and -.BR \-9 , -respectively. -These are provided only for backwards compatibility with LZMA Utils. -Avoid using these options. -.IP -Especially the name of -.B \-\-best -is misleading, because the definition of best depends on the input data, -and that usually people don't want the very best compression ratio anyway, -because it would be very slow. -.TP -.BR \-e ", " \-\-extreme -Modify the compression preset (\fB\-0\fR ... \fB\-9\fR) so that a little bit -better compression ratio can be achieved without increasing memory usage -of the compressor or decompressor (exception: compressor memory usage may -increase a little with presets \fB\-0\fR ... \fB\-2\fR). The downside is that -the compression time will increase dramatically (it can easily double). -.TP -\fB\-M\fR \fIlimit\fR, \fB\-\-memory=\fIlimit -Set the memory usage limit. If this option is specied multiple times, -the last one takes effect. The -.I limit -can be specified in multiple ways: -.RS -.IP \(bu 3 -The -.I limit -can be an absolute value in bytes. Using an integer suffix like -.B MiB -can be useful. Example: -.B "\-\-memory=80MiB" -.IP \(bu 3 -The -.I limit -can be specified as a percentage of physical RAM. Example: -.B "\-\-memory=70%" -.IP \(bu 3 -The -.I limit -can be reset back to its default value (currently 40 % of physical RAM) -by setting it to -.BR 0 . -.IP \(bu 3 -The memory usage limiting can be effectively disabled by setting -.I limit -to -.BR max . -This isn't recommended. It's usually better to use, for example, -.BR \-\-memory=90% . -.RE -.IP -The current -.I limit -can be seen near the bottom of the output of the -.B \-\-long-help -option. -.TP -\fB\-T\fR \fIthreads\fR, \fB\-\-threads=\fIthreads -Specify the maximum number of worker threads to use. The default is -the number of available CPU cores. You can see the current value of -.I threads -near the end of the output of the -.B \-\-long\-help -option. -.IP -The actual number of worker threads can be less than -.I threads -if using more threads would exceed the memory usage limit. -In addition to CPU-intensive worker threads, -.B xz -may use a few auxiliary threads, which don't use a lot of CPU time. -.IP -.B "Multithreaded compression and decompression are not implemented yet," -.B "so this option has no effect for now." -.SS Custom compressor filter chains -A custom filter chain allows specifying the compression settings in detail -instead of relying on the settings associated to the preset levels. -When a custom filter chain is specified, the compression preset level options -(\fB\-0\fR ... \fB\-9\fR and \fB\-\-extreme\fR) are silently ignored. -.PP -A filter chain is comparable to piping on the UN*X command line. -When compressing, the uncompressed input goes to the first filter, whose -output goes to the next filter (if any). The output of the last filter -gets written to the compressed file. The maximum number of filters in -the chain is four, but typically a filter chain has only one or two filters. -.PP -Many filters have limitations where they can be in the filter chain: -some filters can work only as the last filter in the chain, some only -as a non-last filter, and some work in any position in the chain. Depending -on the filter, this limitation is either inherent to the filter design or -exists to prevent security issues. -.PP -A custom filter chain is specified by using one or more filter options in -the order they are wanted in the filter chain. That is, the order of filter -options is significant! When decoding raw streams -.RB ( \-\-format=raw ), -the filter chain is specified in the same order as it was specified when -compressing. -.PP -Filters take filter-specific -.I options -as a comma-separated list. Extra commas in -.I options -are ignored. Every option has a default value, so you need to -specify only those you want to change. -.TP -\fB\-\-lzma1\fR[\fB=\fIoptions\fR], \fB\-\-lzma2\fR[\fB=\fIoptions\fR] -Add LZMA1 or LZMA2 filter to the filter chain. These filter can be used -only as the last filter in the chain. -.IP -LZMA1 is a legacy filter, which is supported almost solely due to the legacy -.B .lzma -file format, which supports only LZMA1. LZMA2 is an updated -version of LZMA1 to fix some practical issues of LZMA1. The -.B .xz -format uses LZMA2, and doesn't support LZMA1 at all. Compression speed and -ratios of LZMA1 and LZMA2 are practically the same. -.IP -LZMA1 and LZMA2 share the same set of -.IR options : -.RS -.TP -.BI preset= preset -Reset all LZMA1 or LZMA2 -.I options -to -.IR preset . -.I Preset -consist of an integer, which may be followed by single-letter preset -modifiers. The integer can be from -.B 0 -to -.BR 9 , -matching the command line options \fB\-0\fR ... \fB\-9\fR. -The only supported modifier is currently -.BR e , -which matches -.BR \-\-extreme . -.IP -The default -.I preset -is -.BR 6 , -from which the default values for the rest of the LZMA1 or LZMA2 -.I options -are taken. -.TP -.BI dict= size -Dictionary (history buffer) size indicates how many bytes of the recently -processed uncompressed data is kept in memory. One method to reduce size of -the uncompressed data is to store distance-length pairs, which -indicate what data to repeat from the dictionary buffer. The bigger -the dictionary, the better the compression ratio usually is, -but dictionaries bigger than the uncompressed data are waste of RAM. -.IP -Typical dictionary size is from 64 KiB to 64 MiB. The minimum is 4 KiB. -The maximum for compression is currently 1.5 GiB. The decompressor already -supports dictionaries up to one byte less than 4 GiB, which is the -maximum for LZMA1 and LZMA2 stream formats. -.IP -Dictionary size has the biggest effect on compression ratio. -Dictionary size and match finder together determine the memory usage of -the LZMA1 or LZMA2 encoder. The same dictionary size is required -for decompressing that was used when compressing, thus the memory usage of -the decoder is determined by the dictionary size used when compressing. -.TP -.BI lc= lc -Specify the number of literal context bits. The minimum is -.B 0 -and the maximum is -.BR 4 ; -the default is -.BR 3 . -In addition, the sum of -.I lc -and -.I lp -must not exceed -.BR 4 . -.TP -.BI lp= lp -Specify the number of literal position bits. The minimum is -.B 0 -and the maximum is -.BR 4 ; -the default is -.BR 0 . -.TP -.BI pb= pb -Specify the number of position bits. The minimum is -.B 0 -and the maximum is -.BR 4 ; -the default is -.BR 2 . -.TP -.BI mode= mode -Compression -.I mode -specifies the function used to analyze the data produced by the match finder. -Supported -.I modes -are -.B fast -and -.BR normal . -The default is -.B fast -for -.I presets -.BR 0 \- 2 -and -.B normal -for -.I presets -.BR 3 \- 9 . -.TP -.BI mf= mf -Match finder has a major effect on encoder speed, memory usage, and -compression ratio. Usually Hash Chain match finders are faster than -Binary Tree match finders. Hash Chains are usually used together with -.B mode=fast -and Binary Trees with -.BR mode=normal . -The memory usage formulas are only rough estimates, -which are closest to reality when -.I dict -is a power of two. -.RS -.TP -.B hc3 -Hash Chain with 2- and 3-byte hashing -.br -Minimum value for -.IR nice : -3 -.br -Memory usage: -.I dict -* 7.5 (if -.I dict -<= 16 MiB); -.br -.I dict -* 5.5 + 64 MiB (if -.I dict -> 16 MiB) -.TP -.B hc4 -Hash Chain with 2-, 3-, and 4-byte hashing -.br -Minimum value for -.IR nice : -4 -.br -Memory usage: -.I dict -* 7.5 -.TP -.B bt2 -Binary Tree with 2-byte hashing -.br -Minimum value for -.IR nice : -2 -.br -Memory usage: -.I dict -* 9.5 -.TP -.B bt3 -Binary Tree with 2- and 3-byte hashing -.br -Minimum value for -.IR nice : -3 -.br -Memory usage: -.I dict -* 11.5 (if -.I dict -<= 16 MiB); -.br -.I dict -* 9.5 + 64 MiB (if -.I dict -> 16 MiB) -.TP -.B bt4 -Binary Tree with 2-, 3-, and 4-byte hashing -.br -Minimum value for -.IR nice : -4 -.br -Memory usage: -.I dict -* 11.5 -.RE -.TP -.BI nice= nice -Specify what is considered to be a nice length for a match. Once a match -of at least -.I nice -bytes is found, the algorithm stops looking for possibly better matches. -.IP -.I nice -can be 2\-273 bytes. Higher values tend to give better compression ratio -at expense of speed. The default depends on the -.I preset -level. -.TP -.BI depth= depth -Specify the maximum search depth in the match finder. The default is the -special value -.BR 0 , -which makes the compressor determine a reasonable -.I depth -from -.I mf -and -.IR nice . -.IP -Using very high values for -.I depth -can make the encoder extremely slow with carefully crafted files. -Avoid setting the -.I depth -over 1000 unless you are prepared to interrupt the compression in case it -is taking too long. -.RE -.IP -When decoding raw streams -.RB ( \-\-format=raw ), -LZMA2 needs only the value of -.BR dict . -LZMA1 needs also -.BR lc , -.BR lp , -and -.BR pb. -.TP -\fB\-\-x86\fR[\fB=\fIoptions\fR] -.TP -\fB\-\-powerpc\fR[\fB=\fIoptions\fR] -.TP -\fB\-\-ia64\fR[\fB=\fIoptions\fR] -.TP -\fB\-\-arm\fR[\fB=\fIoptions\fR] -.TP -\fB\-\-armthumb\fR[\fB=\fIoptions\fR] -.TP -\fB\-\-sparc\fR[\fB=\fIoptions\fR] -Add a branch/call/jump (BCJ) filter to the filter chain. These filters -can be used only as non-last filter in the filter chain. -.IP -A BCJ filter converts relative addresses in the machine code to their -absolute counterparts. This doesn't change the size of the data, but -it increases redundancy, which allows e.g. LZMA2 to get better -compression ratio. -.IP -The BCJ filters are always reversible, so using a BCJ filter for wrong -type of data doesn't cause any data loss. However, applying a BCJ filter -for wrong type of data is a bad idea, because it tends to make the -compression ratio worse. -.IP -Different instruction sets have have different alignment: -.RS -.RS -.TS -tab(;); -l n l -l n l. -Filter;Alignment;Notes -x86;1;32-bit and 64-bit x86 -PowerPC;4;Big endian only -ARM;4;Little endian only -ARM-Thumb;2;Little endian only -IA-64;16;Big or little endian -SPARC;4;Big or little endian -.TE -.RE -.RE -.IP -Since the BCJ-filtered data is usually compressed with LZMA2, the compression -ratio may be improved slightly if the LZMA2 options are set to match the -alignment of the selected BCJ filter. For example, with the IA-64 filter, -it's good to set -.B pb=4 -with LZMA2 (2^4=16). The x86 filter is an exception; it's usually good to -stick to LZMA2's default four-byte alignment when compressing x86 executables. -.IP -All BCJ filters support the same -.IR options : -.RS -.TP -.BI start= offset -Specify the start -.I offset -that is used when converting between relative and absolute addresses. -The -.I offset -must be a multiple of the alignment of the filter (see the table above). -The default is zero. In practice, the default is good; specifying -a custom -.I offset -is almost never useful. -.IP -Specifying a non-zero start -.I offset -is probably useful only if the executable has multiple sections, and there -are many cross-section jumps or calls. Applying a BCJ filter separately for -each section with proper start offset and then compressing the result as -a single chunk may give some improvement in compression ratio compared -to applying the BCJ filter with the default -.I offset -for the whole executable. -.RE -.TP -\fB\-\-delta\fR[\fB=\fIoptions\fR] -Add Delta filter to the filter chain. The Delta filter -can be used only as non-last filter in the filter chain. -.IP -Currently only simple byte-wise delta calculation is supported. It can -be useful when compressing e.g. uncompressed bitmap images or uncompressed -PCM audio. However, special purpose algorithms may give significantly better -results than Delta + LZMA2. This is true especially with audio, which -compresses faster and better e.g. with FLAC. -.IP -Supported -.IR options : -.RS -.TP -.BI dist= distance -Specify the -.I distance -of the delta calculation as bytes. -.I distance -must be 1\-256. The default is 1. -.IP -For example, with -.B dist=2 -and eight-byte input A1 B1 A2 B3 A3 B5 A4 B7, the output will be -A1 B1 01 02 01 02 01 02. -.RE -.SS "Other options" -.TP -.BR \-q ", " \-\-quiet -Suppress warnings and notices. Specify this twice to suppress errors too. -This option has no effect on the exit status. That is, even if a warning -was suppressed, the exit status to indicate a warning is still used. -.TP -.BR \-v ", " \-\-verbose -Be verbose. If standard error is connected to a terminal, -.B xz -will display a progress indicator. -Specifying -.B \-\-verbose -twice will give even more verbose output (useful mostly for debugging). -.TP -.BR \-Q ", " \-\-no\-warn -Don't set the exit status to -.B 2 -even if a condition worth a warning was detected. This option doesn't affect -the verbosity level, thus both -.B \-\-quiet -and -.B \-\-no\-warn -have to be used to not display warnings and to not alter the exit status. -.TP -.BR \-h ", " \-\-help -Display a help message describing the most commonly used options, -and exit successfully. -.TP -.BR \-H ", " \-\-long\-help -Display a help message describing all features of -.BR xz , -and exit successfully -.TP -.BR \-V ", " \-\-version -Display the version number of -.B xz -and liblzma. -.SH "EXIT STATUS" -.TP -.B 0 -All is good. -.TP -.B 1 -An error occurred. -.TP -.B 2 -Something worth a warning occurred, but no actual errors occurred. -.PP -Notices (not warnings or errors) printed on standard error don't affect -the exit status. -.SH ENVIRONMENT -.TP -.B XZ_OPT -A space-separated list of options is parsed from -.B XZ_OPT -before parsing the options given on the command line. Note that only -options are parsed from -.BR XZ_OPT ; -all non-options are silently ignored. Parsing is done with -.BR getopt_long (3) -which is used also for the command line arguments. -.SH "LZMA UTILS COMPATIBILITY" -The command line syntax of -.B xz -is practically a superset of -.BR lzma , -.BR unlzma , -and -.BR lzcat -as found from LZMA Utils 4.32.x. In most cases, it is possible to replace -LZMA Utils with XZ Utils without breaking existing scripts. There are some -incompatibilities though, which may sometimes cause problems. -.SS "Compression preset levels" -The numbering of the compression level presets is not identical in -.B xz -and LZMA Utils. -The most important difference is how dictionary sizes are mapped to different -presets. Dictionary size is roughly equal to the decompressor memory usage. -.RS -.TS -tab(;); -c c c -c n n. -Level;xz;LZMA Utils -\-1;64 KiB;64 KiB -\-2;512 KiB;1 MiB -\-3;1 MiB;512 KiB -\-4;2 MiB;1 MiB -\-5;4 MiB;2 MiB -\-6;8 MiB;4 MiB -\-7;16 MiB;8 MiB -\-8;32 MiB;16 MiB -\-9;64 MiB;32 MiB -.TE -.RE -.PP -The dictionary size differences affect the compressor memory usage too, -but there are some other differences between LZMA Utils and XZ Utils, which -make the difference even bigger: -.RS -.TS -tab(;); -c c c -c n n. -Level;xz;LZMA Utils 4.32.x -\-1;2 MiB;2 MiB -\-2;5 MiB;12 MiB -\-3;13 MiB;12 MiB -\-4;25 MiB;16 MiB -\-5;48 MiB;26 MiB -\-6;94 MiB;45 MiB -\-7;186 MiB;83 MiB -\-8;370 MiB;159 MiB -\-9;674 MiB;311 MiB -.TE -.RE -.PP -The default preset level in LZMA Utils is -.B \-7 -while in XZ Utils it is -.BR \-6 , -so both use 8 MiB dictionary by default. -.SS "Streamed vs. non-streamed .lzma files" -Uncompressed size of the file can be stored in the -.B .lzma -header. LZMA Utils does that when compressing regular files. -The alternative is to mark that uncompressed size is unknown and -use end of payload marker to indicate where the decompressor should stop. -LZMA Utils uses this method when uncompressed size isn't known, which is -the case for example in pipes. -.PP -.B xz -supports decompressing -.B .lzma -files with or without end of payload marker, but all -.B .lzma -files created by -.B xz -will use end of payload marker and have uncompressed size marked as unknown -in the -.B .lzma -header. This may be a problem in some (uncommon) situations. For example, a -.B .lzma -decompressor in an embedded device might work only with files that have known -uncompressed size. If you hit this problem, you need to use LZMA Utils or -LZMA SDK to create -.B .lzma -files with known uncompressed size. -.SS "Unsupported .lzma files" -The -.B .lzma -format allows -.I lc -values up to 8, and -.I lp -values up to 4. LZMA Utils can decompress files with any -.I lc -and -.IR lp , -but always creates files with -.B lc=3 -and -.BR lp=0 . -Creating files with other -.I lc -and -.I lp -is possible with -.B xz -and with LZMA SDK. -.PP -The implementation of the LZMA1 filter in liblzma requires -that the sum of -.I lc -and -.I lp -must not exceed 4. Thus, -.B .lzma -files which exceed this limitation, cannot be decompressed with -.BR xz . -.PP -LZMA Utils creates only -.B .lzma -files which have dictionary size of -.RI "2^" n -(a power of 2), but accepts files with any dictionary size. -liblzma accepts only -.B .lzma -files which have dictionary size of -.RI "2^" n -or -.RI "2^" n " + 2^(" n "\-1)." -This is to decrease false positives when autodetecting -.B .lzma -files. -.PP -These limitations shouldn't be a problem in practice, since practically all -.B .lzma -files have been compressed with settings that liblzma will accept. -.SS "Trailing garbage" -When decompressing, LZMA Utils silently ignore everything after the first -.B .lzma -stream. In most situations, this is a bug. This also means that LZMA Utils -don't support decompressing concatenated -.B .lzma -files. -.PP -If there is data left after the first -.B .lzma -stream, -.B xz -considers the file to be corrupt. This may break obscure scripts which have -assumed that trailing garbage is ignored. -.SH NOTES -.SS Compressed output may vary -The exact compressed output produced from the same uncompressed input file -may vary between XZ Utils versions even if compression options are identical. -This is because the encoder can be improved (faster or better compression) -without affecting the file format. The output can vary even between different -builds of the same XZ Utils version, if different build options are used or -if the endianness of the hardware is different for different builds. -.PP -The above means that implementing -.B \-\-rsyncable -to create rsyncable -.B .xz -files is not going to happen without freezing a part of the encoder -implementation, which can then be used with -.BR \-\-rsyncable . -.SS Embedded .xz decompressors -Embedded -.B .xz -decompressor implementations like XZ Embedded don't necessarily support files -created with -.I check -types other than -.B none -and -.BR crc32 . -Since the default is \fB\-\-check=\fIcrc64\fR, you must use -.B \-\-check=none -or -.B \-\-check=crc32 -when creating files for embedded systems. -.PP -Outside embedded systems, all -.B .xz -format decompressors support all the -.I check -types, or at least are able to decompress the file without verifying the -integrity check if the particular -.I check -is not supported. -.PP -XZ Embedded supports BCJ filters, but only with the default start offset. -.SH "SEE ALSO" -.BR xzdec (1), -.BR gzip (1), -.BR bzip2 (1) -.PP -XZ Utils: <http://tukaani.org/xz/> -.br -XZ Embedded: <http://tukaani.org/xz/embedded.html> -.br -LZMA SDK: <http://7-zip.org/sdk.html> diff --git a/Build/source/extra/xz-4.999.9beta/src/xz/xz_w32res.rc b/Build/source/extra/xz-4.999.9beta/src/xz/xz_w32res.rc deleted file mode 100644 index bad30202991..00000000000 --- a/Build/source/extra/xz-4.999.9beta/src/xz/xz_w32res.rc +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Author: Lasse Collin - * - * This file has been put into the public domain. - * You can do whatever you want with this file. - */ - -#define MY_TYPE VFT_APP -#define MY_NAME "xz" -#define MY_SUFFIX ".exe" -#define MY_DESC "xz data compression tool for .xz and .lzma files" -#include "common_w32res.rc" |