diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:12:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:12:04 +0000 |
commit | eac54b7c4aec25060d7bd856f7cdc290943d6aae (patch) | |
tree | 9a6d81c9f88df4698e746d63d14ddafeddd918b8 /src/scripts | |
parent | Initial commit. (diff) | |
download | xz-utils-eac54b7c4aec25060d7bd856f7cdc290943d6aae.tar.xz xz-utils-eac54b7c4aec25060d7bd856f7cdc290943d6aae.zip |
Adding upstream version 5.4.1.upstream/5.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/scripts')
-rw-r--r-- | src/scripts/Makefile.am | 89 | ||||
-rw-r--r-- | src/scripts/Makefile.in | 700 | ||||
-rw-r--r-- | src/scripts/xzdiff.1 | 79 | ||||
-rw-r--r-- | src/scripts/xzdiff.in | 215 | ||||
-rw-r--r-- | src/scripts/xzgrep.1 | 113 | ||||
-rw-r--r-- | src/scripts/xzgrep.in | 298 | ||||
-rw-r--r-- | src/scripts/xzless.1 | 69 | ||||
-rw-r--r-- | src/scripts/xzless.in | 59 | ||||
-rw-r--r-- | src/scripts/xzmore.1 | 55 | ||||
-rw-r--r-- | src/scripts/xzmore.in | 79 |
10 files changed, 1756 insertions, 0 deletions
diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am new file mode 100644 index 0000000..fe5742d --- /dev/null +++ b/src/scripts/Makefile.am @@ -0,0 +1,89 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +nodist_bin_SCRIPTS = xzdiff xzgrep xzmore xzless +dist_man_MANS = xzdiff.1 xzgrep.1 xzmore.1 xzless.1 + +links = \ + xzdiff-xzcmp \ + xzgrep-xzegrep \ + xzgrep-xzfgrep + +if COND_LZMALINKS +links += \ + xzdiff-lzdiff \ + xzdiff-lzcmp \ + xzgrep-lzgrep \ + xzgrep-lzegrep \ + xzgrep-lzfgrep \ + xzmore-lzmore \ + xzless-lzless +endif + +install-exec-hook: + cd "$(DESTDIR)$(bindir)" && \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ + rm -f "$$link" && \ + $(LN_S) "$$target" "$$link"; \ + done + +# The installation of translated man pages abuses Automake internals +# by calling "install-man" with redefined dist_man_MANS and man_MANS. +# If this breaks some day, don't blame Automake developers. +install-data-hook: + languages= ; \ + if test "$(USE_NLS)" = yes && test -d "$(top_srcdir)/po4a/man"; then \ + languages=`ls "$(top_srcdir)/po4a/man"`; \ + fi; \ + for lang in $$languages; do \ + mans= ; \ + for man in $(dist_man_MANS); do \ + man="$(top_srcdir)/po4a/man/$$lang/$$man" ; \ + if test -f "$$man"; then \ + mans="$$mans $$man"; \ + fi; \ + done; \ + $(MAKE) dist_man_MANS="$$mans" man_MANS= \ + mandir="$(mandir)/$$lang" install-man; \ + done; \ + for lang in . $$languages; do \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' \ + | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' \ + | sed '$(transform)'` && \ + man1dir="$(DESTDIR)$(mandir)/$$lang/man1" && \ + if test -f "$$man1dir/$$target.1"; then ( \ + cd "$$man1dir" && \ + rm -f "$$link.1" && \ + $(LN_S) "$$target.1" "$$link.1" \ + ); fi; \ + done; \ + done + +uninstall-hook: + cd "$(DESTDIR)$(bindir)" && \ + for pair in $(links); do \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ + rm -f "$$link"; \ + done + languages= ; \ + if test "$(USE_NLS)" = yes && test -d "$(top_srcdir)/po4a/man"; then \ + languages=`ls "$(top_srcdir)/po4a/man"`; \ + fi; \ + for lang in . $$languages; do \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' \ + | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' \ + | sed '$(transform)'` && \ + rm -f "$(DESTDIR)$(mandir)/$$lang/man1/$$target.1" \ + "$(DESTDIR)$(mandir)/$$lang/man1/$$link.1"; \ + done; \ + done diff --git a/src/scripts/Makefile.in b/src/scripts/Makefile.in new file mode 100644 index 0000000..42dbfff --- /dev/null +++ b/src/scripts/Makefile.in @@ -0,0 +1,700 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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@ +@COND_LZMALINKS_TRUE@am__append_1 = \ +@COND_LZMALINKS_TRUE@ xzdiff-lzdiff \ +@COND_LZMALINKS_TRUE@ xzdiff-lzcmp \ +@COND_LZMALINKS_TRUE@ xzgrep-lzgrep \ +@COND_LZMALINKS_TRUE@ xzgrep-lzegrep \ +@COND_LZMALINKS_TRUE@ xzgrep-lzfgrep \ +@COND_LZMALINKS_TRUE@ xzmore-lzmore \ +@COND_LZMALINKS_TRUE@ xzless-lzless + +subdir = src/scripts +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_capsicum.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/host-cpu-c-abi.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.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/tuklib_common.m4 \ + $(top_srcdir)/m4/tuklib_cpucores.m4 \ + $(top_srcdir)/m4/tuklib_integer.m4 \ + $(top_srcdir)/m4/tuklib_mbstr.m4 \ + $(top_srcdir)/m4/tuklib_physmem.m4 \ + $(top_srcdir)/m4/tuklib_progname.m4 \ + $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = xzdiff xzgrep xzmore xzless +CONFIG_CLEAN_VPATH_FILES = +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' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +SCRIPTS = $(nodist_bin_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(dist_man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ + $(srcdir)/xzdiff.in $(srcdir)/xzgrep.in $(srcdir)/xzless.in \ + $(srcdir)/xzmore.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAPSICUM_LIB = @CAPSICUM_LIB@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GETOPT_H = @GETOPT_H@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +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_EXEEXT = @LN_EXEEXT@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSIX_SHELL = @POSIX_SHELL@ +POSUB = @POSUB@ +PREFERABLY_POSIX_SHELL = @PREFERABLY_POSIX_SHELL@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +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@ +enable_path_for_scripts = @enable_path_for_scripts@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ +nodist_bin_SCRIPTS = xzdiff xzgrep xzmore xzless +dist_man_MANS = xzdiff.1 xzgrep.1 xzmore.1 xzless.1 +links = xzdiff-xzcmp xzgrep-xzegrep xzgrep-xzfgrep $(am__append_1) +all: all-am + +.SUFFIXES: +$(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/scripts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/scripts/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + 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): +xzdiff: $(top_builddir)/config.status $(srcdir)/xzdiff.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +xzgrep: $(top_builddir)/config.status $(srcdir)/xzgrep.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +xzmore: $(top_builddir)/config.status $(srcdir)/xzmore.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +xzless: $(top_builddir)/config.status $(srcdir)/xzless.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-nodist_binSCRIPTS: $(nodist_bin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(nodist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | 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; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$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_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-nodist_binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(dist_man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(dist_man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | 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,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) $(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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +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-nodist_binSCRIPTS + @$(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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man uninstall-nodist_binSCRIPTS + @$(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: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am 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-nodist_binSCRIPTS install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-hook uninstall-man uninstall-man1 \ + uninstall-nodist_binSCRIPTS + +.PRECIOUS: Makefile + + +install-exec-hook: + cd "$(DESTDIR)$(bindir)" && \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ + rm -f "$$link" && \ + $(LN_S) "$$target" "$$link"; \ + done + +# The installation of translated man pages abuses Automake internals +# by calling "install-man" with redefined dist_man_MANS and man_MANS. +# If this breaks some day, don't blame Automake developers. +install-data-hook: + languages= ; \ + if test "$(USE_NLS)" = yes && test -d "$(top_srcdir)/po4a/man"; then \ + languages=`ls "$(top_srcdir)/po4a/man"`; \ + fi; \ + for lang in $$languages; do \ + mans= ; \ + for man in $(dist_man_MANS); do \ + man="$(top_srcdir)/po4a/man/$$lang/$$man" ; \ + if test -f "$$man"; then \ + mans="$$mans $$man"; \ + fi; \ + done; \ + $(MAKE) dist_man_MANS="$$mans" man_MANS= \ + mandir="$(mandir)/$$lang" install-man; \ + done; \ + for lang in . $$languages; do \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' \ + | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' \ + | sed '$(transform)'` && \ + man1dir="$(DESTDIR)$(mandir)/$$lang/man1" && \ + if test -f "$$man1dir/$$target.1"; then ( \ + cd "$$man1dir" && \ + rm -f "$$link.1" && \ + $(LN_S) "$$target.1" "$$link.1" \ + ); fi; \ + done; \ + done + +uninstall-hook: + cd "$(DESTDIR)$(bindir)" && \ + for pair in $(links); do \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ + rm -f "$$link"; \ + done + languages= ; \ + if test "$(USE_NLS)" = yes && test -d "$(top_srcdir)/po4a/man"; then \ + languages=`ls "$(top_srcdir)/po4a/man"`; \ + fi; \ + for lang in . $$languages; do \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' \ + | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' \ + | sed '$(transform)'` && \ + rm -f "$(DESTDIR)$(mandir)/$$lang/man1/$$target.1" \ + "$(DESTDIR)$(mandir)/$$lang/man1/$$link.1"; \ + done; \ + 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/src/scripts/xzdiff.1 b/src/scripts/xzdiff.1 new file mode 100644 index 0000000..24fed68 --- /dev/null +++ b/src/scripts/xzdiff.1 @@ -0,0 +1,79 @@ +.\" +.\" Original zdiff.1 for gzip: Jean-loup Gailly +.\" +.\" Modifications for XZ Utils: Lasse Collin +.\" Andrew Dudman +.\" +.\" License: GNU GPLv2+ +.\" +.TH XZDIFF 1 "2021-06-04" "Tukaani" "XZ Utils" +.SH NAME +xzcmp, xzdiff, lzcmp, lzdiff \- compare compressed files +.SH SYNOPSIS +.B xzcmp +.RI [ cmp_options "] " file1 " [" file2 ] +.br +.B xzdiff +.RI [ diff_options "] " file1 " [" file2 ] +.br +.B lzcmp +.RI [ cmp_options "] " file1 " [" file2 ] +.br +.B lzdiff +.RI [ diff_options "] " file1 " [" file2 ] +.SH DESCRIPTION +.B xzcmp +and +.B xzdiff +invoke +.BR cmp (1) +or +.BR diff (1) +on files compressed with +.BR xz (1), +.BR lzma (1), +.BR gzip (1), +.BR bzip2 (1), +.BR lzop (1), +or +.BR zstd (1). +All options specified are passed directly to +.BR cmp (1) +or +.BR diff (1). +If only one file is specified, then the files compared are +.I file1 +(which must have a suffix of a supported compression format) and +.I file1 +from which the compression format suffix has been stripped. +If two files are specified, +then they are uncompressed if necessary and fed to +.BR cmp (1) +or +.BR diff (1). +The exit status from +.BR cmp (1) +or +.BR diff (1) +is preserved unless a decompression error occurs; then exit status is 2. +.PP +The names +.B lzcmp +and +.B lzdiff +are provided for backward compatibility with LZMA Utils. +.SH "SEE ALSO" +.BR cmp (1), +.BR diff (1), +.BR xz (1), +.BR gzip (1), +.BR bzip2 (1), +.BR lzop (1), +.BR zstd (1), +.BR zdiff (1) +.SH BUGS +Messages from the +.BR cmp (1) +or +.BR diff (1) +programs refer to temporary filenames instead of those specified. diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in new file mode 100644 index 0000000..c17d78b --- /dev/null +++ b/src/scripts/xzdiff.in @@ -0,0 +1,215 @@ +#!@POSIX_SHELL@ + +# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation +# Copyright (C) 1993 Jean-loup Gailly + +# Modified for XZ Utils by Andrew Dudman and Lasse Collin. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +@enable_path_for_scripts@ +#SET_PATH - This line is a placeholder to ease patching this script. + +# Instead of unsetting XZ_OPT, just make sure that xz will use file format +# autodetection. This way memory usage limit and thread limit can be +# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the +# environment variables. +xz='@xz@ --format=auto' +unset GZIP BZIP BZIP2 LZOP + +case ${0##*/} in + *cmp*) prog=xzcmp; cmp=${CMP:-cmp};; + *) prog=xzdiff; cmp=${DIFF:-diff};; +esac + +version="$prog (@PACKAGE_NAME@) @VERSION@" + +usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2] +Compare FILE1 to FILE2, using their uncompressed contents if they are +compressed. If FILE2 is omitted, then the files compared are FILE1 and +FILE1 from which the compression format suffix has been stripped. + +Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'. + +Report bugs to <@PACKAGE_BUGREPORT@>." + +# sed script to escape all ' for the shell, and then (to handle trailing +# newlines correctly) turn trailing X on last line into '. +escape=' + s/'\''/'\''\\'\'''\''/g + $s/X$/'\''/ +' + +while :; do + case $1 in + --h*) printf '%s\n' "$usage" || exit 2; exit;; + --v*) printf '%s\n' "$version" || exit 2; exit;; + --) shift; break;; + -*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;; + -?*) cmp="$cmp '$1'";; + *) break;; + esac + shift +done +cmp="$cmp --" + +for file; do + test "X$file" = X- || <"$file" || exit 2 +done + +# xz needs -qQ to ignore warnings like unsupported check type. +xz1="$xz -qQ" +xz2="$xz -qQ" +xz_status=0 +exec 3>&1 + +if test $# -eq 1; then + case $1 in + *[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z) + ;; + *[-.]bz2 | *.tbz | *.tbz2) + xz1=bzip2;; + *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) + xz1=gzip;; + *[-.]lzo | *.tzo) + xz1=lzop;; + *[-.]zst | *.tzst) + xz1='zstd -q';; + *) + printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2 + exit 2;; + esac + case $1 in + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst) + FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ2]*$'`;; + *.t[abglx]z) + FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; + *.tbz2) + FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; + *.tzo) + FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;; + *.tzst) + FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;; + esac + xz_status=$( + exec 4>&1 + ($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3 + ) +elif test $# -eq 2; then + case $1 in + *[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;; + *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; + *[-.]lzo | *.tzo) xz1=lzop;; + *[-.]zst | *.tzst) xz1='zstd -q';; + esac + case $2 in + *[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;; + *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;; + *[-.]lzo | *.tzo) xz2=lzop;; + *[-.]zst | *.tzst) xz2='zstd -q';; + esac + case $1 in + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -) + case "$2" in + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -) + if test "$1$2" = --; then + xz_status=$( + exec 4>&1 + ($xz1 -cdf - 4>&-; echo $? >&4) 3>&- | + eval "$cmp" - - >&3 + ) + elif # Reject Solaris 8's buggy /bin/bash 2.03. + echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then + # NOTE: xz_status will contain two numbers. + xz_status=$( + exec 4>&1 + ($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- | + ( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null | + eval "$cmp" /dev/fd/5 - >&3) 5<&0 + ) + else + F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog + tmp= + trap ' + test -n "$tmp" && rm -rf "$tmp" + (exit 2); exit 2 + ' HUP INT PIPE TERM 0 + if type mktemp >/dev/null 2>&1; then + # Note that FreeBSD's mktemp isn't fully compatible with + # the implementations from mktemp.org and GNU coreutils. + # It is important that the -t argument is the last argument + # and that no "--" is used between -t and the template argument. + # This way this command works on all implementations. + tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2 + else + # Fallback code if mktemp is missing. This isn't as + # robust as using mktemp since this doesn't try with + # different file names in case of a file name conflict. + # + # There's no need to save the original umask since + # we don't create any non-temp files. Note that using + # mkdir -m 0077 isn't secure since some mkdir implementations + # create the dir with the default umask and chmod the + # the dir afterwards. + umask 0077 + mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2 + tmp="${TMPDIR-/tmp}/$prog.$$" + fi + $xz2 -cdf -- "$2" > "$tmp/$F" || exit 2 + xz_status=$( + exec 4>&1 + ($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- | + eval "$cmp" - '"$tmp/$F"' >&3 + ) + cmp_status=$? + rm -rf "$tmp" || xz_status=$? + trap - HUP INT PIPE TERM 0 + (exit $cmp_status) + fi;; + *) + xz_status=$( + exec 4>&1 + ($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- | + eval "$cmp" - '"$2"' >&3 + );; + esac;; + *) + case "$2" in + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -) + xz_status=$( + exec 4>&1 + ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- | + eval "$cmp" '"$1"' - >&3 + );; + *) + eval "$cmp" '"$1"' '"$2"';; + esac;; + esac +else + printf '%s\n' "$0: Invalid number of operands; try \`${0##*/} --help' for help" >&2 + exit 2 +fi + +cmp_status=$? +for num in $xz_status ; do + # 0 from decompressor means successful decompression. SIGPIPE from + # decompressor is possible when diff or cmp exits before the whole file + # has been decompressed. In that case we want to retain the exit status + # from diff or cmp. Note that using "trap '' PIPE" is not possible + # because gzip changes its behavior (including exit status) if SIGPIPE + # is ignored. + test "$num" -eq 0 && continue + test "$num" -ge 128 \ + && test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \ + && continue + exit 2 +done +exit $cmp_status diff --git a/src/scripts/xzgrep.1 b/src/scripts/xzgrep.1 new file mode 100644 index 0000000..e0514b8 --- /dev/null +++ b/src/scripts/xzgrep.1 @@ -0,0 +1,113 @@ +.\" +.\" Original zgrep.1 for gzip: Jean-loup Gailly +.\" Charles Levert <charles@comm.polymtl.ca> +.\" +.\" Modifications for XZ Utils: Lasse Collin +.\" +.\" License: GNU GPLv2+ +.\" +.TH XZGREP 1 "2022-07-19" "Tukaani" "XZ Utils" +.SH NAME +xzgrep \- search compressed files for a regular expression +.SH SYNOPSIS +.B xzgrep +.RI [ grep_options ] +.RB [ \-e ] +.I pattern +.RI [ file... ] +.br +.B xzegrep +\&... +.br +.B xzfgrep +\&... +.br +.B lzgrep +\&... +.br +.B lzegrep +\&... +.br +.B lzfgrep +\&... +.SH DESCRIPTION +.B xzgrep +invokes +.BR grep (1) +on +.I files +which may be either uncompressed or compressed with +.BR xz (1), +.BR lzma (1), +.BR gzip (1), +.BR bzip2 (1), +.BR lzop (1), +or +.BR zstd (1). +All options specified are passed directly to +.BR grep (1). +.PP +If no +.I file +is specified, then standard input is decompressed if necessary +and fed to +.BR grep (1). +When reading from standard input, +.BR gzip (1), +.BR bzip2 (1), +.BR lzop (1), +and +.BR zstd (1) +compressed files are not supported. +.PP +If +.B xzgrep +is invoked as +.B xzegrep +or +.B xzfgrep +then +.B grep \-E +or +.B grep \-F +is used instead of +.BR grep (1). +The same applies to names +.BR lzgrep , +.BR lzegrep , +and +.BR lzfgrep , +which are provided for backward compatibility with LZMA Utils. +.SH EXIT STATUS +.TP +0 +At least one match was found from at least one of the input files. +No errors occurred. +.TP +1 +No matches were found from any of the input files. +No errors occurred. +.TP +>1 +One or more errors occurred. +It is unknown if matches were found. +.SH ENVIRONMENT +.TP +.B GREP +If the +.B GREP +environment variable is set, +.B xzgrep +uses it instead of +.BR grep (1), +.BR "grep \-E" , +or +.BR "grep \-F" . +.SH "SEE ALSO" +.BR grep (1), +.BR xz (1), +.BR gzip (1), +.BR bzip2 (1), +.BR lzop (1), +.BR zstd (1), +.BR zgrep (1) diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in new file mode 100644 index 0000000..490e47d --- /dev/null +++ b/src/scripts/xzgrep.in @@ -0,0 +1,298 @@ +#!@POSIX_SHELL@ + +# xzgrep -- a wrapper around a grep program that decompresses files as needed +# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca> + +# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation +# Copyright (C) 1993 Jean-loup Gailly + +# Modified for XZ Utils by Andrew Dudman and Lasse Collin. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +@enable_path_for_scripts@ +#SET_PATH - This line is a placeholder to ease patching this script. + +# Instead of unsetting XZ_OPT, just make sure that xz will use file format +# autodetection. This way memory usage limit and thread limit can be +# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the +# environment variables. +xz='@xz@ --format=auto' +unset GZIP BZIP BZIP2 LZOP + +case ${0##*/} in + *egrep*) prog=xzegrep; grep=${GREP:-grep -E};; + *fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};; + *) prog=xzgrep; grep=${GREP:-grep};; +esac + +version="$prog (@PACKAGE_NAME@) @VERSION@" + +usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]... +Look for instances of PATTERN in the input FILEs, using their +uncompressed contents if they are compressed. + +OPTIONs are the same as for '$grep'. + +Report bugs to <@PACKAGE_BUGREPORT@>." + +# sed script to escape all ' for the shell, and then (to handle trailing +# newlines correctly) turn trailing X on last line into '. +escape=' + s/'\''/'\''\\'\'''\''/g + $s/X$/'\''/ +' +operands= +have_pat=0 +files_with_matches=0 +files_without_matches=0 +no_filename=0 +with_filename=0 + +# See if -H and --label options are supported (GNU and *BSDs). +if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then + grep_supports_label=1 +else + grep_supports_label=0 +fi + +while test $# -ne 0; do + option=$1 + shift + optarg= + + case $option in + (-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*) + # Something like -Fiv was specified, that is, $option contains more + # than one option of which the first option (in this example -F) + # doesn't take an argument. Split the first option into a standalone + # argument and continue parsing the rest of the options (in this example, + # replace -Fiv with -iv in the argument list and set option=-F). + # + # If there are digits [0-9] they are treated as if they were a single + # option character because this syntax is an alias for -C for GNU grep. + # For example, "grep -25F" is equivalent to "grep -C25 -F". If only + # digits are specified like "grep -25" we don't get here because the + # above pattern in the case-statement doesn't match such strings. + arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' | + LC_ALL=C sed "$escape") + eval "set -- $arg2 "'${1+"$@"}' + option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');; + (--binary-*=* | --[lm]a*=* | --reg*=*) + # These options require an argument and an argument has been provided + # with the --foo=argument syntax. All is good. + ;; + (-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*) + # These options require an argument which should now be in $1. + # If it isn't, display an error and exit. + case ${1?"$option option requires an argument"} in + (*\'*) + optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");; + (*) + optarg=" '$1'";; + esac + shift;; + (--) + break;; + (-?*) + ;; + (*) + case $option in + (*\'*) + operands="$operands '"$(printf '%sX\n' "$option" | + LC_ALL=C sed "$escape");; + (*) + operands="$operands '$option'";; + esac + ${POSIXLY_CORRECT+break} + continue;; + esac + + case $option in + (-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*) + printf >&2 '%s: %s: Option not supported\n' "$0" "$option" + exit 2;; + (-[ef]* | --file | --file=* | --reg*) + have_pat=1;; + (--h | --he | --hel | --help) + printf '%s\n' "$usage" || exit 2 + exit;; + (-H | --wi | --wit | --with | --with- | --with-f | --with-fi \ + | --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \ + | --with-filename) + with_filename=1 + continue;; + (-l | --files-with-*) + files_with_matches=1 + continue;; + (-L | --files-witho*) + files_without_matches=1 + continue;; + (-h | --no-f*) + no_filename=1;; + (-V | --v | --ve | --ver | --vers | --versi | --versio | --version) + printf '%s\n' "$version" || exit 2 + exit;; + esac + + case $option in + (*\'?*) + option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");; + (*) + option="'$option'";; + esac + + grep="$grep $option$optarg" +done + +eval "set -- $operands "'${1+"$@"}' + +if test $have_pat -eq 0; then + case ${1?"Missing pattern; try \`${0##*/} --help' for help"} in + (*\'*) + grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");; + (*) + grep="$grep -e '$1'";; + esac + shift +fi + +if test $# -eq 0; then + set -- - +fi + +exec 3>&1 + +# res=1 means that no file matched yet +res=1 + +for i; do + case $i in + *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";; + *[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";; + *[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";; + *[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q. + *) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check. + esac + # xz_status will hold the decompressor's exit status. + # Exit status of grep (and in rare cases, printf or sed) is + # available as the exit status of this assignment command. + xz_status=$( + exec 5>&1 + ($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- | + if test $files_with_matches -eq 1; then + eval "$grep -q" && { printf '%s\n' "$i" || exit 2; } + elif test $files_without_matches -eq 1; then + eval "$grep -q" || { + r=$? + if test $r -eq 1; then + printf '%s\n' "$i" || r=2 + fi + exit $r + } + elif test $with_filename -eq 0 && + { test $# -eq 1 || test $no_filename -eq 1; }; then + eval "$grep" + elif test $grep_supports_label -eq 1; then + # The grep implementation in use allows us to specify the filename + # that grep will prefix to the output lines. This is faster and + # less prone to security bugs than the fallback method that uses sed. + # This also avoids confusing output with GNU grep >= 3.5 (2020-09-27) + # which prints "binary file matches" to stderr instead of stdout. + # + # If reading from stdin, let grep use whatever name it prefers for + # stdin. With GNU grep it is a locale-specific translated string. + if test "x$i" = "x-"; then + eval "$grep -H" + else + eval "$grep -H --label \"\$i\"" + fi + else + # Append a colon so that the last character will never be a newline + # which would otherwise get lost in shell command substitution. + i="$i:" + + # Escape & \ | and newlines only if such characters are present + # (speed optimization). + case $i in + (*' +'* | *'&'* | *'\'* | *'|'*) + # If sed fails, set i to a known safe string to ensure that + # failing sed did not create a half-escaped dangerous string. + i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') || + i='(unknown filename):';; + esac + + # $i already ends with a colon so do not add it here. + sed_script="s|^|$i|" + + # If grep or sed fails, pick the larger value of the two exit statuses. + # If sed fails, use at least 2 since we use >= 2 to indicate errors. + r=$( + exec 4>&1 + (eval "$grep" 4>&-; echo $? >&4) 3>&- | + LC_ALL=C sed "$sed_script" >&3 4>&- + ) || { + sed_status=$? + test "$sed_status" -lt 2 && sed_status=2 + test "$r" -lt "$sed_status" && r=$sed_status + } + exit $r + fi >&3 5>&- + ) + r=$? + + # If grep or sed or other non-decompression command failed with a signal, + # exit immediately and ignore the possible remaining files. + # + # NOTE: Instead of 128 + signal_number, some shells use + # 256 + signal_number (ksh) or 384 + signal_number (yash). + # This is fine for us since their "exit" and "kill -l" commands take + # this into account. (At least the versions I tried do but there is + # a report of an old ksh variant whose "exit" truncates the exit status + # to 8 bits without any special handling for values indicating a signal.) + test "$r" -ge 128 && exit "$r" + + if test -z "$xz_status"; then + # Something unusual happened, for example, we got a signal and + # the exit status of the decompressor was never echoed and thus + # $xz_status is empty. Exit immediately and ignore the possible + # remaining files. + exit 2 + elif test "$xz_status" -ge 128; then + # The decompressor died due to a signal. SIGPIPE is ignored since it can + # occur if grep exits before the whole file has been decompressed (grep -q + # can do that). If the decompressor died with some other signal, exit + # immediately and ignore the possible remaining files. + test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status" + elif test "$xz_status" -gt 0; then + # Decompression failed but we will continue with the remaining + # files anwyway. Set exit status to at least 2 to indicate an error. + test "$r" -lt 2 && r=2 + fi + + # Since res=1 is the initial value, we only need to care about + # matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored. + if test "$r" -ge 2; then + # An error occurred in decompressor, grep, or some other command. Update + # res unless a larger error code has been seen with an earlier file. + test "$res" -lt "$r" && res=$r + elif test "$r" -eq 0; then + # grep found a match and no errors occurred. Update res if no errors have + # occurred with earlier files. + test "$res" -eq 1 && res=0 + fi +done + +# 0: At least one file matched and no errors occurred. +# 1: No matches were found and no errors occurred. +# >=2: Error. It's unknown if matches were found. +exit "$res" diff --git a/src/scripts/xzless.1 b/src/scripts/xzless.1 new file mode 100644 index 0000000..2d05459 --- /dev/null +++ b/src/scripts/xzless.1 @@ -0,0 +1,69 @@ +.\" +.\" Authors: Andrew Dudman +.\" Lasse Collin +.\" +.\" This file has been put into the public domain. +.\" You can do whatever you want with this file. +.\" +.\" (Note that this file is not based on gzip's zless.1.) +.\" +.TH XZLESS 1 "2010-09-27" "Tukaani" "XZ Utils" +.SH NAME +xzless, lzless \- view xz or lzma compressed (text) files +.SH SYNOPSIS +.B xzless +.RI [ file ...] +.br +.B lzless +.RI [ file ...] +.SH DESCRIPTION +.B xzless +is a filter that displays text from compressed files to a terminal. +It works on files compressed with +.BR xz (1) +or +.BR lzma (1). +If no +.I files +are given, +.B xzless +reads from standard input. +.PP +.B xzless +uses +.BR less (1) +to present its output. +Unlike +.BR xzmore , +its choice of pager cannot be altered by +setting an environment variable. +Commands are based on both +.BR more (1) +and +.BR vi (1) +and allow back and forth movement and searching. +See the +.BR less (1) +manual for more information. +.PP +The command named +.B lzless +is provided for backward compatibility with LZMA Utils. +.SH ENVIRONMENT +.TP +.B LESSMETACHARS +A list of characters special to the shell. +Set by +.B xzless +unless it is already set in the environment. +.TP +.B LESSOPEN +Set to a command line to invoke the +.BR xz (1) +decompressor for preprocessing the input files to +.BR less (1). +.SH "SEE ALSO" +.BR less (1), +.BR xz (1), +.BR xzmore (1), +.BR zless (1) diff --git a/src/scripts/xzless.in b/src/scripts/xzless.in new file mode 100644 index 0000000..79a849e --- /dev/null +++ b/src/scripts/xzless.in @@ -0,0 +1,59 @@ +#!@POSIX_SHELL@ + +# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation + +# The original version for gzip was written by Paul Eggert. +# Modified for XZ Utils by Andrew Dudman and Lasse Collin. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +@enable_path_for_scripts@ +#SET_PATH - This line is a placeholder to ease patching this script. + +# Instead of unsetting XZ_OPT, just make sure that xz will use file format +# autodetection. This way memory usage limit and thread limit can be +# specified via XZ_OPT. +xz='@xz@ --format=auto' + +version='xzless (@PACKAGE_NAME@) @VERSION@' + +usage="Usage: ${0##*/} [OPTION]... [FILE]... +Like 'less', but operate on the uncompressed contents of xz compressed FILEs. + +Options are the same as for 'less'. + +Report bugs to <@PACKAGE_BUGREPORT@>." + +case $1 in + --help) printf '%s\n' "$usage" || exit 2; exit;; + --version) printf '%s\n' "$version" || exit 2; exit;; +esac + +if test "${LESSMETACHARS+set}" != set; then + # Work around a bug in less 394 and earlier; + # it mishandles the metacharacters '$%=~'. + space=' ' + tab=' ' + nl=' +' + LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~' +fi + +if test "$(less -V | { read _ ver _ && echo ${ver%%.*}; })" -ge 429; then + # less 429 or later: LESSOPEN pipe will be used on + # standard input if $LESSOPEN begins with |-. + LESSOPEN="|-$xz -cdfqQ -- %s" +else + LESSOPEN="|$xz -cdfqQ -- %s" +fi +export LESSMETACHARS LESSOPEN + +exec less "$@" diff --git a/src/scripts/xzmore.1 b/src/scripts/xzmore.1 new file mode 100644 index 0000000..9613974 --- /dev/null +++ b/src/scripts/xzmore.1 @@ -0,0 +1,55 @@ +.\" +.\" Original zdiff.1 for gzip: Jean-loup Gailly +.\" Modifications for XZ Utils: Lasse Collin +.\" +.\" License: GNU GPLv2+ +.\" +.TH XZMORE 1 "2013-06-30" "Tukaani" "XZ Utils" +.SH NAME +xzmore, lzmore \- view xz or lzma compressed (text) files +.SH SYNOPSIS +.B xzmore +.RI [ file... ] +.br +.B lzmore +.RI [ file... ] +.SH DESCRIPTION +.B xzmore +is a filter which allows examination of +.BR xz (1) +or +.BR lzma (1) +compressed text files one screenful at a time +on a soft-copy terminal. +.PP +To use a pager other than the default +.B more, +set environment variable +.B PAGER +to the name of the desired program. +The name +.B lzmore +is provided for backward compatibility with LZMA Utils. +.TP +.BR e " or " q +When the prompt \-\-More\-\-(Next file: +.IR file ) +is printed, this command causes +.B xzmore +to exit. +.TP +.B s +When the prompt \-\-More\-\-(Next file: +.IR file ) +is printed, this command causes +.B xzmore +to skip the next file and continue. +.PP +For list of keyboard commands supported while actually viewing the +content of a file, refer to manual of the pager you use, usually +.BR more (1). +.SH "SEE ALSO" +.BR more (1), +.BR xz (1), +.BR xzless (1), +.BR zmore (1) diff --git a/src/scripts/xzmore.in b/src/scripts/xzmore.in new file mode 100644 index 0000000..5188fda --- /dev/null +++ b/src/scripts/xzmore.in @@ -0,0 +1,79 @@ +#!@POSIX_SHELL@ + +# Copyright (C) 2001, 2002, 2007 Free Software Foundation +# Copyright (C) 1992, 1993 Jean-loup Gailly + +# Modified for XZ Utils by Andrew Dudman and Lasse Collin. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +@enable_path_for_scripts@ +#SET_PATH - This line is a placeholder to ease patching this script. + +# Instead of unsetting XZ_OPT, just make sure that xz will use file format +# autodetection. This way memory usage limit and thread limit can be +# specified via XZ_OPT. +xz='@xz@ --format=auto' + +version='xzmore (@PACKAGE_NAME@) @VERSION@' + +usage="Usage: ${0##*/} [OPTION]... [FILE]... +Like 'more', but operate on the uncompressed contents of xz compressed FILEs. + +Report bugs to <@PACKAGE_BUGREPORT@>." + +case $1 in + --help) printf '%s\n' "$usage" || exit 2; exit;; + --version) printf '%s\n' "$version" || exit 2; exit;; +esac + +oldtty=`stty -g 2>/dev/null` +if stty -cbreak 2>/dev/null; then + cb='cbreak'; ncb='-cbreak' +else + # 'stty min 1' resets eof to ^a on both SunOS and SysV! + cb='min 1 -icanon'; ncb='icanon eof ^d' +fi +if test $? -eq 0 && test -n "$oldtty"; then + trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15 +else + trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 +fi + +if test $# = 0; then + if test -t 0; then + printf '%s\n' "$usage"; exit 1 + else + $xz -cdfqQ | eval "${PAGER:-more}" + fi +else + FIRST=1 + for FILE; do + < "$FILE" || continue + if test $FIRST -eq 0; then + printf "%s--More--(Next file: %s)" "" "$FILE" + stty $cb -echo 2>/dev/null + ANS=`dd bs=1 count=1 2>/dev/null` + stty $ncb echo 2>/dev/null + echo " " + case "$ANS" in + [eq]) exit;; + esac + fi + if test "$ANS" != 's'; then + printf '%s\n' "------> $FILE <------" + $xz -cdfqQ -- "$FILE" | eval "${PAGER:-more}" + fi + if test -t 1; then + FIRST=0 + fi + done +fi |