Cosmetic adjustments.
This commit is contained in:
parent
aa0765e11b
commit
63a0e530bd
@ -127,7 +127,7 @@ char *chunkstrdup(const char *str);
|
|||||||
void freeChunks(void);
|
void freeChunks(void);
|
||||||
int fullWrite(int fd, const char *buf, int len);
|
int fullWrite(int fd, const char *buf, int len);
|
||||||
int fullRead(int fd, char *buf, int len);
|
int fullRead(int fd, char *buf, int len);
|
||||||
int recursiveAction(const char *fileName, int recurse, int followLinks, int delayDirAction,
|
int recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst,
|
||||||
int (*fileAction) (const char *fileName, struct stat* statbuf),
|
int (*fileAction) (const char *fileName, struct stat* statbuf),
|
||||||
int (*dirAction) (const char *fileName, struct stat* statbuf));
|
int (*dirAction) (const char *fileName, struct stat* statbuf));
|
||||||
const char* timeString(time_t timeVal);
|
const char* timeString(time_t timeVal);
|
||||||
|
12
utility.c
12
utility.c
@ -381,10 +381,12 @@ int fullRead(int fd, char *buf, int len)
|
|||||||
* location, and do something (something specified
|
* location, and do something (something specified
|
||||||
* by the fileAction and dirAction function pointers).
|
* by the fileAction and dirAction function pointers).
|
||||||
*
|
*
|
||||||
* TODO: check if ftw(3) can replace this to reduce code size...
|
* Unfortunatly, while nftw(3) could replace this and reduce
|
||||||
|
* code size a bit, nftw() wasn't supported before GNU libc 2.1,
|
||||||
|
* and so isn't sufficiently portable to take over...
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
recursiveAction(const char *fileName, int recurse, int followLinks, int delayDirAction,
|
recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst,
|
||||||
int (*fileAction) (const char *fileName, struct stat* statbuf),
|
int (*fileAction) (const char *fileName, struct stat* statbuf),
|
||||||
int (*dirAction) (const char *fileName, struct stat* statbuf))
|
int (*dirAction) (const char *fileName, struct stat* statbuf))
|
||||||
{
|
{
|
||||||
@ -418,7 +420,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int delayDir
|
|||||||
perror(fileName);
|
perror(fileName);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (dirAction != NULL && delayDirAction == FALSE) {
|
if (dirAction != NULL && depthFirst == FALSE) {
|
||||||
status = dirAction(fileName, &statbuf);
|
status = dirAction(fileName, &statbuf);
|
||||||
if (status == FALSE) {
|
if (status == FALSE) {
|
||||||
perror(fileName);
|
perror(fileName);
|
||||||
@ -433,7 +435,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int delayDir
|
|||||||
}
|
}
|
||||||
sprintf(nextFile, "%s/%s", fileName, next->d_name);
|
sprintf(nextFile, "%s/%s", fileName, next->d_name);
|
||||||
status =
|
status =
|
||||||
recursiveAction(nextFile, TRUE, followLinks, delayDirAction,
|
recursiveAction(nextFile, TRUE, followLinks, depthFirst,
|
||||||
fileAction, dirAction);
|
fileAction, dirAction);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
@ -445,7 +447,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int delayDir
|
|||||||
perror(fileName);
|
perror(fileName);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (dirAction != NULL && delayDirAction == TRUE) {
|
if (dirAction != NULL && depthFirst == TRUE) {
|
||||||
status = dirAction(fileName, &statbuf);
|
status = dirAction(fileName, &statbuf);
|
||||||
if (status == FALSE) {
|
if (status == FALSE) {
|
||||||
perror(fileName);
|
perror(fileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user