[PATCH] un-desktopize find rediffed

Kai Schwenzfeier niteblade at gmx.net
Wed Apr 4 22:08:59 UTC 2007


This patch is rediffed to fit svn trunk. 

The last hunk is optional. It makes FEATURE_FIND_PRUNE dependent on
FEATURE_FIND_PAREN, since this is probably the way -prune is usually
used. 
I could not make heads and tails from the PARAM_* stuff, so you 
probably want to recheck what I did there. The long versions -and, 
-or, and -not still depend on DESKTOP.

greetings,
Kai

-------------- next part --------------
--- ./findutils/Config.in	2007-03-22 21:21:37.000000000 +0100
+++ ./findutils/Config.in	2007-04-04 16:39:10.000000000 +0200
@@ -99,6 +99,28 @@
 	  full-blown desktop' is enabled, then will also support the
 	  non-POSIX notation '-not'.
 
+config FEATURE_FIND_PAREN
+	bool "Enable parens in options"
+	default y
+	depends on FIND
+	help
+	  Enable usage of parens '(' to specify logical order of arguments.
+
+config FEATURE_FIND_SIZE
+	bool "Enable (-size) option allowing matching for file size"
+	default y
+	depends on FIND
+	help
+	  Support the 'find -size' option for searching by file size.
+
+config FEATURE_FIND_PRUNE
+	bool "Enable (-prune) option allowing to exclude subdirectories"
+	default y
+	depends on FIND
+	help
+	  If the file is a directory, dont descend into it. Useful for
+	  exclusion .svn and CVS directories.
+
 config GREP
 	bool "grep"
 	default n
--- ./include/usage.h	2007-03-22 21:21:35.000000000 +0100
+++ ./include/usage.h	2007-04-04 17:03:16.000000000 +0200
@@ -958,9 +958,11 @@
 	) USE_FEATURE_FIND_EXEC( \
        "\n	-exec CMD	Execute CMD with all instances of {} replaced by the" \
        "\n			files matching EXPRESSION" \
-	) USE_DESKTOP( \
+	) USE_FEATURE_FIND_SIZE( \
        "\n	-size N		File size is N" \
+	) USE_FEATURE_FIND_PRUNE( \
        "\n	-prune		Stop traversing current subtree" \
+	) USE_FEATURE_FIND_PAREN( \
        "\n	(expr)		Group" \
 	)
 
--- ./findutils/find.c	2007-04-04 23:18:26.000000000 +0200
+++ ./findutils/find.c	2007-04-04 23:58:37.000000000 +0200
@@ -72,9 +72,9 @@
 USE_FEATURE_FIND_INUM(  ACTS(inum,  ino_t inode_num;))
 USE_FEATURE_FIND_EXEC(  ACTS(exec,  char **exec_argv; unsigned int *subst_count; int exec_argc;))
 USE_FEATURE_FIND_USER(  ACTS(user,  int uid;))
-USE_DESKTOP(            ACTS(paren, action ***subexpr;))
-USE_DESKTOP(            ACTS(size,  off_t size;))
-USE_DESKTOP(            ACTS(prune))
+USE_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;))
+USE_FEATURE_FIND_SIZE(  ACTS(size,  off_t size;))
+USE_FEATURE_FIND_PRUNE( ACTS(prune))
 
 static action ***actions;
 static bool need_print = 1;
@@ -245,12 +245,14 @@
 	return TRUE;
 }
 
-#if ENABLE_DESKTOP
+#if ENABLE_FEATURE_FIND_PAREN
 ACTF(paren)
 {
 	return exec_actions(ap->subexpr, fileName, statbuf);
 }
+#endif
 
+#if ENABLE_FEATURE_FIND_PRUNE
 /*
  * -prune: if -depth is not given, return true and do not descend
  * current dir; if -depth is given, return false with no effect.
@@ -261,7 +263,9 @@
 {
 	return SKIP;
 }
+#endif
 
+#if ENABLE_FEATURE_FIND_SIZE
 ACTF(size)
 {
 	return statbuf->st_size == ap->size;
@@ -345,9 +349,10 @@
 #define PARM_and (PARM_user + 1)
 #define PARM_or (PARM_and + 1)
 #define PARM_not (PARM_or + ENABLE_FEATURE_FIND_NOT)
-#define PARM_char_brace (PARM_not + 1)
-#define PARM_prune (PARM_char_brace + 1)
-#define PARM_size (PARM_prune + 1)
+#endif
+#define PARM_char_brace (PARM_not + ENABLE_FEATURE_FIND_PAREN)
+#define PARM_prune (PARM_char_brace + ENABLE_FEATURE_FIND_PRUNE)
+#define PARM_size (PARM_prune + ENABLE_FEATURE_FIND_SIZE)
 #endif
 static action*** parse_params(char **argv)
 {
@@ -396,8 +401,14 @@
 #	if ENABLE_FEATURE_FIND_NOT
 		"-not",
 #	endif
+#endif
+#if ENABLE_FEATURE_FIND_PAREN
 		"(",
+#endif
+#if ENABLE_FEATURE_FIND_PRUNE
 		"-prune",
+#endif
+#if ENABLE_FEATURE_FIND_SIZE
 		"-size",
 #endif
 		NULL
@@ -593,7 +604,7 @@
 				ap->uid = xuname2uid(arg1);
 		}
 #endif
-#if ENABLE_DESKTOP
+#if ENABLE_FEATURE_FIND_PAREN
 		else if (parm == PARM_char_brace)
 		{
 			action_paren *ap;
@@ -616,11 +627,15 @@
 			*endarg = (char*) ")"; /* restore NULLed parameter */
 			argv = endarg;
 		}
+#endif
+#if ENABLE_FEATURE_FIND_PRUNE
 		else if (parm == PARM_prune)
 		{
 			USE_FEATURE_FIND_NOT( invert_flag = 0; )
 			(void) ALLOC_ACTION(prune);
 		}
+#endif
+#if ENABLE_FEATURE_FIND_SIZE
 		else if (parm == PARM_size)
 		{
 			action_size *ap;
@@ -657,7 +672,7 @@
 			break;
 		if (ENABLE_FEATURE_FIND_NOT && LONE_CHAR(argv[firstopt], '!'))
 			break;
-#if ENABLE_DESKTOP
+#if ENABLE_FEATURE_FIND_PAREN
 		if (LONE_CHAR(argv[firstopt], '('))
 			break;
 #endif
--- ./findutils/Config.in	2007-04-05 00:00:57.000000000 +0200
+++ ./findutils/Config.in	2007-04-05 00:02:01.000000000 +0200
@@ -116,7 +116,7 @@
 config FEATURE_FIND_PRUNE
 	bool "Enable (-prune) option allowing to exclude subdirectories"
 	default y
-	depends on FIND
+	depends on FEATURE_FIND_PAREN
 	help
 	  If the file is a directory, dont descend into it. Useful for
 	  exclusion .svn and CVS directories.


More information about the busybox mailing list