1
0
Fork 0

Adding upstream version 0.6.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 04:57:56 +01:00
parent 557010b363
commit c2bdc739f1
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
14 changed files with 207 additions and 172 deletions

View file

@ -8,7 +8,6 @@
LC_ALL=C
export LC_ALL
args=
default_prog=gzip
have_pat=0
list=0
no_name=0
@ -26,8 +25,9 @@ while [ x"$1" != x ] ; do
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. If no files are"
echo "specified, the standard input is decompressed using the selected"
echo "compressor and fed to grep."
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 "uncompressed or all compressed with the same compressor."
echo "The supported compressors are gzip, bzip2, lzip and xz."
echo
echo "Zegrep is a shortcut for \"zgrep -E\""
@ -41,10 +41,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"
@ -55,14 +51,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 ;;
-[drRzZ] | --di* | --exc* | --inc* | --nu* | --rec*)
echo "$0: option $1 not supported"
exit 1 ;;
@ -96,7 +84,16 @@ if [ ${have_pat} = 0 ]; then
fi
if [ $# = 0 ]; then
${default_prog} -cdfq | grep ${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} | grep ${args}
exit $?
fi