2010-01-29 15:00:15 +01:00
|
|
|
Index: zgrep.in
|
|
|
|
===================================================================
|
|
|
|
--- zgrep.in.orig
|
2006-12-15 18:09:13 +01:00
|
|
|
+++ zgrep.in
|
2010-09-19 20:10:36 +02:00
|
|
|
@@ -176,13 +176,21 @@ res=0
|
2006-12-15 18:09:13 +01:00
|
|
|
|
2007-01-08 22:52:58 +01:00
|
|
|
for i
|
|
|
|
do
|
2006-12-15 18:09:13 +01:00
|
|
|
+ case $i in
|
|
|
|
+ *.bz2)
|
|
|
|
+ uncompress=bzip2
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ uncompress=gzip
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
2007-01-08 22:52:58 +01:00
|
|
|
# Fail if gzip or grep (or sed) fails.
|
|
|
|
gzip_status=$(
|
|
|
|
exec 5>&1
|
2010-09-19 20:10:36 +02:00
|
|
|
if test $pat_on_stdin -eq 1; then
|
|
|
|
eval "exec $pat_fd<&0"
|
|
|
|
fi
|
2007-01-08 22:52:58 +01:00
|
|
|
- (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
|
|
|
|
+ ($uncompress -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
|
2006-12-15 18:09:13 +01:00
|
|
|
if test $files_with_matches -eq 1; then
|
2007-01-08 22:52:58 +01:00
|
|
|
eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; }
|
2006-12-15 18:09:13 +01:00
|
|
|
elif test $files_without_matches -eq 1; then
|