--- gzip-1.3.5/zgrep.in.orig 2005-05-19 15:05:49 +0000 +++ gzip-1.3.5/zgrep.in 2005-05-19 15:25:30 +0000 @@ -92,23 +92,28 @@ if test $# -eq 0; then fi res=0 +trap break PIPE for i do gzip -cdfq "$i" | if test $files_with_matches -eq 1; then - $grep $opt "$pat" > /dev/null && echo $i + $grep -q $opt "$pat" && printf '%s\n' "$i" elif test $files_without_matches -eq 1; then - $grep $opt "$pat" > /dev/null || echo $i + $grep -q $opt "$pat" || printf '%s\n' "$i" elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then $grep $opt "$pat" else + i="$(printf %s "$i" |tr '\n' ' ' |sed -e 's/[\\|&]/\\&/g')" if test $with_filename -eq 1; then sed_script="s|^[^:]*:|${i}:|" else sed_script="s|^|${i}:|" fi - $grep $opt "$pat" | sed "$sed_script" + $grep $opt "$pat" | sed -e "$sed_script" fi r=$? test $res -lt $r && res=$r + # signo + 128 + test "$r" -gt 128 && exit $res done +trap - PIPE exit $res