aboutsummaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-10-24 05:00:29 +0000
committerEric Andersen <andersen@codepoet.org>2001-10-24 05:00:29 +0000
commitbdfd0d78bc44e73d693510e70087857785b3b521 (patch)
tree153a573095afac8d8d0ea857759ecabd77fb28b7 /findutils/find.c
parent9260fc5552a3ee52eb95823aa6689d52a1ffd33c (diff)
downloadbusybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.tar.gz
busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.tar.bz2
busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.zip
Major rework of the directory structure and the entire build system.
-Erik
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/findutils/find.c b/findutils/find.c
index e814c97b9..262213e8b 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -2,9 +2,9 @@
2/* 2/*
3 * Mini find implementation for busybox 3 * Mini find implementation for busybox
4 * 4 *
5 * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
6 * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
5 * 7 *
6 * Copyright (C) 1999,2000,2001 by Lineo, inc.
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * Reworked by David Douthitt <n9ubh@callsign.net> and 8 * Reworked by David Douthitt <n9ubh@callsign.net> and
9 * Matt Kraai <kraai@alumni.carnegiemellon.edu>. 9 * Matt Kraai <kraai@alumni.carnegiemellon.edu>.
10 * 10 *
@@ -37,16 +37,16 @@
37 37
38static char *pattern; 38static char *pattern;
39 39
40#ifdef BB_FEATURE_FIND_TYPE 40#ifdef CONFIG_FEATURE_FIND_TYPE
41static int type_mask = 0; 41static int type_mask = 0;
42#endif 42#endif
43 43
44#ifdef BB_FEATURE_FIND_PERM 44#ifdef CONFIG_FEATURE_FIND_PERM
45static char perm_char = 0; 45static char perm_char = 0;
46static int perm_mask = 0; 46static int perm_mask = 0;
47#endif 47#endif
48 48
49#ifdef BB_FEATURE_FIND_MTIME 49#ifdef CONFIG_FEATURE_FIND_MTIME
50static char mtime_char; 50static char mtime_char;
51static int mtime_days; 51static int mtime_days;
52#endif 52#endif
@@ -63,13 +63,13 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
63 if (!(fnmatch(pattern, tmp, FNM_PERIOD) == 0)) 63 if (!(fnmatch(pattern, tmp, FNM_PERIOD) == 0))
64 goto no_match; 64 goto no_match;
65 } 65 }
66#ifdef BB_FEATURE_FIND_TYPE 66#ifdef CONFIG_FEATURE_FIND_TYPE
67 if (type_mask != 0) { 67 if (type_mask != 0) {
68 if (!((statbuf->st_mode & S_IFMT) == type_mask)) 68 if (!((statbuf->st_mode & S_IFMT) == type_mask))
69 goto no_match; 69 goto no_match;
70 } 70 }
71#endif 71#endif
72#ifdef BB_FEATURE_FIND_PERM 72#ifdef CONFIG_FEATURE_FIND_PERM
73 if (perm_mask != 0) { 73 if (perm_mask != 0) {
74 if (!((isdigit(perm_char) && (statbuf->st_mode & 07777) == perm_mask) || 74 if (!((isdigit(perm_char) && (statbuf->st_mode & 07777) == perm_mask) ||
75 (perm_char == '-' && (statbuf->st_mode & perm_mask) == perm_mask) || 75 (perm_char == '-' && (statbuf->st_mode & perm_mask) == perm_mask) ||
@@ -77,7 +77,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
77 goto no_match; 77 goto no_match;
78 } 78 }
79#endif 79#endif
80#ifdef BB_FEATURE_FIND_MTIME 80#ifdef CONFIG_FEATURE_FIND_MTIME
81 if (mtime_days != 0) { 81 if (mtime_days != 0) {
82 time_t file_age = time(NULL) - statbuf->st_mtime; 82 time_t file_age = time(NULL) - statbuf->st_mtime;
83 time_t mtime_secs = mtime_days * 24 * 60 * 60; 83 time_t mtime_secs = mtime_days * 24 * 60 * 60;
@@ -93,7 +93,7 @@ no_match:
93 return (TRUE); 93 return (TRUE);
94} 94}
95 95
96#ifdef BB_FEATURE_FIND_TYPE 96#ifdef CONFIG_FEATURE_FIND_TYPE
97static int find_type(char *type) 97static int find_type(char *type)
98{ 98{
99 int mask = 0; 99 int mask = 0;
@@ -150,13 +150,13 @@ int find_main(int argc, char **argv)
150 if (++i == argc) 150 if (++i == argc)
151 error_msg_and_die("option `-name' requires an argument"); 151 error_msg_and_die("option `-name' requires an argument");
152 pattern = argv[i]; 152 pattern = argv[i];
153#ifdef BB_FEATURE_FIND_TYPE 153#ifdef CONFIG_FEATURE_FIND_TYPE
154 } else if (strcmp(argv[i], "-type") == 0) { 154 } else if (strcmp(argv[i], "-type") == 0) {
155 if (++i == argc) 155 if (++i == argc)
156 error_msg_and_die("option `-type' requires an argument"); 156 error_msg_and_die("option `-type' requires an argument");
157 type_mask = find_type(argv[i]); 157 type_mask = find_type(argv[i]);
158#endif 158#endif
159#ifdef BB_FEATURE_FIND_PERM 159#ifdef CONFIG_FEATURE_FIND_PERM
160 } else if (strcmp(argv[i], "-perm") == 0) { 160 } else if (strcmp(argv[i], "-perm") == 0) {
161 char *end; 161 char *end;
162 if (++i == argc) 162 if (++i == argc)
@@ -169,7 +169,7 @@ int find_main(int argc, char **argv)
169 if ((perm_char = argv[i][0]) == '-') 169 if ((perm_char = argv[i][0]) == '-')
170 perm_mask = -perm_mask; 170 perm_mask = -perm_mask;
171#endif 171#endif
172#ifdef BB_FEATURE_FIND_MTIME 172#ifdef CONFIG_FEATURE_FIND_MTIME
173 } else if (strcmp(argv[i], "-mtime") == 0) { 173 } else if (strcmp(argv[i], "-mtime") == 0) {
174 char *end; 174 char *end;
175 if (++i == argc) 175 if (++i == argc)