Apply vodz' last_patch52
[oweals/busybox.git] / libbb / recursive_action.c
index 6672db17fe9966b424bc720c1e7c3c1be0df1ee9..8917f470f7daefc67f75fe23f5317e62934dfa24 100644 (file)
@@ -2,9 +2,7 @@
 /*
  * Utility routines.
  *
- * Copyright (C) tons of folks.  Tracking down who wrote what
- * isn't something I'm going to worry about...  If you wrote something
- * here, please feel free to acknowledge your work.
+ * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Based in part on code from sash, Copyright (c) 1999 by David I. Bell 
- * Permission has been granted to redistribute this code under the GPL.
- *
  */
 
 #include <stdio.h>
@@ -59,7 +53,7 @@ int recursive_action(const char *fileName,
        struct stat statbuf;
        struct dirent *next;
 
-       if (followLinks == TRUE)
+       if (followLinks)
                status = stat(fileName, &statbuf);
        else
                status = lstat(fileName, &statbuf);
@@ -74,14 +68,14 @@ int recursive_action(const char *fileName,
                return FALSE;
        }
 
-       if ((followLinks == FALSE) && (S_ISLNK(statbuf.st_mode))) {
+       if (! followLinks && (S_ISLNK(statbuf.st_mode))) {
                if (fileAction == NULL)
                        return TRUE;
                else
                        return fileAction(fileName, &statbuf, userData);
        }
 
-       if (recurse == FALSE) {
+       if (! recurse) {
                if (S_ISDIR(statbuf.st_mode)) {
                        if (dirAction != NULL)
                                return (dirAction(fileName, &statbuf, userData));
@@ -93,9 +87,9 @@ int recursive_action(const char *fileName,
        if (S_ISDIR(statbuf.st_mode)) {
                DIR *dir;
 
-               if (dirAction != NULL && depthFirst == FALSE) {
+               if (dirAction != NULL && ! depthFirst) {
                        status = dirAction(fileName, &statbuf, userData);
-                       if (status == FALSE) {
+                       if (! status) {
                                perror_msg("%s", fileName);
                                return FALSE;
                        } else if (status == SKIP)
@@ -115,20 +109,20 @@ int recursive_action(const char *fileName,
                                continue;
                        }
                        nextFile = concat_path_file(fileName, next->d_name);
-                       if (recursive_action(nextFile, TRUE, followLinks, depthFirst,
-                                               fileAction, dirAction, userData) == FALSE) {
+                       if (recursive_action(nextFile, TRUE, followLinks, depthFirst,
+                                               fileAction, dirAction, userData)) {
                                status = FALSE;
                        }
                        free(nextFile);
                }
                closedir(dir);
-               if (dirAction != NULL && depthFirst == TRUE) {
-                       if (dirAction(fileName, &statbuf, userData) == FALSE) {
+               if (dirAction != NULL && depthFirst) {
+                       if (! dirAction(fileName, &statbuf, userData)) {
                                perror_msg("%s", fileName);
                                return FALSE;
                        }
                }
-               if (status == FALSE)
+               if (! status)
                        return FALSE;
        } else {
                if (fileAction == NULL)