Adding upstream version 1.5.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
7373a1f041
commit
97213273e3
30 changed files with 328 additions and 279 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2016-05-15 Antonio Diaz Diaz <antonio@gnu.org>
|
||||||
|
|
||||||
|
* Version 1.5 released.
|
||||||
|
* zupdate.cc (zupdate_file): Pass '-q' to zcmp if verbosity < 0.
|
||||||
|
* zcat.cc zgrep.cc ztest.cc (main): Don't use stdin more than once.
|
||||||
|
* zdiff.cc (set_fifonames): Use '_' if both names are different.
|
||||||
|
* configure: Avoid warning on some shells when testing for g++.
|
||||||
|
* Makefile.in: Detect the existence of install-info.
|
||||||
|
* testsuite/check.sh: A POSIX shell is required to run the tests.
|
||||||
|
|
||||||
2015-05-29 Antonio Diaz Diaz <antonio@gnu.org>
|
2015-05-29 Antonio Diaz Diaz <antonio@gnu.org>
|
||||||
|
|
||||||
* Version 1.4 released.
|
* Version 1.4 released.
|
||||||
|
@ -105,7 +115,7 @@
|
||||||
|
|
||||||
* Version 0.3 released.
|
* Version 0.3 released.
|
||||||
* Removed default compressor.
|
* Removed default compressor.
|
||||||
* zcat.in, zgrep.in: Do not read data from stdin.
|
* zcat.in, zgrep.in: Don't read data from stdin.
|
||||||
* Updated home page and mailing list addresses.
|
* Updated home page and mailing list addresses.
|
||||||
|
|
||||||
2009-08-13 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2009-08-13 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
@ -118,7 +128,7 @@
|
||||||
* Version 0.1 released.
|
* Version 0.1 released.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This file is a collection of facts, and thus it is not copyrightable,
|
This file is a collection of facts, and thus it is not copyrightable,
|
||||||
but just in case, you have unlimited permission to copy, distribute and
|
but just in case, you have unlimited permission to copy, distribute and
|
||||||
|
|
4
INSTALL
4
INSTALL
|
@ -1,7 +1,7 @@
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
You will need a C++ compiler.
|
You will need a C++ compiler.
|
||||||
I use gcc 4.9.1 and 4.1.2, but the code should compile with any
|
I use gcc 5.3.0 and 4.1.2, but the code should compile with any
|
||||||
standards compliant compiler.
|
standards compliant compiler.
|
||||||
Gcc is available at http://gcc.gnu.org.
|
Gcc is available at http://gcc.gnu.org.
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ After running 'configure', you can run 'make' and 'make install' as
|
||||||
explained above.
|
explained above.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This file is free documentation: you have unlimited permission to copy,
|
This file is free documentation: you have unlimited permission to copy,
|
||||||
distribute and modify it.
|
distribute and modify it.
|
||||||
|
|
11
Makefile.in
11
Makefile.in
|
@ -6,6 +6,7 @@ INSTALL_SCRIPT = $(INSTALL) -m 755
|
||||||
INSTALL_DATA = $(INSTALL) -m 644
|
INSTALL_DATA = $(INSTALL) -m 644
|
||||||
INSTALL_DIR = $(INSTALL) -d -m 755
|
INSTALL_DIR = $(INSTALL) -d -m 755
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
CAN_RUN_INSTALLINFO = $(SHELL) -c "install-info --version" > /dev/null 2>&1
|
||||||
|
|
||||||
objs = arg_parser.o rc.o zutils.o \
|
objs = arg_parser.o rc.o zutils.o \
|
||||||
zcat.o zcmp.o zdiff.o zgrep.o ztest.o zupdate.o
|
zcat.o zcmp.o zdiff.o zgrep.o ztest.o zupdate.o
|
||||||
|
@ -109,7 +110,7 @@ $(VPATH)/doc/ztest.1 : ztest
|
||||||
-o $@ --no-info ./ztest
|
-o $@ --no-info ./ztest
|
||||||
|
|
||||||
$(VPATH)/doc/zupdate.1 : zupdate
|
$(VPATH)/doc/zupdate.1 : zupdate
|
||||||
help2man -n 'recompress bzip2, gzip, xz files to lzip files' \
|
help2man -n 'recompress bzip2, gzip, xz files to lzip format' \
|
||||||
-o $@ --no-info ./zupdate
|
-o $@ --no-info ./zupdate
|
||||||
|
|
||||||
Makefile : $(VPATH)/configure $(VPATH)/Makefile.in
|
Makefile : $(VPATH)/configure $(VPATH)/Makefile.in
|
||||||
|
@ -145,7 +146,9 @@ install-info :
|
||||||
if [ ! -d "$(DESTDIR)$(infodir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(infodir)" ; fi
|
if [ ! -d "$(DESTDIR)$(infodir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(infodir)" ; fi
|
||||||
-rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"*
|
-rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"*
|
||||||
$(INSTALL_DATA) $(VPATH)/doc/$(pkgname).info "$(DESTDIR)$(infodir)/$(pkgname).info"
|
$(INSTALL_DATA) $(VPATH)/doc/$(pkgname).info "$(DESTDIR)$(infodir)/$(pkgname).info"
|
||||||
-install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$(pkgname).info"
|
-if $(CAN_RUN_INSTALLINFO) ; then \
|
||||||
|
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$(pkgname).info" ; \
|
||||||
|
fi
|
||||||
|
|
||||||
install-info-compress : install-info
|
install-info-compress : install-info
|
||||||
lzip -v -9 "$(DESTDIR)$(infodir)/$(pkgname).info"
|
lzip -v -9 "$(DESTDIR)$(infodir)/$(pkgname).info"
|
||||||
|
@ -187,7 +190,9 @@ uninstall-bin :
|
||||||
-rm -f "$(DESTDIR)$(sysconfdir)/$(pkgname)rc"
|
-rm -f "$(DESTDIR)$(sysconfdir)/$(pkgname)rc"
|
||||||
|
|
||||||
uninstall-info :
|
uninstall-info :
|
||||||
-install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$(pkgname).info"
|
-if $(CAN_RUN_INSTALLINFO) ; then \
|
||||||
|
install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$(pkgname).info" ; \
|
||||||
|
fi
|
||||||
-rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"*
|
-rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"*
|
||||||
|
|
||||||
uninstall-man :
|
uninstall-man :
|
||||||
|
|
17
NEWS
17
NEWS
|
@ -1,14 +1,9 @@
|
||||||
Changes in version 1.4:
|
Changes in version 1.5:
|
||||||
|
|
||||||
The option "--format" has been renamed to "-O, --force-format".
|
zupdate now passes '-q' to zcmp if specified.
|
||||||
|
|
||||||
Option "-M, --format=<list>" now restricts automatic search to the
|
zcat, zgrep and ztest no longer read from standard input more than once
|
||||||
formats listed in the comma-separated <list>. This change introduces a
|
if '-' is specified multiple times.
|
||||||
backward incompatibility with previous versions of zutils.
|
|
||||||
|
|
||||||
If the pattern begins with "-", zgrep now prepends "-e" before passing
|
zdiff now uses '_' as separator if both temporary file names are
|
||||||
it to grep. ('zgrep -- -pattern file' now works as expected).
|
otherwise different. For example 'xxx_file.lz' and 'xxx_file.gz'.
|
||||||
|
|
||||||
The targets "install-compress", "install-strip-compress",
|
|
||||||
"install-info-compress" and "install-man-compress" have been added to
|
|
||||||
the Makefile.
|
|
||||||
|
|
5
README
5
README
|
@ -12,7 +12,8 @@ those utilities supporting it.
|
||||||
|
|
||||||
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.
|
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.
|
||||||
The supported formats are bzip2, gzip, lzip and xz.
|
The supported formats are bzip2, gzip, lzip and xz.
|
||||||
The compressor to be used for each format is configurable at runtime.
|
Zutils uses external compressors. The compressor to be used for each
|
||||||
|
format is configurable at runtime.
|
||||||
|
|
||||||
zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
||||||
scripts provided by GNU gzip. ztest is unique to zutils. zupdate is
|
scripts provided by GNU gzip. ztest is unique to zutils. zupdate is
|
||||||
|
@ -36,7 +37,7 @@ have been compressed. Decompressed is used to refer to data which has
|
||||||
undergone the process of decompression.
|
undergone the process of decompression.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This file is free documentation: you have unlimited permission to copy,
|
This file is free documentation: you have unlimited permission to copy,
|
||||||
distribute and modify it.
|
distribute and modify it.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
||||||
Copyright (C) 2006-2015 Antonio Diaz Diaz.
|
Copyright (C) 2006-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This library is free software. Redistribution and use in source and
|
This library is free software. Redistribution and use in source and
|
||||||
binary forms, with or without modification, are permitted provided
|
binary forms, with or without modification, are permitted provided
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
||||||
Copyright (C) 2006-2015 Antonio Diaz Diaz.
|
Copyright (C) 2006-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This library is free software. Redistribution and use in source and
|
This library is free software. Redistribution and use in source and
|
||||||
binary forms, with or without modification, are permitted provided
|
binary forms, with or without modification, are permitted provided
|
||||||
|
|
14
configure
vendored
14
configure
vendored
|
@ -1,12 +1,12 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# configure script for Zutils - Utilities dealing with compressed files
|
# configure script for Zutils - Utilities dealing with compressed files
|
||||||
# Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
# Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
#
|
#
|
||||||
# This configure script is free software: you have unlimited permission
|
# This configure script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
|
||||||
pkgname=zutils
|
pkgname=zutils
|
||||||
pkgversion=1.4
|
pkgversion=1.5
|
||||||
srctrigger=doc/${pkgname}.texi
|
srctrigger=doc/${pkgname}.texi
|
||||||
|
|
||||||
# clear some things potentially inherited from environment.
|
# clear some things potentially inherited from environment.
|
||||||
|
@ -28,8 +28,8 @@ DIFF=diff
|
||||||
GREP=grep
|
GREP=grep
|
||||||
|
|
||||||
# checking whether we are using GNU C++.
|
# checking whether we are using GNU C++.
|
||||||
${CXX} --version > /dev/null 2>&1
|
if /bin/sh -c "${CXX} --version" > /dev/null 2>&1 ; then true
|
||||||
if [ $? != 0 ] ; then
|
else
|
||||||
CXX=c++
|
CXX=c++
|
||||||
CXXFLAGS='-W -O2'
|
CXXFLAGS='-W -O2'
|
||||||
fi
|
fi
|
||||||
|
@ -148,7 +148,7 @@ if [ -z "${no_create}" ] ; then
|
||||||
rm -f config.status
|
rm -f config.status
|
||||||
cat > config.status << EOF
|
cat > config.status << EOF
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# This file was generated automatically by configure. Do not edit.
|
# This file was generated automatically by configure. Don't edit.
|
||||||
# Run this file to recreate the current configuration.
|
# Run this file to recreate the current configuration.
|
||||||
#
|
#
|
||||||
# This script is free software: you have unlimited permission
|
# This script is free software: you have unlimited permission
|
||||||
|
@ -177,8 +177,8 @@ echo "GREP = ${GREP}"
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
cat > Makefile << EOF
|
cat > Makefile << EOF
|
||||||
# Makefile for Zutils - Utilities dealing with compressed files
|
# Makefile for Zutils - Utilities dealing with compressed files
|
||||||
# Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
# Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
# This file was generated automatically by configure. Do not edit.
|
# This file was generated automatically by configure. Don't edit.
|
||||||
#
|
#
|
||||||
# This Makefile is free software: you have unlimited permission
|
# This Makefile is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
|
21
doc/zcat.1
21
doc/zcat.1
|
@ -1,19 +1,20 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH ZCAT "1" "May 2015" "zcat (zutils) 1.4" "User Commands"
|
.TH ZCAT "1" "May 2016" "zcat (zutils) 1.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zcat \- decompress and concatenate files to standard output
|
zcat \- decompress and concatenate files to standard output
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B zcat
|
.B zcat
|
||||||
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Zcat copies each given file ("\-" means standard input), to standard
|
Zcat copies each given file to standard output. If any given file is
|
||||||
output. If any given file is compressed, its decompressed content is
|
compressed, its decompressed content is used. If a given file does not
|
||||||
used. If a given file does not exist, and its name does not end with one
|
exist, and its name does not end with one of the known extensions, zcat
|
||||||
of the known extensions, zcat tries the compressed file names
|
tries the compressed file names corresponding to the supported formats.
|
||||||
corresponding to the supported formats. If no files are specified,
|
.PP
|
||||||
data is read from standard input, decompressed if needed, and sent to
|
If no files are specified, or if a file is specified as '\-', data is
|
||||||
standard output. Data read from standard input must be of the same type;
|
read from standard input, decompressed if needed, and sent to standard
|
||||||
all uncompressed or all in the same compression format.
|
output. Data read from standard input must be of the same type; all
|
||||||
|
uncompressed or all in the same compression format.
|
||||||
.PP
|
.PP
|
||||||
The supported formats are bzip2, gzip, lzip and xz.
|
The supported formats are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
|
@ -87,7 +88,7 @@ Report bugs to zutils\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2015 Antonio Diaz Diaz.
|
Copyright \(co 2016 Antonio Diaz Diaz.
|
||||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
14
doc/zcmp.1
14
doc/zcmp.1
|
@ -1,16 +1,16 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH ZCMP "1" "May 2015" "zcmp (zutils) 1.4" "User Commands"
|
.TH ZCMP "1" "May 2016" "zcmp (zutils) 1.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zcmp \- decompress and compare two files byte by byte
|
zcmp \- decompress and compare two files byte by byte
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B zcmp
|
.B zcmp
|
||||||
[\fI\,options\/\fR] \fI\,file1 \/\fR[\fI\,file2\/\fR]
|
[\fI\,options\/\fR] \fI\,file1 \/\fR[\fI\,file2\/\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Zcmp compares two files ("\-" means standard input), and if they
|
Zcmp compares two files ('\-' means standard input), and if they differ,
|
||||||
differ, tells the first byte and line number where they differ. Bytes
|
tells the first byte and line number where they differ. Bytes and lines
|
||||||
and lines are numbered starting with 1. If any given file is compressed,
|
are numbered starting with 1. If any given file is compressed, its
|
||||||
its decompressed content is used. Compressed files are decompressed on
|
decompressed content is used. Compressed files are decompressed on the
|
||||||
the fly; no temporary files are created.
|
fly; no temporary files are created.
|
||||||
.PP
|
.PP
|
||||||
The supported formats are bzip2, gzip, lzip and xz.
|
The supported formats are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
|
@ -85,7 +85,7 @@ Report bugs to zutils\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2015 Antonio Diaz Diaz.
|
Copyright \(co 2016 Antonio Diaz Diaz.
|
||||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH ZDIFF "1" "May 2015" "zdiff (zutils) 1.4" "User Commands"
|
.TH ZDIFF "1" "May 2016" "zdiff (zutils) 1.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zdiff \- decompress and compare two files line by line
|
zdiff \- decompress and compare two files line by line
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B zdiff
|
.B zdiff
|
||||||
[\fI\,options\/\fR] \fI\,file1 \/\fR[\fI\,file2\/\fR]
|
[\fI\,options\/\fR] \fI\,file1 \/\fR[\fI\,file2\/\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Zdiff compares two files ("\-" means standard input), and if they
|
Zdiff compares two files ('\-' means standard input), and if they
|
||||||
differ, shows the differences line by line. If any given file is
|
differ, shows the differences line by line. If any given file is
|
||||||
compressed, its decompressed content is used. Zdiff is a front end to
|
compressed, its decompressed content is used. Zdiff is a front end to
|
||||||
the diff program and has the limitation that messages from diff refer to
|
the diff program and has the limitation that messages from diff refer to
|
||||||
|
@ -109,7 +109,7 @@ Report bugs to zutils\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2015 Antonio Diaz Diaz.
|
Copyright \(co 2016 Antonio Diaz Diaz.
|
||||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
14
doc/zgrep.1
14
doc/zgrep.1
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH ZGREP "1" "May 2015" "zgrep (zutils) 1.4" "User Commands"
|
.TH ZGREP "1" "May 2016" "zgrep (zutils) 1.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zgrep \- search compressed files for a regular expression
|
zgrep \- search compressed files for a regular expression
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -11,10 +11,12 @@ on any combination of compressed and uncompressed files. If any given
|
||||||
file is compressed, its decompressed content is used. If a given file
|
file is compressed, its decompressed content is used. If a given file
|
||||||
does not exist, and its name does not end with one of the known
|
does not exist, and its name does not end with one of the known
|
||||||
extensions, zgrep tries the compressed file names corresponding to the
|
extensions, zgrep tries the compressed file names corresponding to the
|
||||||
supported formats. If no files are specified, data is read from
|
supported formats.
|
||||||
standard input, decompressed if needed, and fed to grep. Data read from
|
.PP
|
||||||
standard input must be of the same type; all uncompressed or all
|
If no files are specified, or if a file is specified as '\-', data is
|
||||||
in the same compression format.
|
read from standard input, decompressed if needed, and fed to grep. Data
|
||||||
|
read from standard input must be of the same type; all uncompressed or
|
||||||
|
all in the same compression format.
|
||||||
.PP
|
.PP
|
||||||
The supported formats are bzip2, gzip, lzip and xz.
|
The supported formats are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
|
@ -133,7 +135,7 @@ Report bugs to zutils\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2015 Antonio Diaz Diaz.
|
Copyright \(co 2016 Antonio Diaz Diaz.
|
||||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
11
doc/ztest.1
11
doc/ztest.1
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH ZTEST "1" "May 2015" "ztest (zutils) 1.4" "User Commands"
|
.TH ZTEST "1" "May 2016" "ztest (zutils) 1.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ztest \- verify integrity of compressed files
|
ztest \- verify integrity of compressed files
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -7,9 +7,10 @@ ztest \- verify integrity of compressed files
|
||||||
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Ztest verifies the integrity of the specified compressed files.
|
Ztest verifies the integrity of the specified compressed files.
|
||||||
Uncompressed files are ignored. If no files are specified, the integrity
|
Uncompressed files are ignored. If no files are specified, or if a file
|
||||||
of compressed data read from standard input is verified. Data read from
|
is specified as '\-', the integrity of compressed data read from standard
|
||||||
standard input must be all in the same compression format.
|
input is verified. Data read from standard input must be all in the same
|
||||||
|
compression format.
|
||||||
.PP
|
.PP
|
||||||
The supported formats are bzip2, gzip, lzip and xz.
|
The supported formats are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
|
@ -61,7 +62,7 @@ Report bugs to zutils\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2015 Antonio Diaz Diaz.
|
Copyright \(co 2016 Antonio Diaz Diaz.
|
||||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH ZUPDATE "1" "May 2015" "zupdate (zutils) 1.4" "User Commands"
|
.TH ZUPDATE "1" "May 2016" "zupdate (zutils) 1.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zupdate \- recompress bzip2, gzip, xz files to lzip files
|
zupdate \- recompress bzip2, gzip, xz files to lzip format
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B zupdate
|
.B zupdate
|
||||||
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
||||||
|
@ -34,7 +34,7 @@ display this help and exit
|
||||||
output version information and exit
|
output version information and exit
|
||||||
.TP
|
.TP
|
||||||
\fB\-f\fR, \fB\-\-force\fR
|
\fB\-f\fR, \fB\-\-force\fR
|
||||||
do not skip a file even if the .lz exists
|
don't skip a file even if the .lz exists
|
||||||
.TP
|
.TP
|
||||||
\fB\-k\fR, \fB\-\-keep\fR
|
\fB\-k\fR, \fB\-\-keep\fR
|
||||||
keep (don't delete) input files
|
keep (don't delete) input files
|
||||||
|
@ -76,7 +76,7 @@ Report bugs to zutils\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2015 Antonio Diaz Diaz.
|
Copyright \(co 2016 Antonio Diaz Diaz.
|
||||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
|
@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
|
||||||
Zutils Manual
|
Zutils Manual
|
||||||
*************
|
*************
|
||||||
|
|
||||||
This manual is for Zutils (version 1.4, 29 May 2015).
|
This manual is for Zutils (version 1.5, 15 May 2016).
|
||||||
|
|
||||||
* Menu:
|
* Menu:
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ This manual is for Zutils (version 1.4, 29 May 2015).
|
||||||
* Concept index:: Index of concepts
|
* Concept index:: Index of concepts
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This manual is free documentation: you have unlimited permission to
|
This manual is free documentation: you have unlimited permission to
|
||||||
copy, distribute and modify it.
|
copy, distribute and modify it.
|
||||||
|
@ -52,7 +52,8 @@ in those utilities supporting it.
|
||||||
|
|
||||||
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.
|
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.
|
||||||
The supported formats are bzip2, gzip, lzip and xz.
|
The supported formats are bzip2, gzip, lzip and xz.
|
||||||
The compressor to be used for each format is configurable at runtime.
|
Zutils uses external compressors. The compressor to be used for each
|
||||||
|
format is configurable at runtime.
|
||||||
|
|
||||||
zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
||||||
scripts provided by GNU gzip. ztest is unique to zutils. zupdate is
|
scripts provided by GNU gzip. ztest is unique to zutils. zupdate is
|
||||||
|
@ -140,7 +141,7 @@ described here.
|
||||||
'--lz=COMMAND'
|
'--lz=COMMAND'
|
||||||
'--xz=COMMAND'
|
'--xz=COMMAND'
|
||||||
Set program (may include arguments) to be used as (de)compressor
|
Set program (may include arguments) to be used as (de)compressor
|
||||||
for the given format. The mane of the program can't begin with
|
for the given format. The name of the program can't begin with
|
||||||
'-'. These options override the values set in 'zutilsrc'. The
|
'-'. These options override the values set in 'zutilsrc'. The
|
||||||
compression program used must meet three requirements:
|
compression program used must meet three requirements:
|
||||||
|
|
||||||
|
@ -163,7 +164,7 @@ File: zutils.info, Node: The zutilsrc file, Next: Zcat, Prev: Common options,
|
||||||
|
|
||||||
'zutilsrc' is the runtime configuration file for zutils. In it you may
|
'zutilsrc' is the runtime configuration file for zutils. In it you may
|
||||||
define the compressor name and options to be used for each format. The
|
define the compressor name and options to be used for each format. The
|
||||||
'zutilsrc' file is optional; you do not need to install it in order to
|
'zutilsrc' file is optional; you don't need to install it in order to
|
||||||
run zutils.
|
run zutils.
|
||||||
|
|
||||||
The compressors specified in the command line override those
|
The compressors specified in the command line override those
|
||||||
|
@ -186,16 +187,15 @@ File: zutils.info, Node: Zcat, Next: Zcmp, Prev: The zutilsrc file, Up: Top
|
||||||
4 Zcat
|
4 Zcat
|
||||||
******
|
******
|
||||||
|
|
||||||
zcat copies each given file ('-' means standard input), to standard
|
zcat copies each given file to standard output. If any given file is
|
||||||
output. If any given file is compressed, its decompressed content is
|
compressed, its decompressed content is used. If a given file does not
|
||||||
used. If a given file does not exist, and its name does not end with one
|
exist, and its name does not end with one of the known extensions, zcat
|
||||||
of the known extensions, zcat tries the compressed file names
|
tries the compressed file names corresponding to the supported formats.
|
||||||
corresponding to the supported formats.
|
|
||||||
|
|
||||||
If no files are specified, data is read from standard input,
|
If no files are specified, or if a file is specified as '-', data is
|
||||||
decompressed if needed, and sent to standard output. Data read from
|
read from standard input, decompressed if needed, and sent to standard
|
||||||
standard input must be of the same type; all uncompressed or all in the
|
output. Data read from standard input must be of the same type; all
|
||||||
same compression format.
|
uncompressed or all in the same compression format.
|
||||||
|
|
||||||
The format for running zcat is:
|
The format for running zcat is:
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ differences were found, and 2 means trouble.
|
||||||
'-s'
|
'-s'
|
||||||
'--quiet'
|
'--quiet'
|
||||||
'--silent'
|
'--silent'
|
||||||
Do not print anything; only return an exit status indicating
|
Don't print anything; only return an exit status indicating
|
||||||
whether the files differ.
|
whether the files differ.
|
||||||
|
|
||||||
|
|
||||||
|
@ -460,10 +460,10 @@ does not exist, and its name does not end with one of the known
|
||||||
extensions, zgrep tries the compressed file names corresponding to the
|
extensions, zgrep tries the compressed file names corresponding to the
|
||||||
supported formats.
|
supported formats.
|
||||||
|
|
||||||
If no files are specified, data is read from standard input,
|
If no files are specified, or if a file is specified as '-', data is
|
||||||
decompressed if needed, and fed to grep. Data read from standard input
|
read from standard input, decompressed if needed, and fed to grep.
|
||||||
must be of the same type; all uncompressed or all in the same
|
Data read from standard input must be of the same type; all uncompressed
|
||||||
compression format.
|
or all in the same compression format.
|
||||||
|
|
||||||
The format for running zgrep is:
|
The format for running zgrep is:
|
||||||
|
|
||||||
|
@ -509,6 +509,9 @@ matches were found, and 2 means trouble.
|
||||||
'-f FILE'
|
'-f FILE'
|
||||||
'--file=FILE'
|
'--file=FILE'
|
||||||
Obtain patterns from FILE, one per line.
|
Obtain patterns from FILE, one per line.
|
||||||
|
When searching in several files at once, command substitution can
|
||||||
|
be used with '-e' to read FILE only once, for example if FILE is
|
||||||
|
not a regular file: 'zgrep -e "$(cat FILE)" file1.lz file2.gz'
|
||||||
|
|
||||||
'-F'
|
'-F'
|
||||||
'--fixed-strings'
|
'--fixed-strings'
|
||||||
|
@ -594,9 +597,10 @@ File: zutils.info, Node: Ztest, Next: Zupdate, Prev: Zgrep, Up: Top
|
||||||
*******
|
*******
|
||||||
|
|
||||||
ztest verifies the integrity of the specified compressed files.
|
ztest verifies the integrity of the specified compressed files.
|
||||||
Uncompressed files are ignored. If no files are specified, the integrity
|
Uncompressed files are ignored. If no files are specified, or if a file
|
||||||
of compressed data read from standard input is verified. Data read from
|
is specified as '-', the integrity of compressed data read from
|
||||||
standard input must be all in the same compression format.
|
standard input is verified. Data read from standard input must be all in
|
||||||
|
the same compression format.
|
||||||
|
|
||||||
Note that some xz files lack integrity information, and therefore
|
Note that some xz files lack integrity information, and therefore
|
||||||
can't be verified as reliably as the other formats can.
|
can't be verified as reliably as the other formats can.
|
||||||
|
@ -642,7 +646,7 @@ File: zutils.info, Node: Zupdate, Next: Problems, Prev: Ztest, Up: Top
|
||||||
*********
|
*********
|
||||||
|
|
||||||
zupdate recompresses files from bzip2, gzip, and xz formats to lzip
|
zupdate recompresses files from bzip2, gzip, and xz formats to lzip
|
||||||
format. The originals are compared with the new files and then deleted.
|
format. Each original is compared with the new file and then deleted.
|
||||||
Only regular files with standard file name extensions are recompressed,
|
Only regular files with standard file name extensions are recompressed,
|
||||||
other files are ignored. Compressed files are decompressed and then
|
other files are ignored. Compressed files are decompressed and then
|
||||||
recompressed on the fly; no temporary files are created. The lzip format
|
recompressed on the fly; no temporary files are created. The lzip format
|
||||||
|
@ -682,7 +686,7 @@ otherwise.
|
||||||
|
|
||||||
'-f'
|
'-f'
|
||||||
'--force'
|
'--force'
|
||||||
Do not skip a file for which a lzip compressed version already
|
Don't skip a file for which a lzip compressed version already
|
||||||
exists. '--force' compares the content of the input file with the
|
exists. '--force' compares the content of the input file with the
|
||||||
content of the existing lzip file and deletes the input file if
|
content of the existing lzip file and deletes the input file if
|
||||||
both contents are identical.
|
both contents are identical.
|
||||||
|
@ -758,17 +762,17 @@ Concept index
|
||||||
Tag Table:
|
Tag Table:
|
||||||
Node: Top222
|
Node: Top222
|
||||||
Node: Introduction1142
|
Node: Introduction1142
|
||||||
Node: Common options3692
|
Node: Common options3726
|
||||||
Ref: compressor-requirements5450
|
Ref: compressor-requirements5484
|
||||||
Node: The zutilsrc file5822
|
Node: The zutilsrc file5856
|
||||||
Node: Zcat6748
|
Node: Zcat6781
|
||||||
Node: Zcmp8795
|
Node: Zcmp8834
|
||||||
Node: Zdiff11255
|
Node: Zdiff11293
|
||||||
Node: Zgrep13895
|
Node: Zgrep13933
|
||||||
Node: Ztest16990
|
Node: Ztest17271
|
||||||
Node: Zupdate18494
|
Node: Zupdate18809
|
||||||
Node: Problems21369
|
Node: Problems21681
|
||||||
Node: Concept index21903
|
Node: Concept index22215
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
@finalout
|
@finalout
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
|
|
||||||
@set UPDATED 29 May 2015
|
@set UPDATED 15 May 2016
|
||||||
@set VERSION 1.4
|
@set VERSION 1.5
|
||||||
|
|
||||||
@dircategory Data Compression
|
@dircategory Data Compression
|
||||||
@direntry
|
@direntry
|
||||||
|
@ -49,7 +49,7 @@ This manual is for Zutils (version @value{VERSION}, @value{UPDATED}).
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@sp 1
|
@sp 1
|
||||||
Copyright @copyright{} 2009-2015 Antonio Diaz Diaz.
|
Copyright @copyright{} 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This manual is free documentation: you have unlimited permission
|
This manual is free documentation: you have unlimited permission
|
||||||
to copy, distribute and modify it.
|
to copy, distribute and modify it.
|
||||||
|
@ -72,7 +72,8 @@ in those utilities supporting it.
|
||||||
@noindent
|
@noindent
|
||||||
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.@*
|
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.@*
|
||||||
The supported formats are bzip2, gzip, lzip and xz.@*
|
The supported formats are bzip2, gzip, lzip and xz.@*
|
||||||
The compressor to be used for each format is configurable at runtime.
|
Zutils uses external compressors. The compressor to be used for each
|
||||||
|
format is configurable at runtime.
|
||||||
|
|
||||||
zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
||||||
scripts provided by GNU gzip. ztest is unique to zutils. zupdate is
|
scripts provided by GNU gzip. ztest is unique to zutils. zupdate is
|
||||||
|
@ -164,7 +165,7 @@ Don't read the runtime configuration file @samp{zutilsrc}.
|
||||||
@itemx --lz=@var{command}
|
@itemx --lz=@var{command}
|
||||||
@itemx --xz=@var{command}
|
@itemx --xz=@var{command}
|
||||||
Set program (may include arguments) to be used as (de)compressor for the
|
Set program (may include arguments) to be used as (de)compressor for the
|
||||||
given format. The mane of the program can't begin with @samp{-}. These
|
given format. The name of the program can't begin with @samp{-}. These
|
||||||
options override the values set in @file{zutilsrc}. The compression
|
options override the values set in @file{zutilsrc}. The compression
|
||||||
program used must meet three requirements:
|
program used must meet three requirements:
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ It must return 0 if no errors occurred, and a non-zero value otherwise.
|
||||||
|
|
||||||
@file{zutilsrc} is the runtime configuration file for zutils. In it you
|
@file{zutilsrc} is the runtime configuration file for zutils. In it you
|
||||||
may define the compressor name and options to be used for each format.
|
may define the compressor name and options to be used for each format.
|
||||||
The @file{zutilsrc} file is optional; you do not need to install it in
|
The @file{zutilsrc} file is optional; you don't need to install it in
|
||||||
order to run zutils.
|
order to run zutils.
|
||||||
|
|
||||||
The compressors specified in the command line override those specified
|
The compressors specified in the command line override those specified
|
||||||
|
@ -217,16 +218,15 @@ where <format> is one of @samp{bz2}, @samp{gz}, @samp{lz} or @samp{xz}.
|
||||||
@chapter Zcat
|
@chapter Zcat
|
||||||
@cindex zcat
|
@cindex zcat
|
||||||
|
|
||||||
zcat copies each given file (@samp{-} means standard input), to standard
|
zcat copies each given file to standard output. If any given file is
|
||||||
output. If any given file is compressed, its decompressed content is
|
compressed, its decompressed content is used. If a given file does not
|
||||||
used. If a given file does not exist, and its name does not end with one
|
exist, and its name does not end with one of the known extensions, zcat
|
||||||
of the known extensions, zcat tries the compressed file names
|
tries the compressed file names corresponding to the supported formats.
|
||||||
corresponding to the supported formats.
|
|
||||||
|
|
||||||
If no files are specified, data is read from standard input,
|
If no files are specified, or if a file is specified as @samp{-}, data
|
||||||
decompressed if needed, and sent to standard output. Data read from
|
is read from standard input, decompressed if needed, and sent to
|
||||||
standard input must be of the same type; all uncompressed or all in the
|
standard output. Data read from standard input must be of the same type;
|
||||||
same compression format.
|
all uncompressed or all in the same compression format.
|
||||||
|
|
||||||
The format for running zcat is:
|
The format for running zcat is:
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ without verifying its format, and the exact file names of both
|
||||||
@itemx -s
|
@itemx -s
|
||||||
@itemx --quiet
|
@itemx --quiet
|
||||||
@itemx --silent
|
@itemx --silent
|
||||||
Do not print anything; only return an exit status indicating whether the
|
Don't print anything; only return an exit status indicating whether the
|
||||||
files differ.
|
files differ.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
@ -510,10 +510,10 @@ does not exist, and its name does not end with one of the known
|
||||||
extensions, zgrep tries the compressed file names corresponding to the
|
extensions, zgrep tries the compressed file names corresponding to the
|
||||||
supported formats.
|
supported formats.
|
||||||
|
|
||||||
If no files are specified, data is read from standard input,
|
If no files are specified, or if a file is specified as @samp{-}, data
|
||||||
decompressed if needed, and fed to grep. Data read from standard input
|
is read from standard input, decompressed if needed, and fed to grep.
|
||||||
must be of the same type; all uncompressed or all in the same
|
Data read from standard input must be of the same type; all uncompressed
|
||||||
compression format.
|
or all in the same compression format.
|
||||||
|
|
||||||
The format for running zgrep is:
|
The format for running zgrep is:
|
||||||
|
|
||||||
|
@ -562,7 +562,11 @@ Treat @var{pattern} as an extended regular expression.
|
||||||
|
|
||||||
@item -f @var{file}
|
@item -f @var{file}
|
||||||
@itemx --file=@var{file}
|
@itemx --file=@var{file}
|
||||||
Obtain patterns from @var{file}, one per line.
|
Obtain patterns from @var{file}, one per line.@*
|
||||||
|
When searching in several files at once, command substitution can be
|
||||||
|
used with @code{-e} to read @var{file} only once, for example if
|
||||||
|
@var{file} is not a regular file:
|
||||||
|
@w{@code{zgrep -e "$(cat @var{file})" file1.lz file2.gz}}
|
||||||
|
|
||||||
@item -F
|
@item -F
|
||||||
@itemx --fixed-strings
|
@itemx --fixed-strings
|
||||||
|
@ -648,9 +652,10 @@ Match only whole lines.
|
||||||
@cindex ztest
|
@cindex ztest
|
||||||
|
|
||||||
ztest verifies the integrity of the specified compressed files.
|
ztest verifies the integrity of the specified compressed files.
|
||||||
Uncompressed files are ignored. If no files are specified, the integrity
|
Uncompressed files are ignored. If no files are specified, or if a file
|
||||||
of compressed data read from standard input is verified. Data read from
|
is specified as @samp{-}, the integrity of compressed data read from
|
||||||
standard input must be all in the same compression format.
|
standard input is verified. Data read from standard input must be all in
|
||||||
|
the same compression format.
|
||||||
|
|
||||||
Note that some xz files lack integrity information, and therefore can't
|
Note that some xz files lack integrity information, and therefore can't
|
||||||
be verified as reliably as the other formats can.
|
be verified as reliably as the other formats can.
|
||||||
|
@ -700,7 +705,7 @@ Further -v's increase the verbosity level.
|
||||||
@cindex zupdate
|
@cindex zupdate
|
||||||
|
|
||||||
zupdate recompresses files from bzip2, gzip, and xz formats to lzip
|
zupdate recompresses files from bzip2, gzip, and xz formats to lzip
|
||||||
format. The originals are compared with the new files and then deleted.
|
format. Each original is compared with the new file and then deleted.
|
||||||
Only regular files with standard file name extensions are recompressed,
|
Only regular files with standard file name extensions are recompressed,
|
||||||
other files are ignored. Compressed files are decompressed and then
|
other files are ignored. Compressed files are decompressed and then
|
||||||
recompressed on the fly; no temporary files are created. The lzip format
|
recompressed on the fly; no temporary files are created. The lzip format
|
||||||
|
@ -745,7 +750,7 @@ zupdate supports the following options:
|
||||||
@table @code
|
@table @code
|
||||||
@item -f
|
@item -f
|
||||||
@itemx --force
|
@itemx --force
|
||||||
Do not skip a file for which a lzip compressed version already exists.
|
Don't skip a file for which a lzip compressed version already exists.
|
||||||
@samp{--force} compares the content of the input file with the content
|
@samp{--force} compares the content of the input file with the content
|
||||||
of the existing lzip file and deletes the input file if both contents
|
of the existing lzip file and deletes the input file if both contents
|
||||||
are identical.
|
are identical.
|
||||||
|
|
35
rc.cc
35
rc.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Zutils - Utilities dealing with compressed files
|
/* Zutils - Utilities dealing with compressed files
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -37,7 +37,7 @@ int verbosity = 0;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const char * const config_file_name = "zutilsrc";
|
const char * const config_file_name = "zutilsrc";
|
||||||
const char * const program_year = "2015";
|
const char * const program_year = "2016";
|
||||||
|
|
||||||
std::string compressor_names[num_formats] =
|
std::string compressor_names[num_formats] =
|
||||||
{ "bzip2", "gzip", "lzip", "xz" }; // default compressor names
|
{ "bzip2", "gzip", "lzip", "xz" }; // default compressor names
|
||||||
|
@ -173,7 +173,7 @@ bool parse_rc_line( const std::string & line,
|
||||||
while( i < len && std::isspace( line[i] ) ) ++i; // strip spaces
|
while( i < len && std::isspace( line[i] ) ) ++i; // strip spaces
|
||||||
if( i <= 0 || i >= len || line[i] != '=' )
|
if( i <= 0 || i >= len || line[i] != '=' )
|
||||||
{ if( verbosity >= 0 )
|
{ if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s %d: missing '='.\n", filename, linenum );
|
std::fprintf( stderr, "%s %d: missing '='\n", filename, linenum );
|
||||||
return false; }
|
return false; }
|
||||||
++i; // skip the '='
|
++i; // skip the '='
|
||||||
if( !parse_compressor_command( line, i, format_index ) )
|
if( !parse_compressor_command( line, i, format_index ) )
|
||||||
|
@ -334,26 +334,23 @@ void show_version()
|
||||||
|
|
||||||
void show_error( const char * const msg, const int errcode, const bool help )
|
void show_error( const char * const msg, const int errcode, const bool help )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity < 0 ) return;
|
||||||
|
if( msg && msg[0] )
|
||||||
{
|
{
|
||||||
if( msg && msg[0] )
|
std::fprintf( stderr, "%s: %s", program_name, msg );
|
||||||
{
|
if( errcode > 0 ) std::fprintf( stderr, ": %s", std::strerror( errcode ) );
|
||||||
std::fprintf( stderr, "%s: %s", program_name, msg );
|
std::fputc( '\n', stderr );
|
||||||
if( errcode > 0 )
|
|
||||||
std::fprintf( stderr, ": %s.", std::strerror( errcode ) );
|
|
||||||
std::fprintf( stderr, "\n" );
|
|
||||||
}
|
|
||||||
if( help )
|
|
||||||
std::fprintf( stderr, "Try '%s --help' for more information.\n",
|
|
||||||
invocation_name );
|
|
||||||
}
|
}
|
||||||
|
if( help )
|
||||||
|
std::fprintf( stderr, "Try '%s --help' for more information.\n",
|
||||||
|
invocation_name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void show_error2( const char * const msg, const char * const name )
|
void show_error2( const char * const msg, const char * const name )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: %s '%s': %s.\n",
|
std::fprintf( stderr, "%s: %s '%s': %s\n",
|
||||||
program_name, msg, name, std::strerror( errno ) );
|
program_name, msg, name, std::strerror( errno ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +366,7 @@ void internal_error( const char * const msg )
|
||||||
void show_close_error( const char * const prog_name )
|
void show_close_error( const char * const prog_name )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't close output of %s: %s.\n",
|
std::fprintf( stderr, "%s: Can't close output of %s: %s\n",
|
||||||
program_name, prog_name, std::strerror( errno ) );
|
program_name, prog_name, std::strerror( errno ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +374,7 @@ void show_close_error( const char * const prog_name )
|
||||||
void show_exec_error( const char * const prog_name )
|
void show_exec_error( const char * const prog_name )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't exec '%s': %s.\n",
|
std::fprintf( stderr, "%s: Can't exec '%s': %s\n",
|
||||||
program_name, prog_name, std::strerror( errno ) );
|
program_name, prog_name, std::strerror( errno ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +382,7 @@ void show_exec_error( const char * const prog_name )
|
||||||
void show_fork_error( const char * const prog_name )
|
void show_fork_error( const char * const prog_name )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't fork '%s': %s.\n",
|
std::fprintf( stderr, "%s: Can't fork '%s': %s\n",
|
||||||
program_name, prog_name, std::strerror( errno ) );
|
program_name, prog_name, std::strerror( errno ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +396,7 @@ int wait_for_child( const pid_t pid, const char * const name,
|
||||||
if( errno != EINTR )
|
if( errno != EINTR )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Error waiting termination of '%s': %s.\n",
|
std::fprintf( stderr, "%s: Error waiting termination of '%s': %s\n",
|
||||||
program_name, name, std::strerror( errno ) );
|
program_name, name, std::strerror( errno ) );
|
||||||
_exit( eretval );
|
_exit( eretval );
|
||||||
}
|
}
|
||||||
|
|
2
rc.h
2
rc.h
|
@ -1,5 +1,5 @@
|
||||||
/* Zutils - Utilities dealing with compressed files
|
/* Zutils - Utilities dealing with compressed files
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Zutils - Utilities dealing with compressed files
|
/* Zutils - Utilities dealing with compressed files
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# check script for Zutils - Utilities dealing with compressed files
|
# check script for Zutils - Utilities dealing with compressed files
|
||||||
# Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
# Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
#
|
#
|
||||||
# This script is free software: you have unlimited permission
|
# This script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
@ -27,9 +27,16 @@ if [ ! -f "${ZUPDATE}" ] || [ ! -x "${ZUPDATE}" ] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e "${ZUPDATE}" ] 2> /dev/null ; then true
|
||||||
|
else
|
||||||
|
echo "$0: a POSIX shell is required to run the tests"
|
||||||
|
echo "Try bash -c \"$0 $1 $2\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d tmp ] ; then rm -rf tmp ; fi
|
if [ -d tmp ] ; then rm -rf tmp ; fi
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
cd "${objdir}"/tmp
|
cd "${objdir}"/tmp || framework_failure
|
||||||
|
|
||||||
for i in ${compressors}; do
|
for i in ${compressors}; do
|
||||||
cat "${testdir}"/test.txt > in || framework_failure
|
cat "${testdir}"/test.txt > in || framework_failure
|
||||||
|
@ -75,6 +82,9 @@ printf .
|
||||||
"${ZCAT}" -N < in.lz > copy || fail=1
|
"${ZCAT}" -N < in.lz > copy || fail=1
|
||||||
cmp in copy || fail=1
|
cmp in copy || fail=1
|
||||||
printf .
|
printf .
|
||||||
|
"${ZCAT}" -N -O lz - - < in.lz > copy || fail=1
|
||||||
|
cmp in copy || fail=1
|
||||||
|
printf .
|
||||||
"${ZCAT}" -N --lz='lzip -q' < in.lz > copy || fail=1
|
"${ZCAT}" -N --lz='lzip -q' < in.lz > copy || fail=1
|
||||||
cmp in copy || fail=1
|
cmp in copy || fail=1
|
||||||
printf .
|
printf .
|
||||||
|
@ -87,25 +97,23 @@ printf .
|
||||||
"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > copy || fail=1
|
"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > copy || fail=1
|
||||||
cmp in6 copy || fail=1
|
cmp in6 copy || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZCAT}" -N --format= in.lz 2> /dev/null
|
"${ZCAT}" -Nq --format=, in.lz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --format=, in.lz 2> /dev/null
|
"${ZCAT}" -Nq --format=,lz in.lz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --format=,lz in.lz 2> /dev/null
|
"${ZCAT}" -Nq --format=gz,,lz in.lz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --format=gz,,lz in.lz 2> /dev/null
|
"${ZCAT}" -Nq --format=lz,, in.lz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --format=lz,, in.lz 2> /dev/null
|
"${ZCAT}" -Nq --format=nc in.lz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --format=nc in.lz 2> /dev/null
|
"${ZCAT}" -Nq --lz='-lzip -q' in.lz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
|
||||||
"${ZCAT}" -N --lz='-lzip -q' in.lz 2> /dev/null
|
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --force-format=gz in.bz2 2> /dev/null
|
"${ZCAT}" -N --force-format=gz in.bz2 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --force-format=bz2 in.lz 2> /dev/null
|
"${ZCAT}" -N --force-format=bz2 in.lz 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --force-format=lz in.gz 2> /dev/null
|
"${ZCAT}" -Nq --force-format=lz in.gz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCAT}" -N --bad-option 2> /dev/null
|
"${ZCAT}" -N --bad-option 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
@ -130,16 +138,16 @@ for i in ${extensions}; do
|
||||||
printf .
|
printf .
|
||||||
done
|
done
|
||||||
|
|
||||||
"${ZCMP}" -N in in6 2> /dev/null
|
"${ZCMP}" -Nq in in6
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCMP}" -N -n 0 in in6 || fail=1
|
"${ZCMP}" -N -n 0 in in6 || fail=1
|
||||||
"${ZCMP}" -N -n 100 in in6 || fail=1
|
"${ZCMP}" -N -n 100 in in6 || fail=1
|
||||||
"${ZCMP}" -N -n 1000 in in6 || fail=1
|
"${ZCMP}" -N -n 1000 in in6 || fail=1
|
||||||
"${ZCMP}" -N -n 10000 in in6 || fail=1
|
"${ZCMP}" -N -n 10000 in in6 || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZCMP}" -N in.tar pin.tar > /dev/null
|
"${ZCMP}" -Nq in.tar pin.tar
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCMP}" -N -i 0,11 in.tar pin.tar 2> /dev/null
|
"${ZCMP}" -Nq -i 0,11 in.tar pin.tar
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCMP}" -N -i 0,11 -n 0 in.tar pin.tar || fail=1
|
"${ZCMP}" -N -i 0,11 -n 0 in.tar pin.tar || fail=1
|
||||||
"${ZCMP}" -N -i 0,11 -n 100 in.tar pin.tar || fail=1
|
"${ZCMP}" -N -i 0,11 -n 100 in.tar pin.tar || fail=1
|
||||||
|
@ -184,10 +192,10 @@ printf .
|
||||||
printf .
|
printf .
|
||||||
"${ZCMP}" -N -q --force-format=lz in.lz
|
"${ZCMP}" -N -q --force-format=lz in.lz
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCMP}" -N --force-format=lz in.gz in.lz 2> /dev/null
|
"${ZCMP}" -Nq --force-format=lz in.gz in.lz
|
||||||
r=$?
|
r=$?
|
||||||
if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCMP}" -N -n -1 in in 2> /dev/null
|
"${ZCMP}" -Nq -n -1 in in
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZCMP}" -N --bad-option in in 2> /dev/null
|
"${ZCMP}" -N --bad-option in in 2> /dev/null
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
@ -263,17 +271,17 @@ if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
|
||||||
mkdir tmp2
|
mkdir tmp2
|
||||||
cat in > tmp2/x || framework_failure
|
cat in > tmp2/a || framework_failure
|
||||||
cat in.lz > tmp2/x.lz || framework_failure
|
cat in.lz > tmp2/a.lz || framework_failure
|
||||||
"${ZDIFF}" -N --format=bz2 tmp2/x < /dev/null > /dev/null
|
"${ZDIFF}" -N --format=bz2 tmp2/a < /dev/null > /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZDIFF}" -N --format=gz tmp2/x < /dev/null > /dev/null
|
"${ZDIFF}" -N --format=gz tmp2/a < /dev/null > /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZDIFF}" -N --format=lz tmp2/x.lz < /dev/null > /dev/null
|
"${ZDIFF}" -N --format=lz tmp2/a.lz < /dev/null > /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZDIFF}" -N --format=lz tmp2/x < /dev/null
|
"${ZDIFF}" -N --format=lz tmp2/a < /dev/null
|
||||||
if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZDIFF}" -N --format=un tmp2/x.lz < /dev/null
|
"${ZDIFF}" -N --format=un tmp2/a.lz < /dev/null
|
||||||
if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
rm -r tmp2 || framework_failure
|
rm -r tmp2 || framework_failure
|
||||||
|
|
||||||
|
@ -303,7 +311,7 @@ for i in ${extensions}; do
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
done
|
done
|
||||||
|
|
||||||
"${ZGREP}" -N "GNU" pin.tar > /dev/null || fail=1
|
"${ZGREP}" -N pin.tar -e "GNU" > /dev/null || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZGREP}" -N "GNU" < pin.tar > /dev/null || fail=1
|
"${ZGREP}" -N "GNU" < pin.tar > /dev/null || fail=1
|
||||||
printf .
|
printf .
|
||||||
|
@ -311,11 +319,13 @@ printf .
|
||||||
printf .
|
printf .
|
||||||
"${ZGREP}" -N "nx_pattern" -r . in > /dev/null
|
"${ZGREP}" -N "nx_pattern" -r . in > /dev/null
|
||||||
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZGREP}" -N "GNU" in > /dev/null || fail=1
|
"${ZGREP}" -N -e "GNU" in > /dev/null || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZGREP}" -N "GNU" < in > /dev/null || fail=1
|
"${ZGREP}" -N "GNU" < in > /dev/null || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZGREP}" -N "GNU" --lz='lzip -q' < in.lz > /dev/null || fail=1
|
"${ZGREP}" -N -O lz "nx_pattern" - - < in.lz > /dev/null
|
||||||
|
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
"${ZGREP}" -N -e "-free" --lz='lzip -q' < in.lz > /dev/null || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZGREP}" -N -- "-free" -in- > /dev/null || fail=1
|
"${ZGREP}" -N -- "-free" -in- > /dev/null || fail=1
|
||||||
printf .
|
printf .
|
||||||
|
@ -363,15 +373,17 @@ printf .
|
||||||
printf .
|
printf .
|
||||||
"${ZTEST}" -N < in.lz || fail=1
|
"${ZTEST}" -N < in.lz || fail=1
|
||||||
printf .
|
printf .
|
||||||
|
"${ZTEST}" -N - in.gz - < in.lz || fail=1
|
||||||
|
printf .
|
||||||
"${ZTEST}" -N --lz='lzip -q' < in.lz || fail=1
|
"${ZTEST}" -N --lz='lzip -q' < in.lz || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZTEST}" -N -r . || fail=1
|
"${ZTEST}" -N -r . || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${ZTEST}" -N < in 2> /dev/null
|
"${ZTEST}" -Nq < in
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
dd if=in.lz bs=1000 count=1 2> /dev/null | "${ZTEST}" -N -q
|
dd if=in.lz bs=1000 count=1 2> /dev/null | "${ZTEST}" -N -q
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZTEST}" -N --force-format=lz in.bz2 2> /dev/null
|
"${ZTEST}" -Nq --force-format=lz in.bz2
|
||||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZTEST}" -N --lz='lzip --bad-option' in.lz 2> /dev/null
|
"${ZTEST}" -N --lz='lzip --bad-option' in.lz 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
@ -381,86 +393,86 @@ if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
|
||||||
printf "\ntesting zupdate-%s..." "$2"
|
printf "\ntesting zupdate-%s..." "$2"
|
||||||
|
|
||||||
cat in.bz2 > x.bz2 || framework_failure
|
cat in.bz2 > a.bz2 || framework_failure
|
||||||
cat in.gz > x.gz || framework_failure
|
cat in.gz > a.gz || framework_failure
|
||||||
"${ZUPDATE}" -N --bz2=bad_command x.bz2 2> /dev/null
|
"${ZUPDATE}" -Nq --bz2=bad_command a.bz2
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZUPDATE}" -N --bz2='bzip2 --bad-option' x.bz2 > /dev/null 2>&1
|
"${ZUPDATE}" -N --bz2='bzip2 --bad-option' a.bz2 > /dev/null 2>&1
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZUPDATE}" -N --gz=bad_command x.gz 2> /dev/null
|
"${ZUPDATE}" -Nq --gz=bad_command a.gz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZUPDATE}" -N --gz='gzip --bad-option' x.gz 2> /dev/null
|
"${ZUPDATE}" -N --gz='gzip --bad-option' a.gz 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZUPDATE}" -N --lz=bad_command x.gz 2> /dev/null
|
"${ZUPDATE}" -Nq --lz=bad_command a.gz
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZUPDATE}" -N --lz='lzip --bad-option' x.gz 2> /dev/null
|
"${ZUPDATE}" -N --lz='lzip --bad-option' a.gz 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
"${ZUPDATE}" -N --bad-option 2> /dev/null
|
"${ZUPDATE}" -N --bad-option 2> /dev/null
|
||||||
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||||
|
|
||||||
cat in.lz in.lz > x.lz || framework_failure
|
cat in.lz in.lz > a.lz || framework_failure
|
||||||
"${ZUPDATE}" -N -f x.bz2 x.gz 2> /dev/null
|
"${ZUPDATE}" -Nq -f a.bz2 a.gz
|
||||||
if [ $? = 1 ] && [ -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
|
if [ $? = 1 ] && [ -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
|
|
||||||
"${ZUPDATE}" -N x.bz2
|
"${ZUPDATE}" -N a.bz2
|
||||||
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
|
if [ $? = 0 ] && [ ! -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
"${ZUPDATE}" -N x.gz
|
"${ZUPDATE}" -N a.gz
|
||||||
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ ! -e x.gz ] && [ -e x.lz ] ; then printf .
|
if [ $? = 0 ] && [ ! -e a.bz2 ] && [ ! -e a.gz ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
|
|
||||||
cat in.bz2 > x.bz2 || framework_failure
|
cat in.bz2 > a.bz2 || framework_failure
|
||||||
cat in.gz > x.gz || framework_failure
|
cat in.gz > a.gz || framework_failure
|
||||||
"${ZUPDATE}" -N x.bz2 x.gz 2> /dev/null
|
"${ZUPDATE}" -Nq a.bz2 a.gz
|
||||||
if [ $? = 1 ] && [ ! -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
|
if [ $? = 1 ] && [ ! -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
|
|
||||||
cat in.bz2 > x.bz2 || framework_failure
|
cat in.bz2 > a.bz2 || framework_failure
|
||||||
cat in.gz > x.gz || framework_failure
|
cat in.gz > a.gz || framework_failure
|
||||||
"${ZUPDATE}" -N -f -k x.bz2 x.gz
|
"${ZUPDATE}" -N -f -k a.bz2 a.gz
|
||||||
if [ $? = 0 ] && [ -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
|
if [ $? = 0 ] && [ -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
|
|
||||||
cat in.bz2 > x.bz2 || framework_failure
|
cat in.bz2 > a.bz2 || framework_failure
|
||||||
cat in.gz > x.gz || framework_failure
|
cat in.gz > a.gz || framework_failure
|
||||||
"${ZUPDATE}" -N -f x.bz2 x.gz
|
"${ZUPDATE}" -N -f a.bz2 a.gz
|
||||||
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ ! -e x.gz ] &&
|
if [ $? = 0 ] && [ ! -e a.bz2 ] && [ ! -e a.gz ] &&
|
||||||
[ ! -e x ] && [ -e x.lz ] ; then printf .
|
[ ! -e a ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
|
|
||||||
cat in.bz2 > x.bz2 || framework_failure
|
cat in.bz2 > a.bz2 || framework_failure
|
||||||
"${ZUPDATE}" -N -1 -q x.bz2
|
"${ZUPDATE}" -N -1 -q a.bz2
|
||||||
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ -e x.lz ] ; then printf .
|
if [ $? = 0 ] && [ ! -e a.bz2 ] && [ -e a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f x.lz || framework_failure
|
rm -f a.lz || framework_failure
|
||||||
|
|
||||||
mkdir tmp2
|
mkdir tmp2
|
||||||
mkdir tmp2/tmp3
|
mkdir tmp2/tmp3
|
||||||
cat in.bz2 > tmp2/tmp3/x.bz2 || framework_failure
|
cat in.bz2 > tmp2/tmp3/a.bz2 || framework_failure
|
||||||
cat in.gz > tmp2/tmp3/x.gz || framework_failure
|
cat in.gz > tmp2/tmp3/a.gz || framework_failure
|
||||||
"${ZUPDATE}" -N -r --format=gz tmp2
|
"${ZUPDATE}" -N -r --format=gz tmp2
|
||||||
if [ $? = 0 ] && [ -e tmp2/tmp3/x.bz2 ] && [ ! -e tmp2/tmp3/x.gz ] &&
|
if [ $? = 0 ] && [ -e tmp2/tmp3/a.bz2 ] && [ ! -e tmp2/tmp3/a.gz ] &&
|
||||||
[ -e tmp2/tmp3/x.lz ] ; then printf .
|
[ -e tmp2/tmp3/a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -f tmp2/tmp3/x.lz || framework_failure
|
rm -f tmp2/tmp3/a.lz || framework_failure
|
||||||
"${ZUPDATE}" -N -r --format=bz2 tmp2
|
"${ZUPDATE}" -N -r --format=bz2 tmp2
|
||||||
if [ $? = 0 ] && [ ! -e tmp2/tmp3/x.bz2 ] && [ ! -e tmp2/tmp3/x.gz ] &&
|
if [ $? = 0 ] && [ ! -e tmp2/tmp3/a.bz2 ] && [ ! -e tmp2/tmp3/a.gz ] &&
|
||||||
[ -e tmp2/tmp3/x.lz ] ; then printf .
|
[ -e tmp2/tmp3/a.lz ] ; then printf .
|
||||||
else printf - ; fail=1
|
else printf - ; fail=1
|
||||||
fi
|
fi
|
||||||
rm -r tmp2 || framework_failure
|
rm -r tmp2 || framework_failure
|
||||||
|
|
27
zcat.cc
27
zcat.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Zcat - decompress and concatenate files to standard output
|
/* Zcat - decompress and concatenate files to standard output
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -90,14 +90,14 @@ Line_number line_number;
|
||||||
|
|
||||||
void show_help()
|
void show_help()
|
||||||
{
|
{
|
||||||
std::printf( "Zcat copies each given file (\"-\" means standard input), to standard\n"
|
std::printf( "Zcat copies each given file to standard output. If any given file is\n"
|
||||||
"output. If any given file is compressed, its decompressed content is\n"
|
"compressed, its decompressed content is used. If a given file does not\n"
|
||||||
"used. If a given file does not exist, and its name does not end with one\n"
|
"exist, and its name does not end with one of the known extensions, zcat\n"
|
||||||
"of the known extensions, zcat tries the compressed file names\n"
|
"tries the compressed file names corresponding to the supported formats.\n"
|
||||||
"corresponding to the supported formats. If no files are specified,\n"
|
"\nIf no files are specified, or if a file is specified as '-', data is\n"
|
||||||
"data is read from standard input, decompressed if needed, and sent to\n"
|
"read from standard input, decompressed if needed, and sent to standard\n"
|
||||||
"standard output. Data read from standard input must be of the same type;\n"
|
"output. Data read from standard input must be of the same type; all\n"
|
||||||
"all uncompressed or all in the same compression format.\n"
|
"uncompressed or all in the same compression format.\n"
|
||||||
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
||||||
"\nUsage: zcat [options] [files]\n"
|
"\nUsage: zcat [options] [files]\n"
|
||||||
"\nExit status is 0 if no errors occurred, non-zero otherwise.\n"
|
"\nExit status is 0 if no errors occurred, non-zero otherwise.\n"
|
||||||
|
@ -346,13 +346,18 @@ int main( const int argc, const char * const argv[] )
|
||||||
for( ; argind < parser.arguments(); ++argind )
|
for( ; argind < parser.arguments(); ++argind )
|
||||||
filenames.push_back( parser.argument( argind ) );
|
filenames.push_back( parser.argument( argind ) );
|
||||||
|
|
||||||
if( filenames.empty() ) filenames.push_back("-");
|
if( filenames.empty() ) filenames.push_back( "-" );
|
||||||
|
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
bool stdin_used = false;
|
||||||
while( next_filename( filenames, input_filename, error, recursive ) )
|
while( next_filename( filenames, input_filename, error, recursive ) )
|
||||||
{
|
{
|
||||||
if( input_filename.empty() ) infd = STDIN_FILENO;
|
if( input_filename.empty() )
|
||||||
|
{
|
||||||
|
if( stdin_used ) continue; else stdin_used = true;
|
||||||
|
infd = STDIN_FILENO;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
infd = open_instream( input_filename, format_index < 0 );
|
infd = open_instream( input_filename, format_index < 0 );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Common code for zcat and zgrep
|
/* Common code for zcat and zgrep
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
28
zcmp.cc
28
zcmp.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Zcmp - decompress and compare two files byte by byte
|
/* Zcmp - decompress and compare two files byte by byte
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -50,11 +50,11 @@ namespace {
|
||||||
|
|
||||||
void show_help()
|
void show_help()
|
||||||
{
|
{
|
||||||
std::printf( "Zcmp compares two files (\"-\" means standard input), and if they\n"
|
std::printf( "Zcmp compares two files ('-' means standard input), and if they differ,\n"
|
||||||
"differ, tells the first byte and line number where they differ. Bytes\n"
|
"tells the first byte and line number where they differ. Bytes and lines\n"
|
||||||
"and lines are numbered starting with 1. If any given file is compressed,\n"
|
"are numbered starting with 1. If any given file is compressed, its\n"
|
||||||
"its decompressed content is used. Compressed files are decompressed on\n"
|
"decompressed content is used. Compressed files are decompressed on the\n"
|
||||||
"the fly; no temporary files are created.\n"
|
"fly; no temporary files are created.\n"
|
||||||
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
||||||
"\nUsage: zcmp [options] file1 [file2]\n"
|
"\nUsage: zcmp [options] file1 [file2]\n"
|
||||||
"\nCompares <file1> to <file2>. If <file2> is omitted zcmp tries the\n"
|
"\nCompares <file1> to <file2>. If <file2> is omitted zcmp tries the\n"
|
||||||
|
@ -106,9 +106,8 @@ long long getnum( const char * const ptr, const char ** const tailp = 0,
|
||||||
|
|
||||||
if( !errno && tail[0] && std::isalpha( tail[0] ) )
|
if( !errno && tail[0] && std::isalpha( tail[0] ) )
|
||||||
{
|
{
|
||||||
int factor = ( tail[1] == 'i' ) ? 1024 : 1000;
|
const int factor = ( tail[1] == 'i' ) ? 1024 : 1000;
|
||||||
int exponent = 0;
|
int exponent = 0; // 0 = bad multiplier
|
||||||
bool bad_multiplier = false;
|
|
||||||
switch( tail[0] )
|
switch( tail[0] )
|
||||||
{
|
{
|
||||||
case 'Y': exponent = 8; break;
|
case 'Y': exponent = 8; break;
|
||||||
|
@ -118,13 +117,10 @@ long long getnum( const char * const ptr, const char ** const tailp = 0,
|
||||||
case 'T': exponent = 4; break;
|
case 'T': exponent = 4; break;
|
||||||
case 'G': exponent = 3; break;
|
case 'G': exponent = 3; break;
|
||||||
case 'M': exponent = 2; break;
|
case 'M': exponent = 2; break;
|
||||||
case 'K': if( factor == 1024 ) exponent = 1; else bad_multiplier = true;
|
case 'K': if( factor == 1024 ) exponent = 1; break;
|
||||||
break;
|
case 'k': if( factor == 1000 ) exponent = 1; break;
|
||||||
case 'k': if( factor == 1000 ) exponent = 1; else bad_multiplier = true;
|
|
||||||
break;
|
|
||||||
default : bad_multiplier = true;
|
|
||||||
}
|
}
|
||||||
if( bad_multiplier )
|
if( exponent <= 0 )
|
||||||
{
|
{
|
||||||
show_error( "Bad multiplier in numerical argument.", 0, true );
|
show_error( "Bad multiplier in numerical argument.", 0, true );
|
||||||
std::exit( 2 );
|
std::exit( 2 );
|
||||||
|
@ -298,7 +294,7 @@ int cmp( const long long max_size, const int infd[2],
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: EOF on %s\n",
|
std::fprintf( stderr, "%s: EOF on %s\n",
|
||||||
program_name, filenames[rd[1]<rd[0]].c_str() );
|
program_name, filenames[rd[1]<rd[0]].c_str() );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( min_rd != buffer_size ) break;
|
if( min_rd != buffer_size ) break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Common code for zcmp and zdiff
|
/* Common code for zcmp and zdiff
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
14
zdiff.cc
14
zdiff.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Zdiff - decompress and compare two files line by line
|
/* Zdiff - decompress and compare two files line by line
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -48,7 +48,7 @@ std::string fifonames[2]; // names of the two fifos passed to diff
|
||||||
|
|
||||||
void show_help()
|
void show_help()
|
||||||
{
|
{
|
||||||
std::printf( "Zdiff compares two files (\"-\" means standard input), and if they\n"
|
std::printf( "Zdiff compares two files ('-' means standard input), and if they\n"
|
||||||
"differ, shows the differences line by line. If any given file is\n"
|
"differ, shows the differences line by line. If any given file is\n"
|
||||||
"compressed, its decompressed content is used. Zdiff is a front end to\n"
|
"compressed, its decompressed content is used. Zdiff is a front end to\n"
|
||||||
"the diff program and has the limitation that messages from diff refer to\n"
|
"the diff program and has the limitation that messages from diff refer to\n"
|
||||||
|
@ -123,12 +123,14 @@ bool set_fifonames( const std::string filenames[2] )
|
||||||
if( p ) { fifonames[0] = p; fifonames[0] += '/'; }
|
if( p ) { fifonames[0] = p; fifonames[0] += '/'; }
|
||||||
else fifonames[0] = "/tmp/";
|
else fifonames[0] = "/tmp/";
|
||||||
int n = getpid();
|
int n = getpid();
|
||||||
const unsigned pos = fifonames[0].size();
|
unsigned pos = fifonames[0].size();
|
||||||
do fifonames[0].insert( pos, 1, codes[n % num_codes] );
|
do fifonames[0].insert( pos, 1, codes[n % num_codes] );
|
||||||
while( n /= num_codes );
|
while( n /= num_codes );
|
||||||
|
pos = fifonames[0].size();
|
||||||
fifonames[1] = fifonames[0];
|
fifonames[1] = fifonames[0];
|
||||||
fifonames[0] += '_'; fifonames[0] += my_basename( filenames[0].c_str() );
|
fifonames[0] += '_'; fifonames[0] += my_basename( filenames[0].c_str() );
|
||||||
fifonames[1] += '-'; fifonames[1] += my_basename( filenames[1].c_str() );
|
fifonames[1] += '_'; fifonames[1] += my_basename( filenames[1].c_str() );
|
||||||
|
if( fifonames[1] == fifonames[0] ) fifonames[1][pos] = '-';
|
||||||
|
|
||||||
for( int i = 0; i < 2; ++i )
|
for( int i = 0; i < 2; ++i )
|
||||||
if( mkfifo( fifonames[i].c_str(), S_IRUSR | S_IWUSR ) != 0 )
|
if( mkfifo( fifonames[i].c_str(), S_IRUSR | S_IWUSR ) != 0 )
|
||||||
|
@ -180,7 +182,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
|
||||||
if( outfd < 0 )
|
if( outfd < 0 )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n",
|
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s\n",
|
||||||
program_name, fifoname.c_str(), std::strerror( errno ) );
|
program_name, fifoname.c_str(), std::strerror( errno ) );
|
||||||
_exit( 2 );
|
_exit( 2 );
|
||||||
}
|
}
|
||||||
|
@ -219,7 +221,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
|
||||||
if( outfd < 0 )
|
if( outfd < 0 )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n",
|
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s\n",
|
||||||
program_name, fifoname.c_str(), std::strerror( errno ) );
|
program_name, fifoname.c_str(), std::strerror( errno ) );
|
||||||
_exit( 2 );
|
_exit( 2 );
|
||||||
}
|
}
|
||||||
|
|
20
zgrep.cc
20
zgrep.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Zgrep - search compressed files for a regular expression
|
/* Zgrep - search compressed files for a regular expression
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -52,10 +52,11 @@ void show_help()
|
||||||
"file is compressed, its decompressed content is used. If a given file\n"
|
"file is compressed, its decompressed content is used. If a given file\n"
|
||||||
"does not exist, and its name does not end with one of the known\n"
|
"does not exist, and its name does not end with one of the known\n"
|
||||||
"extensions, zgrep tries the compressed file names corresponding to the\n"
|
"extensions, zgrep tries the compressed file names corresponding to the\n"
|
||||||
"supported formats. If no files are specified, data is read from\n"
|
"supported formats.\n"
|
||||||
"standard input, decompressed if needed, and fed to grep. Data read from\n"
|
"\nIf no files are specified, or if a file is specified as '-', data is\n"
|
||||||
"standard input must be of the same type; all uncompressed or all\n"
|
"read from standard input, decompressed if needed, and fed to grep. Data\n"
|
||||||
"in the same compression format.\n"
|
"read from standard input must be of the same type; all uncompressed or\n"
|
||||||
|
"all in the same compression format.\n"
|
||||||
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
||||||
"\nUsage: zgrep [options] <pattern> [files]\n"
|
"\nUsage: zgrep [options] <pattern> [files]\n"
|
||||||
"\nExit status is 0 if match, 1 if no match, 2 if trouble.\n"
|
"\nExit status is 0 if match, 1 if no match, 2 if trouble.\n"
|
||||||
|
@ -337,16 +338,21 @@ int main( const int argc, const char * const argv[] )
|
||||||
for( ; argind < parser.arguments(); ++argind )
|
for( ; argind < parser.arguments(); ++argind )
|
||||||
filenames.push_back( parser.argument( argind ) );
|
filenames.push_back( parser.argument( argind ) );
|
||||||
|
|
||||||
if( filenames.empty() ) filenames.push_back("-");
|
if( filenames.empty() ) filenames.push_back( "-" );
|
||||||
|
|
||||||
if( show_name < 0 ) show_name = ( filenames.size() != 1 || recursive );
|
if( show_name < 0 ) show_name = ( filenames.size() != 1 || recursive );
|
||||||
|
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
bool stdin_used = false;
|
||||||
while( next_filename( filenames, input_filename, error, recursive,
|
while( next_filename( filenames, input_filename, error, recursive,
|
||||||
false, no_messages ) )
|
false, no_messages ) )
|
||||||
{
|
{
|
||||||
if( input_filename.empty() ) infd = STDIN_FILENO;
|
if( input_filename.empty() )
|
||||||
|
{
|
||||||
|
if( stdin_used ) continue; else stdin_used = true;
|
||||||
|
infd = STDIN_FILENO;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
infd = open_instream( input_filename, format_index < 0, no_messages );
|
infd = open_instream( input_filename, format_index < 0, no_messages );
|
||||||
|
|
18
ztest.cc
18
ztest.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Ztest - verify integrity of compressed files
|
/* Ztest - verify integrity of compressed files
|
||||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -51,9 +51,10 @@ namespace {
|
||||||
void show_help()
|
void show_help()
|
||||||
{
|
{
|
||||||
std::printf( "Ztest verifies the integrity of the specified compressed files.\n"
|
std::printf( "Ztest verifies the integrity of the specified compressed files.\n"
|
||||||
"Uncompressed files are ignored. If no files are specified, the integrity\n"
|
"Uncompressed files are ignored. If no files are specified, or if a file\n"
|
||||||
"of compressed data read from standard input is verified. Data read from\n"
|
"is specified as '-', the integrity of compressed data read from standard\n"
|
||||||
"standard input must be all in the same compression format.\n"
|
"input is verified. Data read from standard input must be all in the same\n"
|
||||||
|
"compression format.\n"
|
||||||
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
|
||||||
"\nNote that some xz files lack integrity information, and therefore can't\n"
|
"\nNote that some xz files lack integrity information, and therefore can't\n"
|
||||||
"be verified as reliably as the other formats can.\n"
|
"be verified as reliably as the other formats can.\n"
|
||||||
|
@ -270,13 +271,18 @@ int main( const int argc, const char * const argv[] )
|
||||||
for( ; argind < parser.arguments(); ++argind )
|
for( ; argind < parser.arguments(); ++argind )
|
||||||
filenames.push_back( parser.argument( argind ) );
|
filenames.push_back( parser.argument( argind ) );
|
||||||
|
|
||||||
if( filenames.empty() ) filenames.push_back("-");
|
if( filenames.empty() ) filenames.push_back( "-" );
|
||||||
|
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
bool stdin_used = false;
|
||||||
while( next_filename( filenames, input_filename, error, recursive ) )
|
while( next_filename( filenames, input_filename, error, recursive ) )
|
||||||
{
|
{
|
||||||
if( input_filename.empty() ) infd = STDIN_FILENO;
|
if( input_filename.empty() )
|
||||||
|
{
|
||||||
|
if( stdin_used ) continue; else stdin_used = true;
|
||||||
|
infd = STDIN_FILENO;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
infd = open_instream( input_filename );
|
infd = open_instream( input_filename );
|
||||||
|
|
19
zupdate.cc
19
zupdate.cc
|
@ -1,5 +1,5 @@
|
||||||
/* Zupdate - recompress bzip2, gzip, xz files to lzip files
|
/* Zupdate - recompress bzip2, gzip, xz files to lzip format
|
||||||
Copyright (C) 2013-2015 Antonio Diaz Diaz.
|
Copyright (C) 2013-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -72,7 +72,7 @@ void show_help()
|
||||||
"\nOptions:\n"
|
"\nOptions:\n"
|
||||||
" -h, --help display this help and exit\n"
|
" -h, --help display this help and exit\n"
|
||||||
" -V, --version output version information and exit\n"
|
" -V, --version output version information and exit\n"
|
||||||
" -f, --force do not skip a file even if the .lz exists\n"
|
" -f, --force don't skip a file even if the .lz exists\n"
|
||||||
" -k, --keep keep (don't delete) input files\n"
|
" -k, --keep keep (don't delete) input files\n"
|
||||||
" -l, --lzip-verbose pass a -v option to the lzip compressor\n"
|
" -l, --lzip-verbose pass a -v option to the lzip compressor\n"
|
||||||
" -M, --format=<list> process only the formats in <list>\n"
|
" -M, --format=<list> process only the formats in <list>\n"
|
||||||
|
@ -94,10 +94,10 @@ int cant_execute( const std::string & command, const int status )
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
{
|
{
|
||||||
if( WIFEXITED( status ) )
|
if( WIFEXITED( status ) )
|
||||||
std::fprintf( stderr, "%s: Error executing '%s'. Exit status = %d.\n",
|
std::fprintf( stderr, "%s: Error executing '%s'. Exit status = %d\n",
|
||||||
program_name, command.c_str(), WEXITSTATUS( status ) );
|
program_name, command.c_str(), WEXITSTATUS( status ) );
|
||||||
else
|
else
|
||||||
std::fprintf( stderr, "%s: Can't execute '%s'.\n",
|
std::fprintf( stderr, "%s: Can't execute '%s'\n",
|
||||||
program_name, command.c_str() );
|
program_name, command.c_str() );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -162,7 +162,7 @@ int zupdate_file( const std::string & name, const char * const lzip_name,
|
||||||
if( stat( name.c_str(), &in_stats ) != 0 ) // check input file
|
if( stat( name.c_str(), &in_stats ) != 0 ) // check input file
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't stat input file '%s': %s.\n",
|
std::fprintf( stderr, "%s: Can't stat input file '%s': %s\n",
|
||||||
program_name, name.c_str(), std::strerror( errno ) );
|
program_name, name.c_str(), std::strerror( errno ) );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ int zupdate_file( const std::string & name, const char * const lzip_name,
|
||||||
if( !lz_exists ) // recompress
|
if( !lz_exists ) // recompress
|
||||||
{
|
{
|
||||||
if( verbosity >= 1 )
|
if( verbosity >= 1 )
|
||||||
std::fprintf( stderr, "Recompressing file '%s'.\n", name.c_str() );
|
std::fprintf( stderr, "Recompressing file '%s'\n", name.c_str() );
|
||||||
int fda[2]; // pipe between decompressor and compressor
|
int fda[2]; // pipe between decompressor and compressor
|
||||||
if( pipe( fda ) < 0 )
|
if( pipe( fda ) < 0 )
|
||||||
{ show_error( "Can't create pipe", errno ); return 1; }
|
{ show_error( "Can't create pipe", errno ); return 1; }
|
||||||
|
@ -262,13 +262,14 @@ int zupdate_file( const std::string & name, const char * const lzip_name,
|
||||||
|
|
||||||
{
|
{
|
||||||
if( lz_exists && verbosity >= 1 )
|
if( lz_exists && verbosity >= 1 )
|
||||||
std::fprintf( stderr, "Comparing file '%s'.\n", name.c_str() );
|
std::fprintf( stderr, "Comparing file '%s'\n", name.c_str() );
|
||||||
std::string zcmp_command( invocation_name );
|
std::string zcmp_command( invocation_name );
|
||||||
unsigned i = zcmp_command.size();
|
unsigned i = zcmp_command.size();
|
||||||
while( i > 0 && zcmp_command[i-1] != '/' ) --i;
|
while( i > 0 && zcmp_command[i-1] != '/' ) --i;
|
||||||
zcmp_command.resize( i );
|
zcmp_command.resize( i );
|
||||||
zcmp_command += "zcmp "; // ${bindir}zcmp
|
zcmp_command += "zcmp "; // ${bindir}zcmp
|
||||||
if( no_rcfile ) zcmp_command += "-N ";
|
if( no_rcfile ) zcmp_command += "-N ";
|
||||||
|
if( verbosity < 0 ) zcmp_command += "-q ";
|
||||||
zcmp_command += name; zcmp_command += ' '; zcmp_command += rname;
|
zcmp_command += name; zcmp_command += ' '; zcmp_command += rname;
|
||||||
int status = std::system( zcmp_command.c_str() );
|
int status = std::system( zcmp_command.c_str() );
|
||||||
if( status != 0 )
|
if( status != 0 )
|
||||||
|
@ -279,7 +280,7 @@ int zupdate_file( const std::string & name, const char * const lzip_name,
|
||||||
if( !keep_input_files && std::remove( name.c_str() ) != 0 && errno != ENOENT )
|
if( !keep_input_files && std::remove( name.c_str() ) != 0 && errno != ENOENT )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Can't delete input file '%s': %s.\n",
|
std::fprintf( stderr, "%s: Can't delete input file '%s': %s\n",
|
||||||
program_name, name.c_str(), std::strerror( errno ) );
|
program_name, name.c_str(), std::strerror( errno ) );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Zutils - Utilities dealing with compressed files
|
/* Zutils - Utilities dealing with compressed files
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -61,7 +61,7 @@ int child_status( const pid_t pid, const char * const name )
|
||||||
if( tmp == -1 && errno != EINTR )
|
if( tmp == -1 && errno != EINTR )
|
||||||
{
|
{
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
std::fprintf( stderr, "%s: Error checking status of '%s': %s.\n",
|
std::fprintf( stderr, "%s: Error checking status of '%s': %s\n",
|
||||||
program_name, name, std::strerror( errno ) );
|
program_name, name, std::strerror( errno ) );
|
||||||
_exit( 2 );
|
_exit( 2 );
|
||||||
}
|
}
|
||||||
|
|
2
zutils.h
2
zutils.h
|
@ -1,5 +1,5 @@
|
||||||
/* Zutils - Utilities dealing with compressed files
|
/* Zutils - Utilities dealing with compressed files
|
||||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
Copyright (C) 2009-2016 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
Loading…
Add table
Reference in a new issue