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