Julia,
        Add a script to determine if $COCCI is a directory. 
        If $COCCI is undefined, means first if branch success, then first if 
branch is executed. 
        If $COCCI is defined, means that fails, then elif branch is executed. 
And then, The elif branch judges whether $COCCI is a directory(based on "-d" 
option). 
        If it is a directory, the next statement is executed. If it is not a 
directory or if it is just a file with a a suffix of cocci, the statement after 
the final else branch is executed.
Thanks for you reply,
zhong.shiqi





E: zhong.sh...@zte.com.cn
www.zte.com.cn
------------------Original Mail------------------
Sender: JuliaLawall <julia.law...@lip6.fr>
To: zhongshiqi10265867;
CC: julia.law...@lip6.fr <julia.law...@lip6.fr>Gilles Muller 
<gilles.mul...@lip6.fr>nicolas.pa...@imag.fr 
<nicolas.pa...@imag.fr>michal.l...@markovi.net 
<michal.l...@markovi.net>cocci@systeme.lip6.fr 
<cocci@systeme.lip6.fr>linux-ker...@vger.kernel.org 
<linux-ker...@vger.kernel.org>xue zhihong10017789;wang yi10129963;cheng 
shengyu10013557;yamada.masah...@socionext.com <yamada.masah...@socionext.com>
Date: 2019/10/23 16:55
Subject: Re: [PATCH] Configuring COCCI parameter as a directory issupportted


On Wed, 23 Oct 2019, zhongshiqi wrote:

> This patch puts a modification in scripts/coccicheck which supports users
> in configuring COCCI parameter as a directory to traverse files in
> directory.
>
> Signed-off-by: zhongshiqi <zhong.sh...@zte.com.cn>
> ---
>  scripts/coccicheck | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index e04d328..a1c4197 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
>      for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | 
> sort`; do
>      coccinelle $f
>      done
> +elif [ -d "$COCCI" ] ; then
> +    for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
> +    coccinelle $f
> +    done
>  else
>      coccinelle $COCCI
>  fi

Thanks for the contribution.  I'm not that knowledgeable about these
scripts.  What is the relation between the last two if branches?  If the
first one fails, does that mean that $COCCI has no definition?  In that
case, is the final else useful?

thanks,
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to