/*
- * crawl_folders.c -- crawl folder hierarchy
- *
- * This code is Copyright (c) 2008, by the authors of nmh. See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** crawl_folders.c -- crawl folder hierarchy
+**
+** This code is Copyright (c) 2008, by the authors of nmh. See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
#include <h/mh.h>
#include <h/crawl_folders.h>
#include <h/utils.h>
struct crawl_context {
- int max; /* how many folders we currently can hold in the array
- * `folders', increased by CRAWL_NUMFOLDERS at a time */
+ int max; /*
+ ** how many folders we currently can hold in the array
+ ** `folders', increased by CRAWL_NUMFOLDERS at a time
+ */
int total; /* how many `folders' actually has */
char **folders; /* the array of folders */
int start;
};
/*
- * Add the folder name into the
- * list in a sorted fashion.
- */
+** Add the folder name into the
+** list in a sorted fashion.
+*/
static void
add_folder (char *fold, struct crawl_context *crawl)
}
while ((dp = readdir (dd))) {
- /* If the system supports it, try to skip processing of
- * children we know are not directories or symlinks. */
+ /*
+ ** If the system supports it, try to skip processing of
+ ** children we know are not directories or symlinks.
+ */
child_is_folder = -1;
#if defined(HAVE_STRUCT_DIRENT_D_TYPE)
if (dp->d_type == DT_DIR) {
continue;
}
child = concat (prefix, dp->d_name, (void *)NULL);
- /* If we have no d_type or d_type is DT_LNK or DT_UNKNOWN, stat the
- * child to see what it is. */
+ /*
+ ** If we have no d_type or d_type is DT_LNK or DT_UNKNOWN,
+ ** stat the child to see what it is.
+ */
if (child_is_folder == -1) {
child_is_folder = (stat (child, &st) != -1 && S_ISDIR(st.st_mode));
}
crawl_folders_body (crawl, dir, callback, baton);
- /* Note that we "leak" the folder names, on the assumption that the caller
- * is using them. */
+ /*
+ ** Note that we "leak" the folder names, on the assumption that the
+ ** caller is using them.
+ */
free (crawl->folders);
free (crawl);
}