diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-05-22 13:17:02 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-05-22 13:17:02 -0400 |
commit | 8ea44cab76a20f1c5ac473b1651611bea0ee9e6b (patch) | |
tree | cd2d47aef86e6ce8fa0fd49a3baa6a5709aba8ae /bfs.h | |
parent | a36577183430607196e88c2b951f2dc71a06dbaf (diff) | |
download | bfs-8ea44cab76a20f1c5ac473b1651611bea0ee9e6b.tar.xz |
Implement -{exec,ok}{,dir}.
Diffstat (limited to 'bfs.h')
-rw-r--r-- | bfs.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -143,6 +143,18 @@ enum sizeunit { SIZE_GB, }; +/** + * Flags for the -exec actions. + */ +enum execflags { + /** Prompt the user before executing (-ok, -okdir). */ + EXEC_CONFIRM = 1 << 0, + /** Run the command in the file's parent directory (-execdir, -okdir). */ + EXEC_CHDIR = 1 << 1, + /** Pass multiple files at once to the command (-exec ... {} +). */ + EXEC_MULTI = 1 << 2, +}; + struct expr { /** The function that evaluates this expression. */ eval_fn *eval; @@ -161,7 +173,7 @@ struct expr { size_t nargs; /** The optional comparison flag. */ - enum cmpflag cmp; + enum cmpflag cmpflag; /** The optional reference time. */ struct timespec reftime; @@ -178,6 +190,9 @@ struct expr { /** Optional inode number for a target file. */ ino_t ino; + /** Optional -exec flags. */ + enum execflags execflags; + /** Optional integer data for this expression. */ long long idata; @@ -227,6 +242,7 @@ bool eval_name(const struct expr *expr, struct eval_state *state); bool eval_path(const struct expr *expr, struct eval_state *state); bool eval_delete(const struct expr *expr, struct eval_state *state); +bool eval_exec(const struct expr *expr, struct eval_state *state); bool eval_nohidden(const struct expr *expr, struct eval_state *state); bool eval_print(const struct expr *expr, struct eval_state *state); bool eval_print0(const struct expr *expr, struct eval_state *state); |