svn commit: trunk/busybox/findutils

vda at busybox.net vda at busybox.net
Tue Feb 6 17:38:29 UTC 2007


Author: vda
Date: 2007-02-06 09:38:29 -0800 (Tue, 06 Feb 2007)
New Revision: 17794

Log:
find: fix -not support


Modified:
   trunk/busybox/findutils/find.c


Changeset:
Modified: trunk/busybox/findutils/find.c
===================================================================
--- trunk/busybox/findutils/find.c	2007-02-06 16:34:54 UTC (rev 17793)
+++ trunk/busybox/findutils/find.c	2007-02-06 17:38:29 UTC (rev 17794)
@@ -352,6 +352,7 @@
 		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 @@
 		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 @@
 		else if (LONE_CHAR(arg, '!')
 		         USE_DESKTOP(|| strcmp(arg, "-not") == 0)
 		) {
-			invert_flag = 1;
+			/* also handles "find ! ! -name 'foo*'" */
+			invert_flag ^= 1;
 		}
 #endif
 




More information about the busybox-cvs mailing list