check_GNU_style.sh: Don't cat empty file
Andreas Schwab
schwab@suse.de
Mon May 18 08:41:00 GMT 2015
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."
More information about the Gcc-patches
mailing list