diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-09-27 12:55:55 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-09-27 13:23:49 -0400 |
commit | 62bbbe1a4165f63b31c68b1595ecb0e67d7af3dc (patch) | |
tree | c770ff13f37023cae132108b29077a904e6d4dfb /main.c | |
parent | 3c83bf4e1920be909f65945e56dc8b779c472a59 (diff) | |
download | bfs-62bbbe1a4165f63b31c68b1595ecb0e67d7af3dc.tar.xz |
Rename struct cmdline to bfs_ctx
The API remains similar, with some added accessor functions for lazy
initialization of the pwcache and mtab.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -18,18 +18,18 @@ * - main(): the entry point for bfs(1), a breadth-first version of find(1) * - main.c (this file) * - * - parse_cmdline(): parses the command line into an expression tree - * - cmdline.h (declares the parsed command line structure) + * - bfs_parse_cmdline(): parses the command line into an expression tree + * - ctx.[ch] (struct bfs_ctx, the overall bfs context) * - expr.h (declares the expression tree nodes) - * - parse.c (the parser itself) - * - opt.c (the expression optimizer) + * - parse.[ch] (the parser itself) + * - opt.[ch] (the optimizer) * - * - eval_cmdline(): runs the expression on every file it sees + * - bfs_eval(): runs the expression on every file it sees * - eval.[ch] (the main evaluation functions) * - exec.[ch] (implements -exec[dir]/-ok[dir]) * - printf.[ch] (implements -[f]printf) * - * - bftw(): used by eval_cmdline() to walk the directory tree(s) + * - bftw(): used by bfs_eval() to walk the directory tree(s) * - bftw.[ch] (an extended version of nftw(3)) * * - Utilities: @@ -49,7 +49,9 @@ * - util.[ch] (everything else) */ -#include "cmdline.h" +#include "ctx.h" +#include "eval.h" +#include "parse.h" #include "util.h" #include <errno.h> #include <fcntl.h> @@ -100,12 +102,12 @@ int main(int argc, char *argv[]) { // Use the system locale instead of "C" setlocale(LC_ALL, ""); - struct cmdline *cmdline = parse_cmdline(argc, argv); - if (cmdline) { - ret = eval_cmdline(cmdline); + struct bfs_ctx *ctx = bfs_parse_cmdline(argc, argv); + if (ctx) { + ret = bfs_eval(ctx); } - if (free_cmdline(cmdline) != 0 && ret == EXIT_SUCCESS) { + if (bfs_ctx_free(ctx) != 0 && ret == EXIT_SUCCESS) { ret = EXIT_FAILURE; } |