Adding upstream version 0.7.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c2bdc739f1
commit
0504e18b91
17 changed files with 318 additions and 96 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2009-10-21 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
||||||
|
* Version 0.7 released.
|
||||||
|
* Added new utility; ztest.
|
||||||
|
* zcat.in: Added new option "--recursive".
|
||||||
|
|
||||||
2009-10-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2009-10-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
||||||
* Version 0.6 released.
|
* Version 0.6 released.
|
||||||
|
|
23
Makefile.in
23
Makefile.in
|
@ -8,7 +8,7 @@ INSTALL_DIR = $(INSTALL) -d -m 755
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
||||||
objs = arg_parser.o main.o
|
objs = arg_parser.o main.o
|
||||||
scripts = zcat zcmp zdiff zegrep zfgrep zgrep
|
scripts = zcat zcmp zdiff zegrep zfgrep zgrep ztest
|
||||||
|
|
||||||
|
|
||||||
.PHONY : all install install-info install-man install-strip \
|
.PHONY : all install install-info install-man install-strip \
|
||||||
|
@ -47,6 +47,10 @@ zgrep : zgrep.in
|
||||||
sed -e 's,VERSION,$(progversion),g' $(VPATH)/zgrep.in > zgrep
|
sed -e 's,VERSION,$(progversion),g' $(VPATH)/zgrep.in > zgrep
|
||||||
chmod a+x zgrep
|
chmod a+x zgrep
|
||||||
|
|
||||||
|
ztest : ztest.in
|
||||||
|
sed -e 's,VERSION,$(progversion),g' $(VPATH)/ztest.in > ztest
|
||||||
|
chmod a+x ztest
|
||||||
|
|
||||||
main.o : main.cc
|
main.o : main.cc
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -DPROGVERSION=\"$(progversion)\" -c -o $@ $<
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -DPROGVERSION=\"$(progversion)\" -c -o $@ $<
|
||||||
|
|
||||||
|
@ -65,7 +69,8 @@ info : $(VPATH)/doc/$(progname).info
|
||||||
$(VPATH)/doc/$(progname).info : $(VPATH)/doc/$(progname).texinfo
|
$(VPATH)/doc/$(progname).info : $(VPATH)/doc/$(progname).texinfo
|
||||||
cd $(VPATH)/doc && makeinfo $(progname).texinfo
|
cd $(VPATH)/doc && makeinfo $(progname).texinfo
|
||||||
|
|
||||||
man : $(VPATH)/doc/zcat.1 $(VPATH)/doc/zdiff.1 $(VPATH)/doc/zgrep.1
|
man : $(VPATH)/doc/zcat.1 $(VPATH)/doc/zdiff.1 \
|
||||||
|
$(VPATH)/doc/zgrep.1 $(VPATH)/doc/ztest.1
|
||||||
|
|
||||||
$(VPATH)/doc/zcat.1 : zcat
|
$(VPATH)/doc/zcat.1 : zcat
|
||||||
help2man -n 'concatenate compressed files to stdout' \
|
help2man -n 'concatenate compressed files to stdout' \
|
||||||
|
@ -79,6 +84,10 @@ $(VPATH)/doc/zgrep.1 : zgrep
|
||||||
help2man -n 'search compressed files for a regular expression' \
|
help2man -n 'search compressed files for a regular expression' \
|
||||||
-o $(VPATH)/doc/zgrep.1 --no-info ./zgrep
|
-o $(VPATH)/doc/zgrep.1 --no-info ./zgrep
|
||||||
|
|
||||||
|
$(VPATH)/doc/ztest.1 : ztest
|
||||||
|
help2man -n 'verify integrity of compressed files' \
|
||||||
|
-o $(VPATH)/doc/ztest.1 --no-info ./ztest
|
||||||
|
|
||||||
Makefile : $(VPATH)/configure $(VPATH)/Makefile.in
|
Makefile : $(VPATH)/configure $(VPATH)/Makefile.in
|
||||||
./config.status
|
./config.status
|
||||||
|
|
||||||
|
@ -86,7 +95,7 @@ check : all $(VPATH)/testsuite/check.sh
|
||||||
@$(VPATH)/testsuite/check.sh $(VPATH)/testsuite
|
@$(VPATH)/testsuite/check.sh $(VPATH)/testsuite
|
||||||
|
|
||||||
install : all install-info install-man
|
install : all install-info install-man
|
||||||
if test ! -d $(DESTDIR)$(bindir) ; then $(INSTALL_DIR) $(DESTDIR)$(bindir) ; fi
|
if [ ! -d $(DESTDIR)$(bindir) ] ; then $(INSTALL_DIR) $(DESTDIR)$(bindir) ; fi
|
||||||
$(INSTALL_PROGRAM) ./$(progname) $(DESTDIR)$(bindir)/$(progname)
|
$(INSTALL_PROGRAM) ./$(progname) $(DESTDIR)$(bindir)/$(progname)
|
||||||
$(INSTALL_SCRIPT) zcat $(DESTDIR)$(bindir)/zcat
|
$(INSTALL_SCRIPT) zcat $(DESTDIR)$(bindir)/zcat
|
||||||
$(INSTALL_SCRIPT) zcmp $(DESTDIR)$(bindir)/zcmp
|
$(INSTALL_SCRIPT) zcmp $(DESTDIR)$(bindir)/zcmp
|
||||||
|
@ -94,14 +103,15 @@ install : all install-info install-man
|
||||||
$(INSTALL_SCRIPT) zegrep $(DESTDIR)$(bindir)/zegrep
|
$(INSTALL_SCRIPT) zegrep $(DESTDIR)$(bindir)/zegrep
|
||||||
$(INSTALL_SCRIPT) zfgrep $(DESTDIR)$(bindir)/zfgrep
|
$(INSTALL_SCRIPT) zfgrep $(DESTDIR)$(bindir)/zfgrep
|
||||||
$(INSTALL_SCRIPT) zgrep $(DESTDIR)$(bindir)/zgrep
|
$(INSTALL_SCRIPT) zgrep $(DESTDIR)$(bindir)/zgrep
|
||||||
|
$(INSTALL_SCRIPT) ztest $(DESTDIR)$(bindir)/ztest
|
||||||
|
|
||||||
install-info :
|
install-info :
|
||||||
if test ! -d $(DESTDIR)$(infodir) ; then $(INSTALL_DIR) $(DESTDIR)$(infodir) ; fi
|
if [ ! -d $(DESTDIR)$(infodir) ] ; then $(INSTALL_DIR) $(DESTDIR)$(infodir) ; fi
|
||||||
$(INSTALL_DATA) $(VPATH)/doc/$(progname).info $(DESTDIR)$(infodir)/$(progname).info
|
$(INSTALL_DATA) $(VPATH)/doc/$(progname).info $(DESTDIR)$(infodir)/$(progname).info
|
||||||
-install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$(progname).info
|
-install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$(progname).info
|
||||||
|
|
||||||
install-man :
|
install-man :
|
||||||
if test ! -d $(DESTDIR)$(mandir)/man1 ; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man1 ; fi
|
if [ ! -d $(DESTDIR)$(mandir)/man1 ] ; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man1 ; fi
|
||||||
$(INSTALL_DATA) $(VPATH)/doc/zcat.1 $(DESTDIR)$(mandir)/man1/zcat.1
|
$(INSTALL_DATA) $(VPATH)/doc/zcat.1 $(DESTDIR)$(mandir)/man1/zcat.1
|
||||||
-rm -f $(DESTDIR)$(mandir)/man1/zcmp.1
|
-rm -f $(DESTDIR)$(mandir)/man1/zcmp.1
|
||||||
cd $(DESTDIR)$(mandir)/man1 && ln -s zdiff.1 zcmp.1
|
cd $(DESTDIR)$(mandir)/man1 && ln -s zdiff.1 zcmp.1
|
||||||
|
@ -111,6 +121,7 @@ install-man :
|
||||||
-rm -f $(DESTDIR)$(mandir)/man1/zfgrep.1
|
-rm -f $(DESTDIR)$(mandir)/man1/zfgrep.1
|
||||||
cd $(DESTDIR)$(mandir)/man1 && ln -s zgrep.1 zegrep.1
|
cd $(DESTDIR)$(mandir)/man1 && ln -s zgrep.1 zegrep.1
|
||||||
cd $(DESTDIR)$(mandir)/man1 && ln -s zgrep.1 zfgrep.1
|
cd $(DESTDIR)$(mandir)/man1 && ln -s zgrep.1 zfgrep.1
|
||||||
|
$(INSTALL_DATA) $(VPATH)/doc/ztest.1 $(DESTDIR)$(mandir)/man1/ztest.1
|
||||||
|
|
||||||
install-strip : all
|
install-strip : all
|
||||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||||
|
@ -123,6 +134,7 @@ uninstall : uninstall-info uninstall-man
|
||||||
-rm -f $(DESTDIR)$(bindir)/zegrep
|
-rm -f $(DESTDIR)$(bindir)/zegrep
|
||||||
-rm -f $(DESTDIR)$(bindir)/zfgrep
|
-rm -f $(DESTDIR)$(bindir)/zfgrep
|
||||||
-rm -f $(DESTDIR)$(bindir)/zgrep
|
-rm -f $(DESTDIR)$(bindir)/zgrep
|
||||||
|
-rm -f $(DESTDIR)$(bindir)/ztest
|
||||||
|
|
||||||
uninstall-info :
|
uninstall-info :
|
||||||
-install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$(progname).info
|
-install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$(progname).info
|
||||||
|
@ -135,6 +147,7 @@ uninstall-man :
|
||||||
-rm -f $(DESTDIR)$(mandir)/man1/zegrep.1
|
-rm -f $(DESTDIR)$(mandir)/man1/zegrep.1
|
||||||
-rm -f $(DESTDIR)$(mandir)/man1/zfgrep.1
|
-rm -f $(DESTDIR)$(mandir)/man1/zfgrep.1
|
||||||
-rm -f $(DESTDIR)$(mandir)/man1/zgrep.1
|
-rm -f $(DESTDIR)$(mandir)/man1/zgrep.1
|
||||||
|
-rm -f $(DESTDIR)$(mandir)/man1/ztest.1
|
||||||
|
|
||||||
dist :
|
dist :
|
||||||
ln -sf $(VPATH) $(DISTNAME)
|
ln -sf $(VPATH) $(DISTNAME)
|
||||||
|
|
7
NEWS
7
NEWS
|
@ -1,3 +1,6 @@
|
||||||
Changes in version 0.6:
|
Changes in version 0.7:
|
||||||
|
|
||||||
Format of data read from stdin is now automatically detected.
|
The new utility ztest, able to recursively test all the compressed files
|
||||||
|
in a directory tree, has been added.
|
||||||
|
|
||||||
|
The option "--recursive" has been added to zcat.
|
||||||
|
|
6
README
6
README
|
@ -2,10 +2,10 @@ Description
|
||||||
|
|
||||||
Zutils is a collection of utilities for dealing with any combination of
|
Zutils is a collection of utilities for dealing with any combination of
|
||||||
compressed and non-compressed files transparently. The supported
|
compressed and non-compressed files transparently. The supported
|
||||||
compressors are gzip, bzip2, lzip and xz.
|
compressors are bzip2, gzip, lzip and xz.
|
||||||
|
|
||||||
The currently provided utilities are zcat, zcmp, zdiff, zegrep, zfgrep
|
The currently provided utilities are zcat, zcmp, zdiff, zegrep, zfgrep,
|
||||||
and zgrep.
|
zgrep and ztest.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2009 Antonio Diaz Diaz.
|
Copyright (C) 2009 Antonio Diaz Diaz.
|
||||||
|
|
4
configure
vendored
4
configure
vendored
|
@ -5,12 +5,12 @@
|
||||||
# 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.
|
||||||
#
|
#
|
||||||
# Date of this version: 2009-10-05
|
# Date of this version: 2009-10-21
|
||||||
|
|
||||||
args=
|
args=
|
||||||
no_create=
|
no_create=
|
||||||
progname=zutils
|
progname=zutils
|
||||||
progversion=0.6
|
progversion=0.7
|
||||||
srctrigger=zdiff.in
|
srctrigger=zdiff.in
|
||||||
|
|
||||||
# clear some things potentially inherited from environment.
|
# clear some things potentially inherited from environment.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
.TH ZCAT "1" "October 2009" "Zcat 0.6" "User Commands"
|
.TH ZCAT "1" "October 2009" "Zcat 0.7" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Zcat \- concatenate compressed files to stdout
|
Zcat \- concatenate compressed files to stdout
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -16,7 +16,7 @@ corresponding to the supported compressors. If no files are specified,
|
||||||
data is read from standard input, decompressed if needed, and sent to
|
data is read from standard input, decompressed if needed, and sent to
|
||||||
stdout. Data read from standard input must be of the same type; all
|
stdout. Data read from standard input must be of the same type; all
|
||||||
uncompressed or all compressed with the same compressor.
|
uncompressed or all compressed with the same compressor.
|
||||||
The supported compressors are gzip, bzip2, lzip and xz.
|
The supported compressors are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
CAT_OPTIONS are passed directly to cat.
|
CAT_OPTIONS are passed directly to cat.
|
||||||
The exit status from cat is preserved.
|
The exit status from cat is preserved.
|
||||||
|
@ -27,6 +27,9 @@ display this help and exit
|
||||||
.TP
|
.TP
|
||||||
\fB\-V\fR, \fB\-\-version\fR
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
output version information and exit
|
output version information and exit
|
||||||
|
.TP
|
||||||
|
\fB\-r\fR, \fB\-\-recursive\fR
|
||||||
|
operate recursively on directories
|
||||||
.SH "REPORTING BUGS"
|
.SH "REPORTING BUGS"
|
||||||
Report bugs to zutils\-bug@nongnu.org
|
Report bugs to zutils\-bug@nongnu.org
|
||||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
.TH ZDIFF "1" "October 2009" "Zdiff 0.6" "User Commands"
|
.TH ZDIFF "1" "October 2009" "Zdiff 0.7" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Zdiff \- compare compressed files
|
Zdiff \- compare compressed files
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -11,7 +11,7 @@ Zdiff \- Diff/cmp wrapper for compressed files.
|
||||||
Zdiff is a wrapper script around the diff and cmp commands that allows
|
Zdiff is a wrapper script around the diff and cmp commands that allows
|
||||||
transparent comparison of any combination of compressed and
|
transparent comparison of any combination of compressed and
|
||||||
non\-compressed files. If any given file is compressed, its uncompressed
|
non\-compressed files. If any given file is compressed, its uncompressed
|
||||||
content is used. The supported compressors are gzip, bzip2, lzip and xz.
|
content is used. The supported compressors are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
Zcmp is a shortcut for "zdiff \fB\-\-cmp\fR"
|
Zcmp is a shortcut for "zdiff \fB\-\-cmp\fR"
|
||||||
.PP
|
.PP
|
||||||
|
@ -19,7 +19,7 @@ Compares FILE1 to FILE2. If FILE2 is omitted and FILE1 is compressed,
|
||||||
compares FILE1 to the file with the corresponding decompressed file
|
compares FILE1 to the file with the corresponding decompressed file
|
||||||
name (removes the extension from FILE1). If FILE2 is omitted and FILE1
|
name (removes the extension from FILE1). If FILE2 is omitted and FILE1
|
||||||
is not compressed, compares FILE1 to the uncompressed contents of
|
is not compressed, compares FILE1 to the uncompressed contents of
|
||||||
FILE1.[gz|bz2|lz|xz] (the first one that is found).
|
FILE1.[bz2|gz|lz|xz] (the first one that is found).
|
||||||
DIFF_OPTIONS are passed directly to diff or cmp.
|
DIFF_OPTIONS are passed directly to diff or cmp.
|
||||||
The exit status from diff or cmp is preserved.
|
The exit status from diff or cmp is preserved.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
.TH ZGREP "1" "October 2009" "Zgrep 0.6" "User Commands"
|
.TH ZGREP "1" "October 2009" "Zgrep 0.7" "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
|
||||||
|
@ -16,7 +16,7 @@ names corresponding to the supported compressors. If no files are
|
||||||
specified, data is read from standard input, decompressed if needed, and
|
specified, data is read from standard input, decompressed if needed, and
|
||||||
fed to grep. Data read from standard input must be of the same type; all
|
fed to grep. Data read from standard input must be of the same type; all
|
||||||
uncompressed or all compressed with the same compressor.
|
uncompressed or all compressed with the same compressor.
|
||||||
The supported compressors are gzip, bzip2, lzip and xz.
|
The supported compressors are bzip2, gzip, lzip and xz.
|
||||||
.PP
|
.PP
|
||||||
Zegrep is a shortcut for "zgrep \fB\-E\fR"
|
Zegrep is a shortcut for "zgrep \fB\-E\fR"
|
||||||
Zfgrep is a shortcut for "zgrep \fB\-F\fR"
|
Zfgrep is a shortcut for "zgrep \fB\-F\fR"
|
||||||
|
|
40
doc/ztest.1
Normal file
40
doc/ztest.1
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
|
.TH ZTEST "1" "October 2009" "Ztest 0.7" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
Ztest \- verify integrity of compressed files
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B ztest
|
||||||
|
[\fIOPTIONS\fR] [\fIFILES\fR]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Ztest \- Test integrity of compressed files.
|
||||||
|
.PP
|
||||||
|
Ztest verifies the integrity of the specified compressed files.
|
||||||
|
Non\-compressed files are ignored. If no files are specified, the
|
||||||
|
integrity of compressed data read from standard input is verified. Data
|
||||||
|
read from standard input must be all compressed with the same compressor.
|
||||||
|
The supported compressors are bzip2, gzip, lzip and xz.
|
||||||
|
.PP
|
||||||
|
The exit status is 1 if any compressed file is corrupt, 0 otherwise.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
display this help and exit
|
||||||
|
.TP
|
||||||
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
|
output version information and exit
|
||||||
|
.TP
|
||||||
|
\fB\-q\fR, \fB\-\-quiet\fR
|
||||||
|
suppress all messages
|
||||||
|
.TP
|
||||||
|
\fB\-r\fR, \fB\-\-recursive\fR
|
||||||
|
operate recursively on directories
|
||||||
|
.TP
|
||||||
|
\fB\-v\fR, \fB\-\-verbose\fR
|
||||||
|
be verbose (a 2nd \fB\-v\fR gives more)
|
||||||
|
.SH "REPORTING BUGS"
|
||||||
|
Report bugs to zutils\-bug@nongnu.org
|
||||||
|
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||||
|
.SH COPYRIGHT
|
||||||
|
Copyright \(co 2009 Antonio Diaz Diaz.
|
||||||
|
This script is free software: you have unlimited permission
|
||||||
|
to copy, distribute and modify it.
|
BIN
doc/zutils.info
BIN
doc/zutils.info
Binary file not shown.
|
@ -1,12 +1,12 @@
|
||||||
\input texinfo @c -*-texinfo-*-
|
\input texinfo @c -*-texinfo-*-
|
||||||
@c %**start of header
|
@c %**start of header
|
||||||
@setfilename zutils.info
|
@setfilename zutils.info
|
||||||
@settitle Zutils
|
@settitle Zutils Manual
|
||||||
@finalout
|
@finalout
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
|
|
||||||
@set UPDATED 5 October 2009
|
@set UPDATED 21 October 2009
|
||||||
@set VERSION 0.6
|
@set VERSION 0.7
|
||||||
|
|
||||||
@dircategory Data Compression
|
@dircategory Data Compression
|
||||||
@direntry
|
@direntry
|
||||||
|
@ -36,6 +36,7 @@ This manual is for Zutils (version @value{VERSION}, @value{UPDATED}).
|
||||||
* Zcat:: Concatenating compressed files
|
* Zcat:: Concatenating compressed files
|
||||||
* Zcmp/Zdiff:: Comparing compressed files
|
* Zcmp/Zdiff:: Comparing compressed files
|
||||||
* Zgrep:: Searching inside compressed files
|
* Zgrep:: Searching inside compressed files
|
||||||
|
* Ztest:: Testing integrity of compressed files
|
||||||
* Problems:: Reporting bugs
|
* Problems:: Reporting bugs
|
||||||
* Concept Index:: Index of concepts
|
* Concept Index:: Index of concepts
|
||||||
@end menu
|
@end menu
|
||||||
|
@ -53,10 +54,10 @@ to copy, distribute and modify it.
|
||||||
|
|
||||||
Zutils is a collection of utilities for dealing with any combination of
|
Zutils is a collection of utilities for dealing with any combination of
|
||||||
compressed and non-compressed files transparently. The supported
|
compressed and non-compressed files transparently. The supported
|
||||||
compressors are gzip, bzip2, lzip and xz.
|
compressors are bzip2, gzip, lzip and xz.
|
||||||
|
|
||||||
The currently provided utilities are zcat, zcmp, zdiff, zegrep, zfgrep
|
The currently provided utilities are zcat, zcmp, zdiff, zegrep, zfgrep,
|
||||||
and zgrep.
|
zgrep and ztest.
|
||||||
|
|
||||||
|
|
||||||
@node Zcat
|
@node Zcat
|
||||||
|
@ -93,6 +94,10 @@ Print an informative help message describing the options and exit.
|
||||||
@itemx -V
|
@itemx -V
|
||||||
Print the version number of zcat on the standard output and exit.
|
Print the version number of zcat on the standard output and exit.
|
||||||
|
|
||||||
|
@item --recursive
|
||||||
|
@itemx -r
|
||||||
|
Operate recursively on directories.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +126,7 @@ Compares @var{file1} to @var{file2}. If @var{file2} is omitted and
|
||||||
corresponding decompressed file name (removes the extension from
|
corresponding decompressed file name (removes the extension from
|
||||||
@var{file1}). If @var{file2} is omitted and @var{file1} is not
|
@var{file1}). If @var{file2} is omitted and @var{file1} is not
|
||||||
compressed, compares @var{file1} to the uncompressed contents of
|
compressed, compares @var{file1} to the uncompressed contents of
|
||||||
@var{file1}.[gz|bz2|lz|xz] (the first one that is found).
|
@var{file1}.[bz2|gz|lz|xz] (the first one that is found).
|
||||||
@var{diff_options} are passed directly to diff or cmp. The exit status
|
@var{diff_options} are passed directly to diff or cmp. The exit status
|
||||||
from diff or cmp is preserved.
|
from diff or cmp is preserved.
|
||||||
|
|
||||||
|
@ -192,6 +197,51 @@ Print the version number of zgrep on the standard output and exit.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
||||||
|
@node Ztest
|
||||||
|
@chapter Ztest
|
||||||
|
@cindex ztest
|
||||||
|
|
||||||
|
Ztest verifies the integrity of the specified compressed files.
|
||||||
|
Non-compressed files are ignored. If no files are specified, the
|
||||||
|
integrity of compressed data read from standard input is verified. Data
|
||||||
|
read from standard input must be all compressed with the same compressor.
|
||||||
|
|
||||||
|
The format for running ztest is:
|
||||||
|
|
||||||
|
@example
|
||||||
|
ztest [@var{options}] [@var{files}]
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
The exit status is 0 if all files verify OK, 1 otherwise.
|
||||||
|
|
||||||
|
Ztest supports the following options:
|
||||||
|
|
||||||
|
@table @samp
|
||||||
|
@item --help
|
||||||
|
@itemx -h
|
||||||
|
Print an informative help message describing the options and exit.
|
||||||
|
|
||||||
|
@item --version
|
||||||
|
@itemx -V
|
||||||
|
Print the version number of ztest on the standard output and exit.
|
||||||
|
|
||||||
|
@item --quiet
|
||||||
|
@itemx -q
|
||||||
|
Quiet operation. Suppress all messages.
|
||||||
|
|
||||||
|
@item --recursive
|
||||||
|
@itemx -r
|
||||||
|
Operate recursively on directories.
|
||||||
|
|
||||||
|
@item --verbose
|
||||||
|
@itemx -v
|
||||||
|
Verbose mode. Show the verify status for each file processed.
|
||||||
|
Further -v's increase the verbosity level.
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
|
|
||||||
@node Problems
|
@node Problems
|
||||||
@chapter Reporting Bugs
|
@chapter Reporting Bugs
|
||||||
@cindex bugs
|
@cindex bugs
|
||||||
|
|
4
main.cc
4
main.cc
|
@ -551,8 +551,8 @@ int print_magic_type( const std::string & magic_type )
|
||||||
{
|
{
|
||||||
std::string data;
|
std::string data;
|
||||||
|
|
||||||
if( magic_type == "gzip" ) std::printf( "\x1F\x8B" );
|
if( magic_type == "bzip2" ) std::printf( "BZh" );
|
||||||
else if( magic_type == "bzip2" ) std::printf( "BZh" );
|
else if( magic_type == "gzip" ) std::printf( "\x1F\x8B" );
|
||||||
else if( magic_type == "lzip" ) std::printf( "LZIP" );
|
else if( magic_type == "lzip" ) std::printf( "LZIP" );
|
||||||
else if( magic_type == "xz" ) std::printf( "%c7zXZ", '\xFD' );
|
else if( magic_type == "xz" ) std::printf( "%c7zXZ", '\xFD' );
|
||||||
else if( hex_to_data( magic_type, data ) ) std::printf( data.c_str() );
|
else if( hex_to_data( magic_type, data ) ) std::printf( data.c_str() );
|
||||||
|
|
|
@ -15,10 +15,12 @@ ZDIFF="${objdir}"/zdiff
|
||||||
ZGREP="${objdir}"/zgrep
|
ZGREP="${objdir}"/zgrep
|
||||||
ZEGREP="${objdir}"/zegrep
|
ZEGREP="${objdir}"/zegrep
|
||||||
ZFGREP="${objdir}"/zfgrep
|
ZFGREP="${objdir}"/zfgrep
|
||||||
|
ZTEST="${objdir}"/ztest
|
||||||
ZUTILS="${objdir}"/zutils
|
ZUTILS="${objdir}"/zutils
|
||||||
compressors="gzip bzip2 lzip"
|
compressors="bzip2 gzip lzip"
|
||||||
extensions="gz bz2 lz"
|
extensions="gz bz2 lz"
|
||||||
framework_failure() { echo 'failure in testing framework'; exit 1; }
|
framework_failure() { echo 'failure in testing framework'; exit 1; }
|
||||||
|
compressor_needed() { echo "${compressors} are needed to run tests"; exit 1; }
|
||||||
|
|
||||||
if [ ! -x "${ZCAT}" ] ; then
|
if [ ! -x "${ZCAT}" ] ; then
|
||||||
echo "${ZCAT}: cannot execute"
|
echo "${ZCAT}: cannot execute"
|
||||||
|
@ -27,15 +29,14 @@ fi
|
||||||
|
|
||||||
if [ -d tmp ] ; then rm -rf tmp ; fi
|
if [ -d tmp ] ; then rm -rf tmp ; fi
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
echo -n "testing zutils..."
|
|
||||||
cd "${objdir}"/tmp
|
cd "${objdir}"/tmp
|
||||||
|
|
||||||
for i in ${compressors}; do
|
for i in ${compressors}; do
|
||||||
cat "${testdir}"/../COPYING > in || framework_failure
|
cat "${testdir}"/../COPYING > in || framework_failure
|
||||||
$i in || framework_failure
|
$i in || compressor_needed
|
||||||
echo -n .
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo -n "testing zutils..."
|
||||||
cat "${testdir}"/../COPYING > in || framework_failure
|
cat "${testdir}"/../COPYING > in || framework_failure
|
||||||
cat in > -in- || framework_failure
|
cat in > -in- || framework_failure
|
||||||
cat in.lz > -in-.lz || framework_failure
|
cat in.lz > -in-.lz || framework_failure
|
||||||
|
@ -136,16 +137,21 @@ echo -n .
|
||||||
"${ZFGREP}" License in 2>&1 > /dev/null || fail=1
|
"${ZFGREP}" License in 2>&1 > /dev/null || fail=1
|
||||||
echo -n .
|
echo -n .
|
||||||
|
|
||||||
if [ "gzip" != `"${ZUTILS}" -t in.gz` ]; then fail=1 ; fi
|
"${ZTEST}" in in.gz in.bz2 in.lz -- -in- || fail=1
|
||||||
echo -n .
|
echo -n .
|
||||||
if [ "bzip2" != `"${ZUTILS}" -t in.bz2` ]; then fail=1 ; fi
|
"${ZTEST}" -r . || fail=1
|
||||||
echo -n .
|
echo -n .
|
||||||
if [ "lzip" != `"${ZUTILS}" -t in.lz` ]; then fail=1 ; fi
|
|
||||||
|
if [ "bzip2" != `"${ZUTILS}" -t in.bz2` ] ; then fail=1 ; fi
|
||||||
|
echo -n .
|
||||||
|
if [ "gzip" != `"${ZUTILS}" -t in.gz` ] ; then fail=1 ; fi
|
||||||
|
echo -n .
|
||||||
|
if [ "lzip" != `"${ZUTILS}" -t in.lz` ] ; then fail=1 ; fi
|
||||||
echo -n .
|
echo -n .
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if [ ${fail} = 0 ]; then
|
if [ ${fail} = 0 ] ; then
|
||||||
echo "tests completed successfully."
|
echo "tests completed successfully."
|
||||||
cd "${objdir}" && rm -r tmp
|
cd "${objdir}" && rm -r tmp
|
||||||
else
|
else
|
||||||
|
|
39
zcat.in
39
zcat.in
|
@ -8,6 +8,9 @@
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
export LC_ALL
|
export LC_ALL
|
||||||
args=
|
args=
|
||||||
|
gz_args=
|
||||||
|
xz_args=
|
||||||
|
recursive=0
|
||||||
two_hyphens=0
|
two_hyphens=0
|
||||||
|
|
||||||
# Loop over args until a filename is found
|
# Loop over args until a filename is found
|
||||||
|
@ -25,7 +28,7 @@ while [ x"$1" != x ] ; do
|
||||||
echo "data is read from standard input, decompressed if needed, and sent to"
|
echo "data is read from standard input, decompressed if needed, and sent to"
|
||||||
echo "stdout. Data read from standard input must be of the same type; all"
|
echo "stdout. Data read from standard input must be of the same type; all"
|
||||||
echo "uncompressed or all compressed with the same compressor."
|
echo "uncompressed or all compressed with the same compressor."
|
||||||
echo "The supported compressors are gzip, bzip2, lzip and xz."
|
echo "The supported compressors are bzip2, gzip, lzip and xz."
|
||||||
echo
|
echo
|
||||||
echo "Usage: $0 [OPTIONS] [CAT_OPTIONS] [FILES]"
|
echo "Usage: $0 [OPTIONS] [CAT_OPTIONS] [FILES]"
|
||||||
echo
|
echo
|
||||||
|
@ -35,6 +38,7 @@ while [ x"$1" != x ] ; do
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h, --help display this help and exit"
|
echo " -h, --help display this help and exit"
|
||||||
echo " -V, --version output version information and exit"
|
echo " -V, --version output version information and exit"
|
||||||
|
echo " -r, --recursive operate recursively on directories"
|
||||||
echo
|
echo
|
||||||
echo "Report bugs to zutils-bug@nongnu.org"
|
echo "Report bugs to zutils-bug@nongnu.org"
|
||||||
echo "Zutils home page: http://www.nongnu.org/zutils/zutils.html"
|
echo "Zutils home page: http://www.nongnu.org/zutils/zutils.html"
|
||||||
|
@ -45,8 +49,12 @@ while [ x"$1" != x ] ; do
|
||||||
echo "This script is free software: you have unlimited permission"
|
echo "This script is free software: you have unlimited permission"
|
||||||
echo "to copy, distribute and modify it."
|
echo "to copy, distribute and modify it."
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
- | -f)
|
- | -c | --st* | -d | --de* | -f | --fo* | -q | --qu* | -L | --lic* )
|
||||||
;;
|
;;
|
||||||
|
-l | --lis*)
|
||||||
|
gz_args="${gz_args} $1"; xz_args="${xz_args} $1" ;;
|
||||||
|
-r | --re*)
|
||||||
|
recursive=1 ;;
|
||||||
--)
|
--)
|
||||||
shift ; two_hyphens=1 ; break ;;
|
shift ; two_hyphens=1 ; break ;;
|
||||||
-?*)
|
-?*)
|
||||||
|
@ -57,14 +65,14 @@ while [ x"$1" != x ] ; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $# = 0 ]; then
|
if [ $# = 0 ] ; then
|
||||||
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
prog_name=`"${bindir}"zutils -t`
|
prog_name=`"${bindir}"zutils -t`
|
||||||
case "${prog_name}" in
|
case "${prog_name}" in
|
||||||
gzip) prog="gzip -cdfq" ;;
|
|
||||||
bzip2) prog="bzip2 -cdfq" ;;
|
bzip2) prog="bzip2 -cdfq" ;;
|
||||||
|
gzip) prog="gzip -cdfq ${gz_args}" ;;
|
||||||
lzip) prog="lzip -cdfq" ;;
|
lzip) prog="lzip -cdfq" ;;
|
||||||
xz) prog="xz -cdfq" ;;
|
xz) prog="xz -cdfq ${xz_args}" ;;
|
||||||
*) prog=cat ;;
|
*) prog=cat ;;
|
||||||
esac
|
esac
|
||||||
{ "${bindir}"zutils -m ${prog_name} ; cat ; } | ${prog} | cat ${args}
|
{ "${bindir}"zutils -m ${prog_name} ; cat ; } | ${prog} | cat ${args}
|
||||||
|
@ -75,29 +83,32 @@ retval=0
|
||||||
for i in "$@" ; do
|
for i in "$@" ; do
|
||||||
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
||||||
else
|
else
|
||||||
if [ ! -f "$i" ]; then
|
if [ ! -f "$i" ] ; then
|
||||||
if [ -f "$i.gz" ]; then i="$i.gz"
|
if [ -f "$i.gz" ] ; then i="$i.gz"
|
||||||
elif [ -f "$i.bz2" ]; then i="$i.bz2"
|
elif [ -f "$i.bz2" ] ; then i="$i.bz2"
|
||||||
elif [ -f "$i.lz" ]; then i="$i.lz"
|
elif [ -f "$i.lz" ] ; then i="$i.lz"
|
||||||
elif [ -f "$i.xz" ]; then i="$i.xz"
|
elif [ -f "$i.xz" ] ; then i="$i.xz"
|
||||||
|
elif [ ${recursive} = 1 ] && [ -d "$i" ] ; then
|
||||||
|
find "$i" -type f -exec "$0" '{}' ';'
|
||||||
|
continue
|
||||||
else
|
else
|
||||||
echo "$0: File \"$i\" not found or not a regular file" 1>&2
|
echo "$0: File \"$i\" not found or not a regular file" 1>&2
|
||||||
if [ ${retval} = 0 ]; then retval=1 ; fi
|
if [ ${retval} = 0 ] ; then retval=1 ; fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
prog_name=`"${bindir}"zutils -t -- "$i"`
|
prog_name=`"${bindir}"zutils -t -- "$i"`
|
||||||
case "${prog_name}" in
|
case "${prog_name}" in
|
||||||
gzip) prog="gzip -cdfq" ;;
|
|
||||||
bzip2) prog="bzip2 -cdfq" ;;
|
bzip2) prog="bzip2 -cdfq" ;;
|
||||||
|
gzip) prog="gzip -cdfq ${gz_args}" ;;
|
||||||
lzip) prog="lzip -cdfq" ;;
|
lzip) prog="lzip -cdfq" ;;
|
||||||
xz) prog="xz -cdfq" ;;
|
xz) prog="xz -cdfq ${xz_args}" ;;
|
||||||
*) prog=cat ;;
|
*) prog=cat ;;
|
||||||
esac
|
esac
|
||||||
${prog} -- "$i" | cat ${args}
|
${prog} -- "$i" | cat ${args}
|
||||||
r=$?
|
r=$?
|
||||||
if [ $r != 0 ]; then retval=$r ; fi
|
if [ $r != 0 ] ; then retval=$r ; fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
46
zdiff.in
46
zdiff.in
|
@ -23,7 +23,7 @@ while [ x"$1" != x ] ; do
|
||||||
echo "Zdiff is a wrapper script around the diff and cmp commands that allows"
|
echo "Zdiff is a wrapper script around the diff and cmp commands that allows"
|
||||||
echo "transparent comparison of any combination of compressed and"
|
echo "transparent comparison of any combination of compressed and"
|
||||||
echo "non-compressed files. If any given file is compressed, its uncompressed"
|
echo "non-compressed files. If any given file is compressed, its uncompressed"
|
||||||
echo "content is used. The supported compressors are gzip, bzip2, lzip and xz."
|
echo "content is used. The supported compressors are bzip2, gzip, lzip and xz."
|
||||||
echo
|
echo
|
||||||
echo "Zcmp is a shortcut for \"zdiff --cmp\""
|
echo "Zcmp is a shortcut for \"zdiff --cmp\""
|
||||||
echo
|
echo
|
||||||
|
@ -33,7 +33,7 @@ while [ x"$1" != x ] ; do
|
||||||
echo "compares FILE1 to the file with the corresponding decompressed file"
|
echo "compares FILE1 to the file with the corresponding decompressed file"
|
||||||
echo "name (removes the extension from FILE1). If FILE2 is omitted and FILE1"
|
echo "name (removes the extension from FILE1). If FILE2 is omitted and FILE1"
|
||||||
echo "is not compressed, compares FILE1 to the uncompressed contents of"
|
echo "is not compressed, compares FILE1 to the uncompressed contents of"
|
||||||
echo "FILE1.[gz|bz2|lz|xz] (the first one that is found)."
|
echo "FILE1.[bz2|gz|lz|xz] (the first one that is found)."
|
||||||
echo "DIFF_OPTIONS are passed directly to diff or cmp."
|
echo "DIFF_OPTIONS are passed directly to diff or cmp."
|
||||||
echo "The exit status from diff or cmp is preserved."
|
echo "The exit status from diff or cmp is preserved."
|
||||||
echo
|
echo
|
||||||
|
@ -73,10 +73,10 @@ done
|
||||||
for i in "$@" ; do
|
for i in "$@" ; do
|
||||||
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
||||||
else
|
else
|
||||||
if [ -f "$i" ]; then
|
if [ -f "$i" ] ; then
|
||||||
if [ -z "${file1}" ]; then file1="$i"
|
if [ -z "${file1}" ] ; then file1="$i"
|
||||||
else
|
else
|
||||||
if [ -z "${file2}" ]; then file2="$i"
|
if [ -z "${file2}" ] ; then file2="$i"
|
||||||
else
|
else
|
||||||
echo "$0: Too many files; use --help for usage." 1>&2
|
echo "$0: Too many files; use --help for usage." 1>&2
|
||||||
fi
|
fi
|
||||||
|
@ -88,27 +88,27 @@ for i in "$@" ; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${file1}" ]; then
|
if [ -z "${file1}" ] ; then
|
||||||
echo "$0: No files given; use --help for usage." 1>&2
|
echo "$0: No files given; use --help for usage." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${file2}" ]; then
|
if [ -z "${file2}" ] ; then
|
||||||
case "${file1}" in
|
case "${file1}" in
|
||||||
*.gz) file2=`printf "%s" "${file1}" | sed -e 's,.gz$,,'` ;;
|
|
||||||
*.tgz) file2=`printf "%s" "${file1}" | sed -e 's,tgz$,tar,'` ;;
|
|
||||||
*.bz2) file2=`printf "%s" "${file1}" | sed -e 's,.bz2$,,'` ;;
|
*.bz2) file2=`printf "%s" "${file1}" | sed -e 's,.bz2$,,'` ;;
|
||||||
*.tbz) file2=`printf "%s" "${file1}" | sed -e 's,tbz$,tar,'` ;;
|
*.tbz) file2=`printf "%s" "${file1}" | sed -e 's,tbz$,tar,'` ;;
|
||||||
*.tbz2) file2=`printf "%s" "${file1}" | sed -e 's,tbz2$,tar,'` ;;
|
*.tbz2) file2=`printf "%s" "${file1}" | sed -e 's,tbz2$,tar,'` ;;
|
||||||
|
*.gz) file2=`printf "%s" "${file1}" | sed -e 's,.gz$,,'` ;;
|
||||||
|
*.tgz) file2=`printf "%s" "${file1}" | sed -e 's,tgz$,tar,'` ;;
|
||||||
*.lz) file2=`printf "%s" "${file1}" | sed -e 's,.lz$,,'` ;;
|
*.lz) file2=`printf "%s" "${file1}" | sed -e 's,.lz$,,'` ;;
|
||||||
*.tlz) file2=`printf "%s" "${file1}" | sed -e 's,tlz$,tar,'` ;;
|
*.tlz) file2=`printf "%s" "${file1}" | sed -e 's,tlz$,tar,'` ;;
|
||||||
*.xz) file2=`printf "%s" "${file1}" | sed -e 's,.xz$,,'` ;;
|
*.xz) file2=`printf "%s" "${file1}" | sed -e 's,.xz$,,'` ;;
|
||||||
*.txz) file2=`printf "%s" "${file1}" | sed -e 's,txz$,tar,'` ;;
|
*.txz) file2=`printf "%s" "${file1}" | sed -e 's,txz$,tar,'` ;;
|
||||||
*)
|
*)
|
||||||
if [ -f "${file1}.gz" ]; then file2="${file1}.gz"
|
if [ -f "${file1}.bz2" ] ; then file2="${file1}.bz2"
|
||||||
elif [ -f "${file1}.bz2" ]; then file2="${file1}.bz2"
|
elif [ -f "${file1}.gz" ] ; then file2="${file1}.gz"
|
||||||
elif [ -f "${file1}.lz" ]; then file2="${file1}.lz"
|
elif [ -f "${file1}.lz" ] ; then file2="${file1}.lz"
|
||||||
elif [ -f "${file1}.xz" ]; then file2="${file1}.xz"
|
elif [ -f "${file1}.xz" ] ; then file2="${file1}.xz"
|
||||||
else
|
else
|
||||||
echo "$0: Compressed version of ${file1} not found; use --help for usage." 1>&2
|
echo "$0: Compressed version of ${file1} not found; use --help for usage." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -119,28 +119,22 @@ fi
|
||||||
prog1=
|
prog1=
|
||||||
prog2=
|
prog2=
|
||||||
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
if [ -f "${file1}" ]; then
|
if [ -f "${file1}" ] ; then
|
||||||
prog_name=`"${bindir}"zutils -t -- "${file1}"`
|
prog_name=`"${bindir}"zutils -t -- "${file1}"`
|
||||||
case "${prog_name}" in
|
case "${prog_name}" in
|
||||||
gzip) prog1=gzip ;;
|
bzip2 | gzip | lzip | xz) prog1=${prog_name} ;;
|
||||||
bzip2) prog1=bzip2 ;;
|
|
||||||
lzip) prog1=lzip ;;
|
|
||||||
xz) prog1=xz ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ -f "${file2}" ]; then
|
if [ -f "${file2}" ] ; then
|
||||||
prog_name=`"${bindir}"zutils -t -- "${file2}"`
|
prog_name=`"${bindir}"zutils -t -- "${file2}"`
|
||||||
case "${prog_name}" in
|
case "${prog_name}" in
|
||||||
gzip) prog2=gzip ;;
|
bzip2 | gzip | lzip | xz) prog2=${prog_name} ;;
|
||||||
bzip2) prog2=bzip2 ;;
|
|
||||||
lzip) prog2=lzip ;;
|
|
||||||
xz) prog2=xz ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
retval=0
|
retval=0
|
||||||
if [ -n "${prog1}" ]; then
|
if [ -n "${prog1}" ] ; then
|
||||||
if [ -n "${prog2}" ]; then
|
if [ -n "${prog2}" ] ; then
|
||||||
tmp_file=`mktemp "${TMPDIR:-/tmp}"/zdiff.XXXXXXXXXX` || {
|
tmp_file=`mktemp "${TMPDIR:-/tmp}"/zdiff.XXXXXXXXXX` || {
|
||||||
echo 'cannot create a temporary file' 1>&2
|
echo 'cannot create a temporary file' 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -154,7 +148,7 @@ if [ -n "${prog1}" ]; then
|
||||||
retval=$?
|
retval=$?
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -n "${prog2}" ]; then
|
if [ -n "${prog2}" ] ; then
|
||||||
${prog2} -cdfq -- "${file2}" | ${diff_prog} ${args} -- "${file1}" -
|
${prog2} -cdfq -- "${file2}" | ${diff_prog} ${args} -- "${file1}" -
|
||||||
retval=$?
|
retval=$?
|
||||||
else
|
else
|
||||||
|
|
34
zgrep.in
34
zgrep.in
|
@ -28,7 +28,7 @@ while [ x"$1" != x ] ; do
|
||||||
echo "specified, data is read from standard input, decompressed if needed, and"
|
echo "specified, data is read from standard input, decompressed if needed, and"
|
||||||
echo "fed to grep. Data read from standard input must be of the same type; all"
|
echo "fed to grep. Data read from standard input must be of the same type; all"
|
||||||
echo "uncompressed or all compressed with the same compressor."
|
echo "uncompressed or all compressed with the same compressor."
|
||||||
echo "The supported compressors are gzip, bzip2, lzip and xz."
|
echo "The supported compressors are bzip2, gzip, lzip and xz."
|
||||||
echo
|
echo
|
||||||
echo "Zegrep is a shortcut for \"zgrep -E\""
|
echo "Zegrep is a shortcut for \"zgrep -E\""
|
||||||
echo "Zfgrep is a shortcut for \"zgrep -F\""
|
echo "Zfgrep is a shortcut for \"zgrep -F\""
|
||||||
|
@ -71,26 +71,23 @@ while [ x"$1" != x ] ; do
|
||||||
-?*)
|
-?*)
|
||||||
args="${args} $1" ;;
|
args="${args} $1" ;;
|
||||||
*)
|
*)
|
||||||
if [ ${have_pat} = 0 ]; then args="${args} $1"; have_pat=1
|
if [ ${have_pat} = 0 ] ; then args="${args} $1"; have_pat=1
|
||||||
else break
|
else break
|
||||||
fi ;;
|
fi ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${have_pat} = 0 ]; then
|
if [ ${have_pat} = 0 ] ; then
|
||||||
echo "$0: Pattern not found; use --help for usage." 1>&2
|
echo "$0: Pattern not found; use --help for usage." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# = 0 ]; then
|
if [ $# = 0 ] ; then
|
||||||
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
prog_name=`"${bindir}"zutils -t`
|
prog_name=`"${bindir}"zutils -t`
|
||||||
case "${prog_name}" in
|
case "${prog_name}" in
|
||||||
gzip) prog="gzip -cdfq" ;;
|
bzip2 | gzip | lzip | xz) prog="${prog_name} -cdfq" ;;
|
||||||
bzip2) prog="bzip2 -cdfq" ;;
|
|
||||||
lzip) prog="lzip -cdfq" ;;
|
|
||||||
xz) prog="xz -cdfq" ;;
|
|
||||||
*) prog=cat ;;
|
*) prog=cat ;;
|
||||||
esac
|
esac
|
||||||
{ "${bindir}"zutils -m ${prog_name} ; cat ; } | ${prog} | grep ${args}
|
{ "${bindir}"zutils -m ${prog_name} ; cat ; } | ${prog} | grep ${args}
|
||||||
|
@ -101,30 +98,27 @@ retval=0
|
||||||
for i in "$@" ; do
|
for i in "$@" ; do
|
||||||
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
||||||
else
|
else
|
||||||
if [ ! -f "$i" ]; then
|
if [ ! -f "$i" ] ; then
|
||||||
if [ -f "$i.gz" ]; then i="$i.gz"
|
if [ -f "$i.gz" ] ; then i="$i.gz"
|
||||||
elif [ -f "$i.bz2" ]; then i="$i.bz2"
|
elif [ -f "$i.bz2" ] ; then i="$i.bz2"
|
||||||
elif [ -f "$i.lz" ]; then i="$i.lz"
|
elif [ -f "$i.lz" ] ; then i="$i.lz"
|
||||||
elif [ -f "$i.xz" ]; then i="$i.xz"
|
elif [ -f "$i.xz" ] ; then i="$i.xz"
|
||||||
else
|
else
|
||||||
echo "$0: File \"$i\" not found or not a regular file" 1>&2
|
echo "$0: File \"$i\" not found or not a regular file" 1>&2
|
||||||
if [ ${retval} = 0 ]; then retval=1 ; fi
|
if [ ${retval} = 0 ] ; then retval=1 ; fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
prog_name=`"${bindir}"zutils -t -- "$i"`
|
prog_name=`"${bindir}"zutils -t -- "$i"`
|
||||||
case "${prog_name}" in
|
case "${prog_name}" in
|
||||||
gzip) prog="gzip -cdfq" ;;
|
bzip2 | gzip | lzip | xz) prog="${prog_name} -cdfq" ;;
|
||||||
bzip2) prog="bzip2 -cdfq" ;;
|
|
||||||
lzip) prog="lzip -cdfq" ;;
|
|
||||||
xz) prog="xz -cdfq" ;;
|
|
||||||
*) prog=cat ;;
|
*) prog=cat ;;
|
||||||
esac
|
esac
|
||||||
if [ ${list} = 1 ]; then
|
if [ ${list} = 1 ] ; then
|
||||||
${prog} -- "$i" | grep ${args} 2>&1 > /dev/null && echo "$i"
|
${prog} -- "$i" | grep ${args} 2>&1 > /dev/null && echo "$i"
|
||||||
r=$?
|
r=$?
|
||||||
elif [ $# = 1 ] || [ ${no_name} = 1 ]; then
|
elif [ $# = 1 ] || [ ${no_name} = 1 ] ; then
|
||||||
${prog} -- "$i" | grep ${args}
|
${prog} -- "$i" | grep ${args}
|
||||||
r=$?
|
r=$?
|
||||||
else
|
else
|
||||||
|
|
102
ztest.in
Normal file
102
ztest.in
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# Ztest - Test integrity of compressed files.
|
||||||
|
# Copyright (C) 2009 Antonio Diaz Diaz.
|
||||||
|
#
|
||||||
|
# This script is free software: you have unlimited permission
|
||||||
|
# to copy, distribute and modify it.
|
||||||
|
|
||||||
|
LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
args=
|
||||||
|
recursive=0
|
||||||
|
two_hyphens=0
|
||||||
|
|
||||||
|
# Loop over args until a filename is found
|
||||||
|
while [ x"$1" != x ] ; do
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--help | --he* | -h)
|
||||||
|
echo "Ztest - Test integrity of compressed files."
|
||||||
|
echo
|
||||||
|
echo "Ztest verifies the integrity of the specified compressed files."
|
||||||
|
echo "Non-compressed files are ignored. If no files are specified, the"
|
||||||
|
echo "integrity of compressed data read from standard input is verified. Data"
|
||||||
|
echo "read from standard input must be all compressed with the same compressor."
|
||||||
|
echo "The supported compressors are bzip2, gzip, lzip and xz."
|
||||||
|
echo
|
||||||
|
echo "Usage: $0 [OPTIONS] [FILES]"
|
||||||
|
echo
|
||||||
|
echo "The exit status is 1 if any compressed file is corrupt, 0 otherwise."
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h, --help display this help and exit"
|
||||||
|
echo " -V, --version output version information and exit"
|
||||||
|
echo " -q, --quiet suppress all messages"
|
||||||
|
echo " -r, --recursive operate recursively on directories"
|
||||||
|
echo " -v, --verbose be verbose (a 2nd -v gives more)"
|
||||||
|
echo
|
||||||
|
echo "Report bugs to zutils-bug@nongnu.org"
|
||||||
|
echo "Zutils home page: http://www.nongnu.org/zutils/zutils.html"
|
||||||
|
exit 0 ;;
|
||||||
|
--version | --ve* | -V)
|
||||||
|
echo "Ztest VERSION"
|
||||||
|
echo "Copyright (C) 2009 Antonio Diaz Diaz."
|
||||||
|
echo "This script is free software: you have unlimited permission"
|
||||||
|
echo "to copy, distribute and modify it."
|
||||||
|
exit 0 ;;
|
||||||
|
-r | --re*)
|
||||||
|
recursive=1 ;;
|
||||||
|
-v | -vv | -vvv | --ve* | -q | --qu*)
|
||||||
|
args="${args} $1" ;;
|
||||||
|
--)
|
||||||
|
shift ; two_hyphens=1 ; break ;;
|
||||||
|
- | -?*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $# = 0 ] ; then
|
||||||
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
|
prog=`"${bindir}"zutils -t`
|
||||||
|
case "${prog}" in
|
||||||
|
bzip2 | gzip | lzip | xz)
|
||||||
|
;;
|
||||||
|
*) echo "$0: Unknown data format read from stdin" 1>&2
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
{ "${bindir}"zutils -m ${prog} ; cat ; } | ${prog} -t ${args}
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
retval=0
|
||||||
|
for i in "$@" ; do
|
||||||
|
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1
|
||||||
|
else
|
||||||
|
if [ ! -f "$i" ] ; then
|
||||||
|
if [ ${recursive} = 1 ] && [ -d "$i" ] ; then
|
||||||
|
bad_files=`find "$i" -type f \( -exec "$0" ${args} '{}' ';' -o -print \)`
|
||||||
|
if [ ${retval} = 0 ] && [ -n "${bad_files}" ] ; then retval=1 ; fi
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo "$0: File \"$i\" not found or not a regular file" 1>&2
|
||||||
|
if [ ${retval} = 0 ] ; then retval=1 ; fi
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
|
||||||
|
prog=`"${bindir}"zutils -t -- "$i"`
|
||||||
|
case "${prog}" in
|
||||||
|
bzip2 | gzip | lzip | xz)
|
||||||
|
;;
|
||||||
|
*) continue ;;
|
||||||
|
esac
|
||||||
|
${prog} -t ${args} -- "$i"
|
||||||
|
r=$?
|
||||||
|
if [ $r != 0 ] ; then retval=$r ; fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit ${retval}
|
Loading…
Add table
Reference in a new issue