diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-10-28 16:06:25 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-10-28 16:06:25 +0000 |
commit | 6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661 (patch) | |
tree | ac9548482088082aece2d2df1406c72339c77b6f /findutils/find.c | |
parent | c7c41d306b8e172a2fba432d3c4b9f97b9963816 (diff) | |
download | busybox-w32-6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661.tar.gz busybox-w32-6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661.tar.bz2 busybox-w32-6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661.zip |
Stuf
Diffstat (limited to 'findutils/find.c')
-rw-r--r-- | findutils/find.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/findutils/find.c b/findutils/find.c index c154cf4e7..ab9ebf434 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -42,34 +42,11 @@ static int fileAction(const char *fileName, struct stat* statbuf) | |||
42 | { | 42 | { |
43 | if (pattern==NULL) | 43 | if (pattern==NULL) |
44 | fprintf(stdout, "%s\n", fileName); | 44 | fprintf(stdout, "%s\n", fileName); |
45 | else if (find_match(fileName, pattern, TRUE) == TRUE) | 45 | else if (find_match((char*)fileName, pattern, TRUE) == TRUE) |
46 | fprintf(stdout, "%s\n", fileName); | 46 | fprintf(stdout, "%s\n", fileName); |
47 | return( TRUE); | 47 | return( TRUE); |
48 | } | 48 | } |
49 | 49 | ||
50 | static int dirAction(const char *fileName, struct stat* statbuf) | ||
51 | { | ||
52 | DIR *dir; | ||
53 | struct dirent *entry; | ||
54 | |||
55 | if (pattern==NULL) | ||
56 | fprintf(stdout, "%s\n", fileName); | ||
57 | else if (find_match(fileName, pattern, TRUE) == TRUE) | ||
58 | fprintf(stdout, "%s\n", fileName); | ||
59 | |||
60 | dir = opendir( fileName); | ||
61 | if (!dir) { | ||
62 | perror("Can't open directory"); | ||
63 | exit(FALSE); | ||
64 | } | ||
65 | while ((entry = readdir(dir)) != NULL) { | ||
66 | char dirName[NAME_MAX]; | ||
67 | sprintf(dirName, "%s/%s", fileName, entry->d_name); | ||
68 | recursiveAction( dirName, TRUE, dereferenceFlag, FALSE, fileAction, dirAction); | ||
69 | } | ||
70 | return( TRUE); | ||
71 | } | ||
72 | |||
73 | int find_main(int argc, char **argv) | 50 | int find_main(int argc, char **argv) |
74 | { | 51 | { |
75 | /* peel off the "find" */ | 52 | /* peel off the "find" */ |