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 | |
| parent | c7c41d306b8e172a2fba432d3c4b9f97b9963816 (diff) | |
| download | busybox-w32-6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661.tar.gz busybox-w32-6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661.tar.bz2 busybox-w32-6b6b3f6ef2f44898a8bddfaae93cc4ef3aa79661.zip | |
Stuf
Diffstat (limited to 'findutils')
| -rw-r--r-- | findutils/find.c | 25 | ||||
| -rw-r--r-- | findutils/grep.c | 6 |
2 files changed, 4 insertions, 27 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" */ |
diff --git a/findutils/grep.c b/findutils/grep.c index 44ca02834..9495bf858 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
| @@ -47,9 +47,9 @@ static const char grep_usage[] = | |||
| 47 | extern int grep_main (int argc, char **argv) | 47 | extern int grep_main (int argc, char **argv) |
| 48 | { | 48 | { |
| 49 | FILE *fp; | 49 | FILE *fp; |
| 50 | const char *needle; | 50 | char *needle; |
| 51 | const char *name; | 51 | char *name; |
| 52 | const char *cp; | 52 | char *cp; |
| 53 | int tellName=TRUE; | 53 | int tellName=TRUE; |
| 54 | int ignoreCase=FALSE; | 54 | int ignoreCase=FALSE; |
| 55 | int tellLine=FALSE; | 55 | int tellLine=FALSE; |
