summaryrefslogtreecommitdiffstats
path: root/zcat.in
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 16:11:40 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 16:11:40 +0000
commit1d1dc8b97e1cc23b97c1a8053020ce61a0cd1e84 (patch)
treed8f3bdaa398a4228bda811cc30525e16d29987f2 /zcat.in
parentAdding debian version 0.4-1. (diff)
downloadzutils-1d1dc8b97e1cc23b97c1a8053020ce61a0cd1e84.tar.xz
zutils-1d1dc8b97e1cc23b97c1a8053020ce61a0cd1e84.zip
Merging upstream version 0.5.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'zcat.in')
-rw-r--r--zcat.in31
1 files changed, 25 insertions, 6 deletions
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