This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: check_GNU_style.sh: Don't cat empty file
- From: Andreas Schwab <schwab at suse dot de>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 18 May 2015 10:31:09 +0200
- Subject: Re: check_GNU_style.sh: Don't cat empty file
- Authentication-results: sourceware.org; auth=none
- References: <5559927B dot 4090305 at mentor dot com>
Tom de Vries <Tom_deVries@mentor.com> writes:
> diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
> index 728c11a..ab59b1e 100755
> --- a/contrib/check_GNU_style.sh
> +++ b/contrib/check_GNU_style.sh
> @@ -84,10 +84,16 @@ grep $format '^+' $files \
> g (){
> local msg="$1"
> local arg="$2"
> +
> + local found=false
> cat $inp \
> | egrep --color=always -- "$arg" \
> - > $tmp && printf "\n$msg\n"
> - cat $tmp
> + > "$tmp" && found=true
> +
> + if $found; then
cat $inp \
| egrep --color=always -- "$arg" \
> $tmp && {
printf "\n$msg\n"
cat $tmp
}
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."