From aeff24ee344e5b9c4f2f9040a02320952e70ccd7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 10 Feb 2016 22:15:41 -0500 Subject: Implement -samefile. --- eval.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 543a98a..01da7a4 100644 --- a/eval.c +++ b/eval.c @@ -341,6 +341,18 @@ bool eval_quit(const struct expr *expr, struct eval_state *state) { return true; } +/** + * -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. */ -- cgit v1.2.3