From f1401f09c59363170f021c4a1676735be2e3cc44 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 12 Mar 2016 16:07:34 -0500 Subject: Implement -size. --- bfs.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'bfs.h') diff --git a/bfs.h b/bfs.h index 1e38869..f0aaada 100644 --- a/bfs.h +++ b/bfs.h @@ -125,6 +125,24 @@ enum timeunit { DAYS, }; +/** + * Possible file size units. + */ +enum sizeunit { + /** 512-byte blocks. */ + SIZE_BLOCKS, + /** Single bytes. */ + SIZE_BYTES, + /** Two-byte words. */ + SIZE_WORDS, + /** Kibibytes. */ + SIZE_KB, + /** Mebibytes. */ + SIZE_MB, + /** Gibibytes. */ + SIZE_GB, +}; + struct expr { /** The function that evaluates this expression. */ eval_fn *eval; @@ -152,13 +170,16 @@ struct expr { /** The optional time unit. */ enum timeunit timeunit; + /** The optional size unit. */ + enum sizeunit sizeunit; + /** Optional device number for a target file. */ dev_t dev; /** Optional inode number for a target file. */ ino_t ino; /** Optional integer data for this expression. */ - int idata; + long long idata; /** Optional string data for this expression. */ const char *sdata; @@ -197,6 +218,7 @@ bool eval_hidden(const struct expr *expr, struct eval_state *state); bool eval_inum(const struct expr *expr, struct eval_state *state); bool eval_links(const struct expr *expr, struct eval_state *state); bool eval_samefile(const struct expr *expr, struct eval_state *state); +bool eval_size(const struct expr *expr, struct eval_state *state); bool eval_type(const struct expr *expr, struct eval_state *state); bool eval_xtype(const struct expr *expr, struct eval_state *state); -- cgit v1.2.3