summaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-02-06 17:38:29 +0000
committerDenis Vlasenko2007-02-06 17:38:29 +0000
commitb292264bfd7064b651192b966f30d76b75161c70 (patch)
tree68f077ddbd397621ba58dba4cc6161b96b24b285 /findutils/find.c
parent1d76f439da81d3a05f0e0fdde3f81ec56fb20836 (diff)
downloadbusybox-b292264bfd7064b651192b966f30d76b75161c70.zip
busybox-b292264bfd7064b651192b966f30d76b75161c70.tar.gz
find: fix -not support
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 5645b5a..e98d995 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -352,6 +352,7 @@ static action*** parse_params(char **argv)
appp[cur_group][cur_action] = NULL;
ap->f = f;
USE_FEATURE_FIND_NOT( ap->invert = invert_flag; )
+ USE_FEATURE_FIND_NOT( invert_flag = 0; )
return ap;
}
#define ALLOC_ACTION(name) (action_##name*)alloc_action(sizeof(action_##name), (action_fp) func_##name)
@@ -380,14 +381,12 @@ static action*** parse_params(char **argv)
if (strcmp(arg, "-a") == 0
USE_DESKTOP(|| strcmp(arg, "-and") == 0)
) {
- USE_FEATURE_FIND_NOT( invert_flag = 0; )
/* no further special handling required */
}
else if (strcmp(arg, "-o") == 0
USE_DESKTOP(|| strcmp(arg, "-or") == 0)
) {
/* start new OR group */
- USE_FEATURE_FIND_NOT( invert_flag = 0; )
cur_group++;
appp = xrealloc(appp, (cur_group+2) * sizeof(*appp));
/*appp[cur_group] = NULL; - already NULL */
@@ -398,7 +397,8 @@ static action*** parse_params(char **argv)
else if (LONE_CHAR(arg, '!')
USE_DESKTOP(|| strcmp(arg, "-not") == 0)
) {
- invert_flag = 1;
+ /* also handles "find ! ! -name 'foo*'" */
+ invert_flag ^= 1;
}
#endif