summaryrefslogtreecommitdiffstats
path: root/bfs.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-05-22 13:17:02 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-05-22 13:17:02 -0400
commit8ea44cab76a20f1c5ac473b1651611bea0ee9e6b (patch)
treecd2d47aef86e6ce8fa0fd49a3baa6a5709aba8ae /bfs.h
parenta36577183430607196e88c2b951f2dc71a06dbaf (diff)
downloadbfs-8ea44cab76a20f1c5ac473b1651611bea0ee9e6b.tar.xz
Implement -{exec,ok}{,dir}.
Diffstat (limited to 'bfs.h')
-rw-r--r--bfs.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/bfs.h b/bfs.h
index d5cc343..42bbdd4 100644
--- a/bfs.h
+++ b/bfs.h
@@ -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);