Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: src/scripts/xzgrep.in

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scripts/xzgrep.1 ('k') | src/scripts/xzless.1 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/xzgrep.in
===================================================================
--- src/scripts/xzgrep.in (revision 50504)
+++ src/scripts/xzgrep.in (working copy)
@@ -27,7 +27,7 @@
xz='@xz@ --format=auto'
unset GZIP BZIP BZIP2
-case ${0##/*} in
+case ${0##*/} in
*egrep*) prog=xzegrep; grep=${GREP:-egrep};;
*fgrep*) prog=xzfgrep; grep=${GREP:-fgrep};;
*) prog=xzgrep; grep=${GREP:-grep};;
@@ -35,7 +35,7 @@
version="$prog (@PACKAGE_NAME@) @VERSION@"
-usage="Usage: ${0##/*} [OPTION]... [-e] PATTERN [FILE]...
+usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
Look for instances of PATTERN in the input FILEs, using their
uncompressed contents if they are compressed.
@@ -126,6 +126,10 @@
grep="$grep $option$optarg"
done
+if test $files_with_matches -eq 1 || test $files_without_matches -eq 1; then
+ grep="$grep -q"
+fi
+
eval "set -- $operands "'${1+"$@"}'
if test $have_pat -eq 0; then
@@ -156,9 +160,9 @@
exec 5>&1
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
if test $files_with_matches -eq 1; then
- eval "$grep" -q && { printf '%s\n' "$i" || exit 2; }
+ eval "$grep" && { printf '%s\n' "$i" || exit 2; }
elif test $files_without_matches -eq 1; then
- eval "$grep" -q || {
+ eval "$grep" || {
r=$?
if test $r -eq 1; then
printf '%s\n' "$i" || r=2
« no previous file with comments | « src/scripts/xzgrep.1 ('k') | src/scripts/xzless.1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698