diff options
Diffstat (limited to '')
-rw-r--r-- | zcat.in | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -8,7 +8,6 @@ LC_ALL=C export LC_ALL args= -default_prog=gzip two_hyphens=0 # Loop over args until a filename is found @@ -23,8 +22,9 @@ while [ x"$1" != x ] ; do 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 "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 "uncompressed or all compressed with the same compressor." echo "The supported compressors are gzip, bzip2, lzip and xz." echo echo "Usage: $0 [OPTIONS] [CAT_OPTIONS] [FILES]" @@ -35,10 +35,6 @@ 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" @@ -49,14 +45,6 @@ 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) ;; --) @@ -70,7 +58,16 @@ while [ x"$1" != x ] ; do done if [ $# = 0 ]; then - ${default_prog} -cdfq | cat ${args} + bindir=`echo "$0" | sed -e 's,[^/]*$,,'` + prog_name=`"${bindir}"zutils -t` + case "${prog_name}" in + gzip) prog="gzip -cdfq" ;; + bzip2) prog="bzip2 -cdfq" ;; + lzip) prog="lzip -cdfq" ;; + xz) prog="xz -cdfq" ;; + *) prog=cat ;; + esac + { "${bindir}"zutils -m ${prog_name} ; cat ; } | ${prog} | cat ${args} exit $? fi |