summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-10 22:15:41 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-10 22:15:41 -0500
commitaeff24ee344e5b9c4f2f9040a02320952e70ccd7 (patch)
tree4336db598aab697f683fd62b0696d37a3e9be6e7 /eval.c
parentfc3b5fab4cb4f9a20671e17e31126f360b0e941a (diff)
downloadbfs-aeff24ee344e5b9c4f2f9040a02320952e70ccd7.tar.xz
Implement -samefile.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 543a98a..01da7a4 100644
--- a/eval.c
+++ b/eval.c
@@ -342,6 +342,18 @@ bool eval_quit(const struct expr *expr, struct eval_state *state) {
}
/**
+ * -samefile test.
+ */
+bool eval_samefile(const struct expr *expr, struct eval_state *state) {
+ const struct stat *statbuf = fill_statbuf(state);
+ if (!statbuf) {
+ return false;
+ }
+
+ return statbuf->st_dev == expr->dev && statbuf->st_ino == expr->ino;
+}
+
+/**
* -type test.
*/
bool eval_type(const struct expr *expr, struct eval_state *state) {