summaryrefslogtreecommitdiffstats
path: root/bfs.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-01 17:41:55 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-02 10:35:52 -0500
commitb997ddf3df6535765f7eab0683eae4703933a703 (patch)
treef49da0ca0bb1d84d6a0eb4494dc52e1b911aaf74 /bfs.h
parente641450d7d5dd86139b92fe6f69801b16dd3eeed (diff)
downloadbfs-b997ddf3df6535765f7eab0683eae4703933a703.tar.xz
Add -[acm]{min,time} support.
Diffstat (limited to 'bfs.h')
-rw-r--r--bfs.h39
1 files changed, 34 insertions, 5 deletions
diff --git a/bfs.h b/bfs.h
index 441993b..e4dffdd 100644
--- a/bfs.h
+++ b/bfs.h
@@ -15,6 +15,7 @@
#include "color.h"
#include <stdbool.h>
#include <stddef.h>
+#include <time.h>
/**
* The parsed command line.
@@ -64,8 +65,23 @@ struct cmdline {
/** The command line expression. */
expression *expr;
+
+ /** The current time. */
+ struct timespec now;
};
+/**
+ * Possible types of numeric comparison.
+ */
+typedef enum {
+ /** Exactly n. */
+ CMP_EXACT,
+ /** Less than n. */
+ CMP_LESS,
+ /** Greater than n. */
+ CMP_GREATER,
+} cmpflag;
+
struct expression {
/** The left hand side of the expression. */
expression *lhs;
@@ -73,6 +89,8 @@ struct expression {
expression *rhs;
/** The function that evaluates this expression. */
eval_fn *eval;
+ /** The comparison flag. */
+ cmpflag cmp;
/** Optional integer data for this expression. */
int idata;
/** Optional string data for this expression. */
@@ -95,20 +113,31 @@ int eval_cmdline(cmdline *cl);
void free_cmdline(cmdline *cl);
// Predicate evaluation functions
+bool eval_true(const expression *expr, eval_state *state);
+bool eval_false(const expression *expr, eval_state *state);
+
bool eval_access(const expression *expr, eval_state *state);
-bool eval_delete(const expression *expr, eval_state *state);
+
+bool eval_amin(const expression *expr, eval_state *state);
+bool eval_atime(const expression *expr, eval_state *state);
+bool eval_cmin(const expression *expr, eval_state *state);
+bool eval_ctime(const expression *expr, eval_state *state);
+bool eval_mmin(const expression *expr, eval_state *state);
+bool eval_mtime(const expression *expr, eval_state *state);
+
bool eval_empty(const expression *expr, eval_state *state);
-bool eval_false(const expression *expr, eval_state *state);
bool eval_hidden(const expression *expr, eval_state *state);
+bool eval_type(const expression *expr, eval_state *state);
+
bool eval_name(const expression *expr, eval_state *state);
-bool eval_nohidden(const expression *expr, eval_state *state);
bool eval_path(const expression *expr, eval_state *state);
+
+bool eval_delete(const expression *expr, eval_state *state);
+bool eval_nohidden(const expression *expr, eval_state *state);
bool eval_print(const expression *expr, eval_state *state);
bool eval_print0(const expression *expr, eval_state *state);
bool eval_prune(const expression *expr, eval_state *state);
bool eval_quit(const expression *expr, eval_state *state);
-bool eval_true(const expression *expr, eval_state *state);
-bool eval_type(const expression *expr, eval_state *state);
// Operator evaluation functions
bool eval_not(const expression *expr, eval_state *state);