[PATCH] implement find -ipath

Denys Vlasenko vda.linux at googlemail.com
Sun May 22 01:51:01 UTC 2011


On Friday 20 May 2011 09:42, Bogdan Harjoc wrote:
> diff --git a/findutils/find.c b/findutils/find.c
> index dd00f37..26a8ce1 100644
> --- a/findutils/find.c
> +++ b/findutils/find.c
> @@ -256,7 +256,7 @@ typedef struct {
>  
>                          ACTS(print)
>                          ACTS(name,  const char *pattern; bool iname;)
> -IF_FEATURE_FIND_PATH(   ACTS(path,  const char *pattern;))
> +IF_FEATURE_FIND_PATH(   ACTS(path,  const char *pattern; bool ipath;))
>  IF_FEATURE_FIND_REGEX(  ACTS(regex, regex_t compiled_pattern;))
>  IF_FEATURE_FIND_PRINT0( ACTS(print0))
>  IF_FEATURE_FIND_TYPE(   ACTS(type,  int type_mask;))
> @@ -393,7 +393,7 @@ ACTF(name)
>  #if ENABLE_FEATURE_FIND_PATH
>  ACTF(path)
>  {
> -	return fnmatch(ap->pattern, fileName, 0) == 0;
> +	return fnmatch(ap->pattern, fileName, (ap->ipath ? FNM_CASEFOLD : 0)) == 0;
>  }
>  #endif
>  #if ENABLE_FEATURE_FIND_REGEX
> @@ -693,6 +693,7 @@ static action*** parse_params(char **argv)
>  	                        PARM_name      ,
>  	                        PARM_iname     ,
>  	IF_FEATURE_FIND_PATH(   PARM_path      ,)
> +	IF_FEATURE_FIND_PATH(   PARM_ipath     ,)
>  	IF_FEATURE_FIND_REGEX(  PARM_regex     ,)
>  	IF_FEATURE_FIND_TYPE(   PARM_type      ,)
>  	IF_FEATURE_FIND_PERM(   PARM_perm      ,)
> @@ -727,6 +728,7 @@ static action*** parse_params(char **argv)
>  	                         "-name\0"
>  	                         "-iname\0"
>  	IF_FEATURE_FIND_PATH(   "-path\0"   )
> +	IF_FEATURE_FIND_PATH(   "-ipath\0"  )
>  	IF_FEATURE_FIND_REGEX(  "-regex\0"  )
>  	IF_FEATURE_FIND_TYPE(   "-type\0"   )
>  	IF_FEATURE_FIND_PERM(   "-perm\0"   )
> @@ -909,10 +911,11 @@ static action*** parse_params(char **argv)
>  			ap->iname = (parm == PARM_iname);
>  		}
>  #if ENABLE_FEATURE_FIND_PATH
> -		else if (parm == PARM_path) {
> +		else if (parm == PARM_path || parm == PARM_ipath) {
>  			action_path *ap;
>  			ap = ALLOC_ACTION(path);
>  			ap->pattern = arg1;
> +			ap->ipath = (parm == PARM_ipath);
>  		}
>  #endif
>  #if ENABLE_FEATURE_FIND_REGEX
> @@ -1069,6 +1072,7 @@ static action*** parse_params(char **argv)
>  //usage:     "\n	-iname PATTERN	Case insensitive -name"
>  //usage:	IF_FEATURE_FIND_PATH(
>  //usage:     "\n	-path PATTERN	Path matches PATTERN"
> +//usage:     "\n	-ipath PATTERN	Case insensitive -path"
>  //usage:	)
>  //usage:	IF_FEATURE_FIND_REGEX(
>  //usage:     "\n	-regex PATTERN	Path matches regex PATTERN"
> 

Applied, thanks!
-- 
vda


More information about the busybox mailing list