This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: check_GNU_style.sh: Don't cat empty file


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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]