diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-11-01 21:46:50 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-05-28 20:49:54 -0400 |
commit | fda29616c7af6b6e2a79c596cc01123a2d68ee02 (patch) | |
tree | 04aa6baac9ae4c1cf1afdc33c896bfa9ca97fda4 /bftw.h | |
parent | 1cc323eb88242bc7be7177ba4cb037a58c754763 (diff) | |
download | bfs-fda29616c7af6b6e2a79c596cc01123a2d68ee02.tar.xz |
Implement a depth-first mode (-dfs)
Diffstat (limited to 'bftw.h')
-rw-r--r-- | bftw.h | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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. |