diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-10-17 05:43:39 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-10-17 05:43:39 +0000 |
commit | 9b5871888989b16f94cbba5dd304ac444def3afd (patch) | |
tree | 17187e3f6988830c0e329378e552995d083080ed /utility.c | |
parent | cb6e25655f894c90e4befc4bee0e66794dd6858f (diff) |
Some fixes and such
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -46,8 +46,9 @@ int isDirectory(const char *name) if (stat(name, &statBuf) < 0) return FALSE; - - return S_ISDIR(statBuf.st_mode); + if (S_ISDIR(statBuf.st_mode)) + return TRUE; + return(FALSE); } @@ -467,8 +468,8 @@ int fullRead(int fd, char *buf, int len) */ int recursiveAction(const char *fileName, int recurse, int followLinks, - int (*fileAction) (const char *fileName), - int (*dirAction) (const char *fileName)) + int (*fileAction) (const char *fileName, struct stat* statbuf), + int (*dirAction) (const char *fileName, struct stat* statbuf)) { int status; struct stat statbuf; @@ -487,7 +488,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, if (recurse == FALSE) { if (S_ISDIR(statbuf.st_mode)) { if (dirAction != NULL) - return (dirAction(fileName)); + return (dirAction(fileName, &statbuf)); else return (TRUE); } @@ -501,7 +502,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, return (FALSE); } if (dirAction != NULL) { - status = dirAction(fileName); + status = dirAction(fileName, &statbuf); if (status == FALSE) { perror(fileName); return (FALSE); @@ -531,7 +532,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, if (fileAction == NULL) return (TRUE); else - return (fileAction(fileName)); + return (fileAction(fileName, &statbuf)); } return (TRUE); } |