summaryrefslogtreecommitdiffstats
path: root/bftw.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-09-26 12:54:18 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-09-26 12:54:18 -0400
commitd0243a72d56326af2c5ff7b7b3823dbe57b3bd4c (patch)
tree10a9f4223ca594252392b8bf46b80e031f9dbb86 /bftw.h
parent4bedd5a6f7b12e0923dd6fa180dcaad7e1f75fc2 (diff)
downloadbfs-d0243a72d56326af2c5ff7b7b3823dbe57b3bd4c.tar.xz
Optimize -maxdepth in -depth mode.
Diffstat (limited to 'bftw.h')
-rw-r--r--bftw.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/bftw.h b/bftw.h
index f3be182..2082390 100644
--- a/bftw.h
+++ b/bftw.h
@@ -40,6 +40,16 @@ typedef enum {
} bftw_typeflag;
/**
+ * Possible visit occurrences.
+ */
+typedef enum {
+ /** Pre-order visit. */
+ BFTW_PRE,
+ /** Post-order visit. */
+ BFTW_POST,
+} bftw_visit;
+
+/**
* Data about the current file for the bftw() callback.
*/
struct BFTW {
@@ -50,6 +60,8 @@ struct BFTW {
/** The depth of this file in the traversal. */
size_t depth;
+ /** Which visit this is. */
+ bftw_visit visit;
/** The file type. */
bftw_typeflag typeflag;
@@ -93,7 +105,7 @@ typedef enum {
BFTW_STAT = 1 << 0,
/** Attempt to recover from encountered errors. */
BFTW_RECOVER = 1 << 1,
- /** Visit all of a directory's descendants before the directory itself. */
+ /** Visit directories in post-order as well as pre-order. */
BFTW_DEPTH = 1 << 2,
} bftw_flags;