summaryrefslogtreecommitdiffstats
path: root/bftw.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-11-01 21:46:50 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-05-28 20:49:54 -0400
commitfda29616c7af6b6e2a79c596cc01123a2d68ee02 (patch)
tree04aa6baac9ae4c1cf1afdc33c896bfa9ca97fda4 /bftw.h
parent1cc323eb88242bc7be7177ba4cb037a58c754763 (diff)
downloadbfs-fda29616c7af6b6e2a79c596cc01123a2d68ee02.tar.xz
Implement a depth-first mode (-dfs)
Diffstat (limited to 'bftw.h')
-rw-r--r--bftw.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/bftw.h b/bftw.h
index 6f5ad6d..f9d1aa0 100644
--- a/bftw.h
+++ b/bftw.h
@@ -190,6 +190,16 @@ enum bftw_flags {
};
/**
+ * Tree search strategies for bftw().
+ */
+enum bftw_strategy {
+ /** Breadth-first search. */
+ BFTW_BFS,
+ /** Depth-first search. */
+ BFTW_DFS,
+};
+
+/**
* Structure for holding the arguments passed to bftw().
*/
struct bftw_args {
@@ -205,6 +215,8 @@ struct bftw_args {
int nopenfd;
/** Flags that control bftw() behaviour. */
enum bftw_flags flags;
+ /** The search strategy to use. */
+ enum bftw_strategy strategy;
/** The parsed mount table, if available. */
const struct bfs_mtab *mtab;
};
@@ -213,8 +225,7 @@ struct bftw_args {
* Breadth First Tree Walk (or Better File Tree Walk).
*
* Like ftw(3) and nftw(3), this function walks a directory tree recursively,
- * and invokes a callback for each path it encounters. However, bftw() operates
- * breadth-first.
+ * and invokes a callback for each path it encounters.
*
* @param args
* The arguments that control the walk.