1
0
Fork 0

Adding patch from upstream to make filenames not prefixed to output by default when searching one file (Closes: #694024).

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 05:39:07 +01:00
parent 83d65fd62e
commit d65039fbd5
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
2 changed files with 55 additions and 0 deletions

54
debian/patches/01-filename.patch vendored Normal file
View file

@ -0,0 +1,54 @@
Author: Antonio Diaz Diaz <ant_diaz@teleline.es>
Description:
Make 'grep_show_name' tri-state so that file name is no prefixed to output by
default when searching one file.
diff -Naurp zutils.orig/doc/zutils.info zutils/doc/zutils.info
--- zutils.orig/doc/zutils.info 2012-12-10 11:18:56.507741935 +0100
+++ zutils/doc/zutils.info 2012-12-10 11:21:49.519773976 +0100
@@ -389,7 +389,8 @@ matches were found, and 2 means trouble.
`-h'
`--no-filename'
- Suppress the prefixing filename on output.
+ Suppress the prefixing of filenames on output when multiple files
+ are searched.
`-H'
`--with-filename'
diff -Naurp zutils.orig/doc/zutils.texinfo zutils/doc/zutils.texinfo
--- zutils.orig/doc/zutils.texinfo 2012-12-10 11:18:56.507741935 +0100
+++ zutils/doc/zutils.texinfo 2012-12-10 11:21:49.519773976 +0100
@@ -432,7 +432,8 @@ Treat @var{pattern} as a set of newline-
@item -h
@itemx --no-filename
-Suppress the prefixing filename on output.
+Suppress the prefixing of filenames on output when multiple files are
+searched.
@item -H
@itemx --with-filename
diff -Naurp zutils.orig/main.cc zutils/main.cc
--- zutils.orig/main.cc 2012-12-10 11:18:56.507741935 +0100
+++ zutils/main.cc 2012-12-10 11:21:49.519773976 +0100
@@ -243,8 +243,8 @@ int main( const int argc, const char * c
return ( program_mode == m_zcat ) ? 1 : 2; }
int argind = 0;
+ int grep_show_name = -1;
bool grep_list = false;
- bool grep_show_name = true;
bool grep_pattern_found = false;
for( ; argind < parser.arguments(); ++argind )
{
@@ -350,6 +350,9 @@ int main( const int argc, const char * c
if( filenames.empty() ) filenames.push_back("-");
+ if( grep_show_name < 0 && filenames.size() == 1 )
+ grep_show_name = false;
+
int retval = ( ( program_mode == m_zgrep ) ? 1 : 0 );
while( !filenames.empty() )
{

1
debian/patches/series vendored Normal file
View file

@ -0,0 +1 @@
01-filename.patch