diff options
Diffstat (limited to 'zcat.in')
-rw-r--r-- | zcat.in | 31 |
1 files changed, 25 insertions, 6 deletions
@@ -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 |