aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan Harjoc <harjoc@gmail.com>2011-05-22 03:50:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-22 03:50:21 +0200
commit7948ecb505135c811a44bc8f8e391622d893d383 (patch)
treee3eb678203769321d72c40090f10cceea63b49e8
parentd616ab6bbb6c3768efb9474fa18d1e2f98c4793b (diff)
downloadbusybox-w32-7948ecb505135c811a44bc8f8e391622d893d383.tar.gz
busybox-w32-7948ecb505135c811a44bc8f8e391622d893d383.tar.bz2
busybox-w32-7948ecb505135c811a44bc8f8e391622d893d383.zip
find: implement -ipath
Signed-off-by: Bogdan Harjoc <harjoc@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--findutils/find.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 9ae84fa0d..7918240f4 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -264,6 +264,7 @@
264//usage: "\n -iname PATTERN Case insensitive -name" 264//usage: "\n -iname PATTERN Case insensitive -name"
265//usage: IF_FEATURE_FIND_PATH( 265//usage: IF_FEATURE_FIND_PATH(
266//usage: "\n -path PATTERN Match path to PATTERN" 266//usage: "\n -path PATTERN Match path to PATTERN"
267//usage: "\n -ipath PATTERN Case insensitive -path"
267//usage: ) 268//usage: )
268//usage: IF_FEATURE_FIND_REGEX( 269//usage: IF_FEATURE_FIND_REGEX(
269//usage: "\n -regex PATTERN Match path to regex PATTERN" 270//usage: "\n -regex PATTERN Match path to regex PATTERN"
@@ -352,7 +353,7 @@ typedef struct {
352 353
353 ACTS(print) 354 ACTS(print)
354 ACTS(name, const char *pattern; bool iname;) 355 ACTS(name, const char *pattern; bool iname;)
355IF_FEATURE_FIND_PATH( ACTS(path, const char *pattern;)) 356IF_FEATURE_FIND_PATH( ACTS(path, const char *pattern; bool ipath;))
356IF_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;)) 357IF_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;))
357IF_FEATURE_FIND_PRINT0( ACTS(print0)) 358IF_FEATURE_FIND_PRINT0( ACTS(print0))
358IF_FEATURE_FIND_TYPE( ACTS(type, int type_mask;)) 359IF_FEATURE_FIND_TYPE( ACTS(type, int type_mask;))
@@ -494,7 +495,7 @@ ACTF(name)
494#if ENABLE_FEATURE_FIND_PATH 495#if ENABLE_FEATURE_FIND_PATH
495ACTF(path) 496ACTF(path)
496{ 497{
497 return fnmatch(ap->pattern, fileName, 0) == 0; 498 return fnmatch(ap->pattern, fileName, (ap->ipath ? FNM_CASEFOLD : 0)) == 0;
498} 499}
499#endif 500#endif
500#if ENABLE_FEATURE_FIND_REGEX 501#if ENABLE_FEATURE_FIND_REGEX
@@ -794,6 +795,7 @@ static action*** parse_params(char **argv)
794 PARM_name , 795 PARM_name ,
795 PARM_iname , 796 PARM_iname ,
796 IF_FEATURE_FIND_PATH( PARM_path ,) 797 IF_FEATURE_FIND_PATH( PARM_path ,)
798 IF_FEATURE_FIND_PATH( PARM_ipath ,)
797 IF_FEATURE_FIND_REGEX( PARM_regex ,) 799 IF_FEATURE_FIND_REGEX( PARM_regex ,)
798 IF_FEATURE_FIND_TYPE( PARM_type ,) 800 IF_FEATURE_FIND_TYPE( PARM_type ,)
799 IF_FEATURE_FIND_PERM( PARM_perm ,) 801 IF_FEATURE_FIND_PERM( PARM_perm ,)
@@ -831,6 +833,7 @@ static action*** parse_params(char **argv)
831 "-name\0" 833 "-name\0"
832 "-iname\0" 834 "-iname\0"
833 IF_FEATURE_FIND_PATH( "-path\0" ) 835 IF_FEATURE_FIND_PATH( "-path\0" )
836 IF_FEATURE_FIND_PATH( "-ipath\0" )
834 IF_FEATURE_FIND_REGEX( "-regex\0" ) 837 IF_FEATURE_FIND_REGEX( "-regex\0" )
835 IF_FEATURE_FIND_TYPE( "-type\0" ) 838 IF_FEATURE_FIND_TYPE( "-type\0" )
836 IF_FEATURE_FIND_PERM( "-perm\0" ) 839 IF_FEATURE_FIND_PERM( "-perm\0" )
@@ -1018,10 +1021,11 @@ static action*** parse_params(char **argv)
1018 ap->iname = (parm == PARM_iname); 1021 ap->iname = (parm == PARM_iname);
1019 } 1022 }
1020#if ENABLE_FEATURE_FIND_PATH 1023#if ENABLE_FEATURE_FIND_PATH
1021 else if (parm == PARM_path) { 1024 else if (parm == PARM_path || parm == PARM_ipath) {
1022 action_path *ap; 1025 action_path *ap;
1023 ap = ALLOC_ACTION(path); 1026 ap = ALLOC_ACTION(path);
1024 ap->pattern = arg1; 1027 ap->pattern = arg1;
1028 ap->ipath = (parm == PARM_ipath);
1025 } 1029 }
1026#endif 1030#endif
1027#if ENABLE_FEATURE_FIND_REGEX 1031#if ENABLE_FEATURE_FIND_REGEX