summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog8
-rw-r--r--NEWS6
-rwxr-xr-xconfigure4
-rw-r--r--doc/zcat.128
-rw-r--r--doc/zdiff.14
-rw-r--r--doc/zgrep.120
-rw-r--r--doc/zutils.14
-rw-r--r--doc/zutils.infobin5792 -> 6266 bytes
-rw-r--r--doc/zutils.texinfo40
-rwxr-xr-xtestsuite/check.sh27
-rw-r--r--zcat.in31
-rw-r--r--zgrep.in22
12 files changed, 158 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index da3a5dc..18e4f63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-01 Antonio Diaz Diaz <ant_diaz@teleline.es>
+
+ * Version 0.5 released.
+ * zcat.in, zgrep.in: Read again data from stdin.
+ * Added again default compressor for stdin only.
+
2009-09-17 Antonio Diaz Diaz <ant_diaz@teleline.es>
* Version 0.4 released.
@@ -8,7 +14,7 @@
* Version 0.3 released.
* Removed default compressor.
- * zcat.in: Do not read data from stdin.
+ * zcat.in, zgrep.in: Do not read data from stdin.
* Updated home page and mailing list addresses.
2009-08-13 Antonio Diaz Diaz <ant_diaz@teleline.es>
diff --git a/NEWS b/NEWS
index 0ad827a..1a2e3e2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,3 @@
-Changes in version 0.4:
+Changes in version 0.5:
-Two new utilities have been added; zegrep and zfgrep.
-
-Zutils now recognizes file formats independently of filename extensions.
+Zcat, zegrep, zfgrep and zgrep can read again compressed data from stdin.
diff --git a/configure b/configure
index 6077f61..a6d757c 100755
--- a/configure
+++ b/configure
@@ -5,12 +5,12 @@
# This configure script is free software: you have unlimited permission
# to copy, distribute and modify it.
#
-# Date of this version: 2009-09-17
+# Date of this version: 2009-10-01
args=
no_create=
progname=zutils
-progversion=0.4
+progversion=0.5
srctrigger=zdiff.in
# clear some things potentially inherited from environment.
diff --git a/doc/zcat.1 b/doc/zcat.1
index a4d82db..10737a2 100644
--- a/doc/zcat.1
+++ b/doc/zcat.1
@@ -1,18 +1,20 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
-.TH ZCAT "1" "September 2009" "Zcat 0.4" "User Commands"
+.TH ZCAT "1" "October 2009" "Zcat 0.5" "User Commands"
.SH NAME
-Zcat \- manual page for Zcat 0.4
+Zcat \- manual page for Zcat 0.5
.SH SYNOPSIS
.B zcat
[\fIOPTIONS\fR] [\fICAT_OPTIONS\fR] [\fIFILES\fR]
.SH DESCRIPTION
Zcat \- Cat wrapper for compressed files.
.PP
-Zcat is a wrapper script around the cat command that allows
-transparent concatenation of any combination of compressed and
-non\-compressed files. If any given file is compressed, its uncompressed
-content is used. If a given file does not exist, zcat tries the
-compressed file names corresponding to the supported compressors.
+Zcat is a wrapper script around the cat command that allows transparent
+concatenation of any combination of compressed and non\-compressed files.
+If any given file is compressed, its uncompressed content is used. If a
+given file does not exist, zcat tries the compressed file names
+corresponding to the supported compressors. If no files are specified,
+the standard input is decompressed using the selected compressor and
+sent to stdout.
The supported compressors are gzip, bzip2, lzip and xz.
.PP
CAT_OPTIONS are passed directly to cat.
@@ -24,6 +26,18 @@ display this help and exit
.TP
\fB\-V\fR, \fB\-\-version\fR
output version information and exit
+.TP
+\fB\-\-gzip\fR
+use gzip as decompressor for stdin (default)
+.TP
+\fB\-\-bzip2\fR
+use bzip2 as decompressor for stdin
+.TP
+\fB\-\-lzip\fR
+use lzip as decompressor for stdin
+.TP
+\fB\-\-xz\fR
+use xz as decompressor for stdin
.SH "REPORTING BUGS"
Report bugs to zutils\-bug@nongnu.org
Zutils home page: http://www.nongnu.org/zutils/zutils.html
diff --git a/doc/zdiff.1 b/doc/zdiff.1
index cbada53..3509c21 100644
--- a/doc/zdiff.1
+++ b/doc/zdiff.1
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
-.TH ZDIFF "1" "September 2009" "Zdiff 0.4" "User Commands"
+.TH ZDIFF "1" "October 2009" "Zdiff 0.5" "User Commands"
.SH NAME
-Zdiff \- manual page for Zdiff 0.4
+Zdiff \- manual page for Zdiff 0.5
.SH SYNOPSIS
.B zdiff
[\fIOPTIONS\fR] [\fIDIFF_OPTIONS\fR] \fIFILE1 \fR[\fIFILE2\fR]
diff --git a/doc/zgrep.1 b/doc/zgrep.1
index fadbbc0..3db747b 100644
--- a/doc/zgrep.1
+++ b/doc/zgrep.1
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
-.TH ZGREP "1" "September 2009" "Zgrep 0.4" "User Commands"
+.TH ZGREP "1" "October 2009" "Zgrep 0.5" "User Commands"
.SH NAME
-Zgrep \- manual page for Zgrep 0.4
+Zgrep \- manual page for Zgrep 0.5
.SH SYNOPSIS
.B zgrep
[\fIOPTIONS\fR] [\fIGREP_OPTIONS\fR] \fIPATTERN \fR[\fIFILES\fR]
@@ -12,7 +12,9 @@ Zgrep is a wrapper script around the grep command that allows
transparent search on any combination of compressed and non\-compressed
files. If any given file is compressed, its uncompressed content is
used. If a given file does not exist, zgrep tries the compressed file
-names corresponding to the supported compressors.
+names corresponding to the supported compressors. If no files are
+specified, the standard input is decompressed using the selected
+compressor and fed to grep.
The supported compressors are gzip, bzip2, lzip and xz.
.PP
Zegrep is a shortcut for "zgrep \fB\-E\fR"
@@ -27,6 +29,18 @@ display this help and exit
.TP
\fB\-V\fR, \fB\-\-version\fR
output version information and exit
+.TP
+\fB\-\-gzip\fR
+use gzip as decompressor for stdin (default)
+.TP
+\fB\-\-bzip2\fR
+use bzip2 as decompressor for stdin
+.TP
+\fB\-\-lzip\fR
+use lzip as decompressor for stdin
+.TP
+\fB\-\-xz\fR
+use xz as decompressor for stdin
.SH "REPORTING BUGS"
Report bugs to zutils\-bug@nongnu.org
Zutils home page: http://www.nongnu.org/zutils/zutils.html
diff --git a/doc/zutils.1 b/doc/zutils.1
index 14c33b7..4836ace 100644
--- a/doc/zutils.1
+++ b/doc/zutils.1
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
-.TH ZUTILS "1" "September 2009" "Zutils 0.4" "User Commands"
+.TH ZUTILS "1" "October 2009" "Zutils 0.5" "User Commands"
.SH NAME
-Zutils \- manual page for Zutils 0.4
+Zutils \- manual page for Zutils 0.5
.SH SYNOPSIS
.B zutils
[\fIoptions\fR] [\fIfiles\fR]
diff --git a/doc/zutils.info b/doc/zutils.info
index caa2371..e2d3258 100644
--- a/doc/zutils.info
+++ b/doc/zutils.info
Binary files differ
diff --git a/doc/zutils.texinfo b/doc/zutils.texinfo
index ccadf05..76f771b 100644
--- a/doc/zutils.texinfo
+++ b/doc/zutils.texinfo
@@ -5,8 +5,8 @@
@finalout
@c %**end of header
-@set UPDATED 17 September 2009
-@set VERSION 0.4
+@set UPDATED 1 October 2009
+@set VERSION 0.5
@dircategory Data Compression
@direntry
@@ -67,8 +67,9 @@ Zcat is a wrapper script around the cat command that allows transparent
concatenation of any combination of compressed and non-compressed files.
If any given file is compressed, its uncompressed content is used. If a
given file does not exist, zcat tries the compressed file names
-corresponding to the supported compressors. The supported compressors
-are gzip, bzip2, lzip and xz.
+corresponding to the supported compressors. If no files are specified,
+the standard input is decompressed using the selected compressor and
+sent to stdout.
The format for running zcat is:
@@ -91,6 +92,18 @@ Print an informative help message describing the options and exit.
@itemx -V
Print the version number of zcat on the standard output and exit.
+@item --gzip
+Use gzip as decompressor for stdin (default).
+
+@item --bzip2
+Use bzip2 as decompressor for stdin.
+
+@item --lzip
+Use lzip as decompressor for stdin.
+
+@item --xz
+Use xz as decompressor for stdin.
+
@end table
@@ -102,7 +115,7 @@ Print the version number of zcat on the standard output and exit.
Zdiff is a wrapper script around the diff and cmp commands that allows
transparent comparison of any combination of compressed and
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.
@noindent
Zcmp is a shortcut for @samp{zdiff --cmp}
@@ -156,8 +169,9 @@ Zgrep is a wrapper script around the grep command that allows
transparent search on any combination of compressed and non-compressed
files. If any given file is compressed, its uncompressed content is
used. If a given file does not exist, zgrep tries the compressed file
-names corresponding to the supported compressors. The supported
-compressors are gzip, bzip2, lzip and xz.
+names corresponding to the supported compressors. If no files are
+specified, the standard input is decompressed using the selected
+compressor and fed to grep.
@noindent
Zegrep is a shortcut for @samp{zgrep -E}@*
@@ -185,6 +199,18 @@ Print an informative help message describing the options and exit.
@itemx -V
Print the version number of zgrep on the standard output and exit.
+@item --gzip
+Use gzip as decompressor for stdin (default).
+
+@item --bzip2
+Use bzip2 as decompressor for stdin.
+
+@item --lzip
+Use lzip as decompressor for stdin.
+
+@item --xz
+Use xz as decompressor for stdin.
+
@end table
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 7af54ac..a8843f3 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -25,7 +25,7 @@ if [ ! -x "${ZCAT}" ] ; then
exit 1
fi
-if [ -d tmp ] ; then rm -r tmp ; fi
+if [ -d tmp ] ; then rm -rf tmp ; fi
mkdir tmp
echo -n "testing zutils..."
cd "${objdir}"/tmp
@@ -49,6 +49,21 @@ for i in ${extensions}; do
echo -n .
done
+"${ZCAT}" < in > copy || fail=1
+cmp in copy || fail=1
+echo -n .
+"${ZCAT}" < in.gz > copy || fail=1
+cmp in copy || fail=1
+echo -n .
+"${ZCAT}" --gzip < in.gz > copy || fail=1
+cmp in copy || fail=1
+echo -n .
+"${ZCAT}" --bzip2 < in.bz2 > copy || fail=1
+cmp in copy || fail=1
+echo -n .
+"${ZCAT}" --lzip < in.lz > copy || fail=1
+cmp in copy || fail=1
+echo -n .
"${ZCAT}" in > copy || fail=1
cmp in copy || fail=1
echo -n .
@@ -103,6 +118,16 @@ for i in ${extensions}; do
echo -n .
done
+"${ZGREP}" License < in 2>&1 > /dev/null || fail=1
+echo -n .
+"${ZGREP}" License < in.gz 2>&1 > /dev/null || fail=1
+echo -n .
+"${ZGREP}" --gzip License < in.gz 2>&1 > /dev/null || fail=1
+echo -n .
+"${ZGREP}" --bzip2 License < in.bz2 2>&1 > /dev/null || fail=1
+echo -n .
+"${ZGREP}" --lzip License < in.lz 2>&1 > /dev/null || fail=1
+echo -n .
"${ZGREP}" License in 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" License -- -in- 2>&1 > /dev/null || fail=1
diff --git a/zcat.in b/zcat.in
index 9b7edf5..0721e60 100644
--- a/zcat.in
+++ b/zcat.in
@@ -8,6 +8,7 @@
LC_ALL=C
export LC_ALL
args=
+default_prog=gzip
two_hyphens=0
# Loop over args until a filename is found
@@ -17,11 +18,13 @@ while [ x"$1" != x ] ; do
--help | --he* | -h)
echo "Zcat - Cat wrapper for compressed files."
echo
- echo "Zcat is a wrapper script around the cat command that allows"
- echo "transparent concatenation of any combination of compressed and"
- echo "non-compressed files. If any given file is compressed, its uncompressed"
- echo "content is used. If a given file does not exist, zcat tries the"
- echo "compressed file names corresponding to the supported compressors."
+ echo "Zcat is a wrapper script around the cat command that allows transparent"
+ echo "concatenation of any combination of compressed and non-compressed files."
+ echo "If any given file is compressed, its uncompressed content is used. If a"
+ echo "given file does not exist, zcat tries the compressed file names"
+ echo "corresponding to the supported compressors. If no files are specified,"
+ echo "the standard input is decompressed using the selected compressor and"
+ echo "sent to stdout."
echo "The supported compressors are gzip, bzip2, lzip and xz."
echo
echo "Usage: $0 [OPTIONS] [CAT_OPTIONS] [FILES]"
@@ -32,6 +35,10 @@ while [ x"$1" != x ] ; do
echo "Options:"
echo " -h, --help display this help and exit"
echo " -V, --version output version information and exit"
+ echo " --gzip use gzip as decompressor for stdin (default)"
+ echo " --bzip2 use bzip2 as decompressor for stdin"
+ echo " --lzip use lzip as decompressor for stdin"
+ echo " --xz use xz as decompressor for stdin"
echo
echo "Report bugs to zutils-bug@nongnu.org"
echo "Zutils home page: http://www.nongnu.org/zutils/zutils.html"
@@ -42,7 +49,15 @@ while [ x"$1" != x ] ; do
echo "This script is free software: you have unlimited permission"
echo "to copy, distribute and modify it."
exit 0 ;;
- -)
+ --gz*)
+ default_prog=gzip ;;
+ --bz*)
+ default_prog=bzip2 ;;
+ --lz*)
+ default_prog=lzip ;;
+ --xz*)
+ default_prog=xz ;;
+ - | -f)
;;
--)
shift ; two_hyphens=1 ; break ;;
@@ -54,6 +69,10 @@ while [ x"$1" != x ] ; do
shift
done
+if [ $# = 0 ]; then
+ ${default_prog} -cdfq | cat ${args}
+ exit $?
+fi
retval=0
for i in "$@" ; do
diff --git a/zgrep.in b/zgrep.in
index 228cbd9..ab004b7 100644
--- a/zgrep.in
+++ b/zgrep.in
@@ -8,6 +8,7 @@
LC_ALL=C
export LC_ALL
args=
+default_prog=gzip
have_pat=0
list=0
no_name=0
@@ -24,7 +25,9 @@ while [ x"$1" != x ] ; do
echo "transparent search on any combination of compressed and non-compressed"
echo "files. If any given file is compressed, its uncompressed content is"
echo "used. If a given file does not exist, zgrep tries the compressed file"
- echo "names corresponding to the supported compressors."
+ echo "names corresponding to the supported compressors. If no files are"
+ echo "specified, the standard input is decompressed using the selected"
+ echo "compressor and fed to grep."
echo "The supported compressors are gzip, bzip2, lzip and xz."
echo
echo "Zegrep is a shortcut for \"zgrep -E\""
@@ -38,6 +41,10 @@ while [ x"$1" != x ] ; do
echo "Options:"
echo " -h, --help display this help and exit"
echo " -V, --version output version information and exit"
+ echo " --gzip use gzip as decompressor for stdin (default)"
+ echo " --bzip2 use bzip2 as decompressor for stdin"
+ echo " --lzip use lzip as decompressor for stdin"
+ echo " --xz use xz as decompressor for stdin"
echo
echo "Report bugs to zutils-bug@nongnu.org"
echo "Zutils home page: http://www.nongnu.org/zutils/zutils.html"
@@ -48,6 +55,14 @@ while [ x"$1" != x ] ; do
echo "This script is free software: you have unlimited permission"
echo "to copy, distribute and modify it."
exit 0 ;;
+ --gz*)
+ default_prog=gzip ;;
+ --bz*)
+ default_prog=bzip2 ;;
+ --lz*)
+ default_prog=lzip ;;
+ --xz*)
+ default_prog=xz ;;
-[drRzZ] | --di* | --exc* | --inc* | --nu* | --rec*)
echo "$0: option $1 not supported"
exit 1 ;;
@@ -80,6 +95,11 @@ if [ ${have_pat} = 0 ]; then
exit 1
fi
+if [ $# = 0 ]; then
+ ${default_prog} -cdfq | grep ${args}
+ exit $?
+fi
+
retval=0
for i in "$@" ; do
if [ "$i" = "--" ] && [ ${two_hyphens} = 0 ] ; then two_hyphens=1