Re: [PATCH 3/7] grep: --count over binary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 13, 2010 at 10:37:10PM +0200, René Scharfe wrote:
> The intent of showing the message "Binary file xyz matches" for
> binary files is to avoid annoying users by potentially messing up
> their terminals by printing control characters.  In --count mode,
> this precaution isn't necessary.
> 
> Display counts of matches if -c/--count was specified, even if -a
> was not given.  GNU grep does the same.

It is also not necessary with '-l' and '-L' options. (At least, if
we follow GNU grep).

> --- a/grep.c
> +++ b/grep.c
> @@ -802,7 +802,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
>  
>  	switch (opt->binary) {
>  	case GREP_BINARY_DEFAULT:
> -		if (buffer_is_binary(buf, size))
> +		if (!opt->count && buffer_is_binary(buf, size))
>  			binary_match_only = 1;

So, I believe it should be:

		if (!opt->count && !opt->name_only && !opt->unmatch_name_only &&
				buffer_is_binary(buf, size))


Dmitry
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]