This commit is contained in:
committed by
Git OBS Bridge
parent
d54774ae10
commit
fd3dbe9010
38
zgrep.diff
38
zgrep.diff
@@ -1,33 +1,9 @@
|
||||
--- zgrep.in
|
||||
+++ zgrep.in
|
||||
@@ -102,13 +102,36 @@
|
||||
fi
|
||||
@@ -149,10 +149,18 @@
|
||||
|
||||
if test $# -eq 0; then
|
||||
- gzip -cdfq | $grep $opt "$pat"
|
||||
- exit $?
|
||||
+ if type -p dd > /dev/null 2>&1 &&
|
||||
+ type -p mimencode > /dev/null 2>&1 &&
|
||||
+ type -p file > /dev/null 2>&1
|
||||
+ then
|
||||
+ uncompress=gzip
|
||||
+ x=`dd bs=20 count=1 2> /dev/null | mimencode -b`
|
||||
+ case `echo -n $x | mimencode -u -b | file -b -` in
|
||||
+ bzip2*)
|
||||
+ uncompress=bzip2
|
||||
+ ;;
|
||||
+ esac
|
||||
+ (echo -n $x | mimencode -u -b; cat -) | $uncompress -cdfq | $grep $opt "$pat"
|
||||
+ exit $?
|
||||
+ else
|
||||
+ gzip -cdfq | $grep $opt "$pat"
|
||||
+ exit $?
|
||||
+ fi
|
||||
fi
|
||||
|
||||
res=0
|
||||
for i do
|
||||
- gzip -cdfq -- "$i" |
|
||||
for i
|
||||
do
|
||||
+ case $i in
|
||||
+ *.bz2)
|
||||
+ uncompress=bzip2
|
||||
@@ -36,7 +12,11 @@
|
||||
+ uncompress=gzip
|
||||
+ ;;
|
||||
+ esac
|
||||
+ $uncompress -cdfq "$i" |
|
||||
# Fail if gzip or grep (or sed) fails.
|
||||
gzip_status=$(
|
||||
exec 5>&1
|
||||
- (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
|
||||
+ ($uncompress -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
|
||||
if test $files_with_matches -eq 1; then
|
||||
$grep $opt "$pat" > /dev/null && printf '%s\n' "$i"
|
||||
eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; }
|
||||
elif test $files_without_matches -eq 1; then
|
||||
|
Reference in New Issue
Block a user