svn commit: trunk/busybox/findutils

landley at busybox.net landley at busybox.net
Thu Oct 6 16:39:19 UTC 2005


Author: landley
Date: 2005-10-06 09:39:17 -0700 (Thu, 06 Oct 2005)
New Revision: 11794

Log:
The supposedly trivial CONFIG->ENABLE conversion wasn't so trivial.  The
-exec feature shouldn't be tangled up with this, so revert everything but
the new exec feature for the moment.


Modified:
   trunk/busybox/findutils/find.c


Changeset:
Modified: trunk/busybox/findutils/find.c
===================================================================
--- trunk/busybox/findutils/find.c	2005-10-06 15:37:02 UTC (rev 11793)
+++ trunk/busybox/findutils/find.c	2005-10-06 16:39:17 UTC (rev 11794)
@@ -39,34 +39,34 @@
 
 static char *pattern;
 
-#if ENABLE_FEATURE_FIND_TYPE
+#ifdef CONFIG_FEATURE_FIND_TYPE
 static int type_mask = 0;
 #endif
 
-#if ENABLE_FEATURE_FIND_PERM
+#ifdef CONFIG_FEATURE_FIND_PERM
 static char perm_char = 0;
 static int perm_mask = 0;
 #endif
 
-#if ENABLE_FEATURE_FIND_MTIME
+#ifdef CONFIG_FEATURE_FIND_MTIME
 static char mtime_char;
 static int mtime_days;
 #endif
 
-#if ENABLE_FEATURE_FIND_XDEV
+#ifdef CONFIG_FEATURE_FIND_XDEV
 static dev_t *xdev_dev;
 static int xdev_count = 0;
 #endif
 
-#if ENABLE_FEATURE_FIND_NEWER
+#ifdef CONFIG_FEATURE_FIND_NEWER
 static time_t newer_mtime;
 #endif
 
-#if ENABLE_FEATURE_FIND_INUM
+#ifdef CONFIG_FEATURE_FIND_INUM
 static ino_t inode_num;
 #endif
 
-#if ENABLE_FEATURE_FIND_EXEC
+#ifdef CONFIG_FEATURE_FIND_EXEC
 static char **exec_str;
 static int num_matches;
 static int exec_opt;
@@ -84,17 +84,22 @@
 		if (!(fnmatch(pattern, tmp, FNM_PERIOD) == 0))
 			goto no_match;
 	}
-	if (ENABLE_FEATURE_FIND_TYPE && type_mask != 0) {
+#ifdef CONFIG_FEATURE_FIND_TYPE
+	if (type_mask != 0) {
 		if (!((statbuf->st_mode & S_IFMT) == type_mask))
 			goto no_match;
 	}
-	if (ENABLE_FEATURE_FIND_PERM && perm_mask != 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_PERM
+	if (perm_mask != 0) {
 		if (!((isdigit(perm_char) && (statbuf->st_mode & 07777) == perm_mask) ||
 			 (perm_char == '-' && (statbuf->st_mode & perm_mask) == perm_mask) ||
 			 (perm_char == '+' && (statbuf->st_mode & perm_mask) != 0)))
 			goto no_match;
 	}
-	if (ENABLE_FEATURE_FIND_MTIME && mtime_char != 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_MTIME
+	if (mtime_char != 0) {
 		time_t file_age = time(NULL) - statbuf->st_mtime;
 		time_t mtime_secs = mtime_days * 24 * 60 * 60;
 		if (!((isdigit(mtime_char) && file_age >= mtime_secs &&
@@ -103,7 +108,9 @@
 				(mtime_char == '-' && file_age < mtime_secs)))
 			goto no_match;
 	}
-	if (ENABLE_FEATURE_FIND_XDEV && xdev_count) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_XDEV
+	if (xdev_count) {
 		int i;
 		for (i=0; i<xdev_count; i++) {
 			if (xdev_dev[i] == statbuf-> st_dev)
@@ -116,16 +123,22 @@
 				goto no_match;
 		}
 	}
-	if (ENABLE_FEATURE_FIND_NEWER && newer_mtime != 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_NEWER
+	if (newer_mtime != 0) {
 		time_t file_age = newer_mtime - statbuf->st_mtime;
 		if (file_age >= 0)
 			goto no_match;
 	}
-	if (ENABLE_FEATURE_FIND_INUM && inode_num != 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_INUM
+	if (inode_num != 0) {
 		if (!(statbuf->st_ino == inode_num))
 			goto no_match;
 	}
-	if (ENABLE_FEATURE_FIND_EXEC && exec_opt) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_EXEC
+	if (exec_opt) {
 		int i;
 		char *cmd_string = "";
 		for (i = 0; i < num_matches; i++)
@@ -134,13 +147,14 @@
 		system(cmd_string);
 		goto no_match;
 	}
+#endif
 	
 	puts(fileName);
 no_match:
 	return (TRUE);
 }
 
-#if ENABLE_FEATURE_FIND_TYPE
+#ifdef CONFIG_FEATURE_FIND_TYPE
 static int find_type(char *type)
 {
 	int mask = 0;
@@ -197,11 +211,14 @@
 			if (++i == argc)
 				bb_error_msg_and_die(msg_req_arg, "-name");
 			pattern = argv[i];
-		} else if (ENABLE_FEATURE_FIND_TYPE && strcmp(argv[i], "-type") == 0) {
+#ifdef CONFIG_FEATURE_FIND_TYPE
+		} else if (strcmp(argv[i], "-type") == 0) {
 			if (++i == argc)
 				bb_error_msg_and_die(msg_req_arg, "-type");
 			type_mask = find_type(argv[i]);
-		} else if (ENABLE_FEATURE_FIND_PERM && strcmp(argv[i], "-perm") == 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_PERM
+		} else if (strcmp(argv[i], "-perm") == 0) {
 			char *end;
 			if (++i == argc)
 				bb_error_msg_and_die(msg_req_arg, "-perm");
@@ -210,7 +227,9 @@
 				bb_error_msg_and_die(msg_invalid_arg, argv[i], "-perm");
 			if ((perm_char = argv[i][0]) == '-')
 				perm_mask = -perm_mask;
-		} else if (ENABLE_FEATURE_FIND_MTIME && strcmp(argv[i], "-mtime") == 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_MTIME
+		} else if (strcmp(argv[i], "-mtime") == 0) {
 			char *end;
 			if (++i == argc)
 				bb_error_msg_and_die(msg_req_arg, "-mtime");
@@ -219,7 +238,9 @@
 				bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mtime");
 			if ((mtime_char = argv[i][0]) == '-')
 				mtime_days = -mtime_days;
-		} else if (ENABLE_FEATURE_FIND_XDEV && strcmp(argv[i], "-xdev") == 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_XDEV
+		} else if (strcmp(argv[i], "-xdev") == 0) {
 			struct stat stbuf;
 
 			xdev_count = ( firstopt - 1 ) ? ( firstopt - 1 ) : 1;
@@ -238,21 +259,27 @@
 					xdev_dev [i-1] = stbuf. st_dev;
 				}
 			}
-		} else if (ENABLE_FEATURE_FIND_NEWER && strcmp(argv[i], "-newer") == 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_NEWER
+		} else if (strcmp(argv[i], "-newer") == 0) {
 			struct stat stat_newer;
 			if (++i == argc)
 				bb_error_msg_and_die(msg_req_arg, "-newer");
 		    if (stat (argv[i], &stat_newer) != 0)
 				bb_error_msg_and_die("file %s not found", argv[i]);
 			newer_mtime = stat_newer.st_mtime;
-		} else if (ENABLE_FEATURE_FIND_INUM && strcmp(argv[i], "-inum") == 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_INUM
+		} else if (strcmp(argv[i], "-inum") == 0) {
 			char *end;
 			if (++i == argc)
 				bb_error_msg_and_die(msg_req_arg, "-inum");
 			inode_num = strtol(argv[i], &end, 10);
 			if (end[0] != '\0')
 				bb_error_msg_and_die(msg_invalid_arg, argv[i], "-inum");
-		} else if (ENABLE_FEATURE_FIND_EXEC && strcmp(argv[i], "-exec") == 0) {
+#endif
+#ifdef CONFIG_FEATURE_FIND_EXEC
+		} else if (strcmp(argv[i], "-exec") == 0) {
 			int b_pos;
 			char *cmd_string = "";
 
@@ -277,6 +304,7 @@
 			}
 			exec_str[num_matches] = bb_xstrdup(cmd_string);
 			exec_opt = 1;
+#endif
 		} else
 			bb_show_usage();
 	}




More information about the busybox-cvs mailing list