return r;
}
+bool dirent_is_file(struct dirent *de) {
+ assert(de);
+
+ if (ignore_file(de->d_name))
+ return false;
+
+ if (de->d_type != DT_REG &&
+ de->d_type != DT_LNK &&
+ de->d_type != DT_UNKNOWN)
+ return false;
+
+ return true;
+}
+
void execute_directory(const char *directory, DIR *d, char *argv[]) {
DIR *_d = NULL;
struct dirent *de;
pid_t pid;
int k;
- if (ignore_file(de->d_name))
- continue;
-
- if (de->d_type != DT_REG &&
- de->d_type != DT_LNK &&
- de->d_type != DT_UNKNOWN)
+ if (!dirent_is_file(de))
continue;
if (asprintf(&path, "%s/%s", directory, de->d_name) < 0) {
char *ascii_strlower(char *path);
+bool dirent_is_file(struct dirent *de);
bool ignore_file(const char *filename);
bool chars_intersect(const char *a, const char *b);