Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3-0]: src/usr.bin/gzip Pull up revision 1.6 (requested by nakayam...
details: https://anonhg.NetBSD.org/src/rev/c758820e3f0e
branches: netbsd-3-0
changeset: 579481:c758820e3f0e
user: jdc <jdc%NetBSD.org@localhost>
date: Sun May 11 07:17:22 2008 +0000
description:
Pull up revision 1.6 (requested by nakayama in ticket #1927).
grep "-H" option (print the filename for each match) always prints
filenames whether "-h" option (suppress filenames when multiple files
are searched) is speficied or not.
Make zgrep "-h" option actually works with using "-H" option only
when "-h" is not specified.
diffstat:
usr.bin/gzip/zgrep | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (44 lines):
diff -r 90c7153583f9 -r c758820e3f0e usr.bin/gzip/zgrep
--- a/usr.bin/gzip/zgrep Tue Apr 08 22:00:37 2008 +0000
+++ b/usr.bin/gzip/zgrep Sun May 11 07:17:22 2008 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: zgrep,v 1.4 2004/05/25 07:09:09 mrg Exp $
+# $NetBSD: zgrep,v 1.4.4.1 2008/05/11 07:17:22 jdc Exp $
#
# Copyright (c) 2003 Thomas Klausner.
#
@@ -32,6 +32,7 @@
endofopts=0
pattern_found=0
grep_args=""
+silent=0
prg=$0
@@ -74,6 +75,10 @@
-)
endofopts=1
;;
+ -h)
+ silent=1
+ shift
+ ;;
-*)
grep_args="${grep_args} $1"
shift
@@ -104,9 +109,12 @@
${zcat} -fq - | ${grep} ${grep_args} "${pattern}" -
else
# ... on all files given on the command line
+ if [ ${silent} -lt 1 ]; then
+ grep_args="-H ${grep_args}"
+ fi
while [ $# -gt 0 ]
do
- ${zcat} -fq -- "$1" | ${grep} -H --label="${1}" "${pattern}" ${grep_args} -
+ ${zcat} -fq -- "$1" | ${grep} --label="${1}" "${pattern}" ${grep_args} -
shift
done
fi
Home |
Main Index |
Thread Index |
Old Index