summaryrefslogtreecommitdiff
path: root/util/sbase/libutil/fnck.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/sbase/libutil/fnck.c')
-rw-r--r--util/sbase/libutil/fnck.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/util/sbase/libutil/fnck.c b/util/sbase/libutil/fnck.c
new file mode 100644
index 00000000..4f8875ba
--- /dev/null
+++ b/util/sbase/libutil/fnck.c
@@ -0,0 +1,22 @@
+/* See LICENSE file for copyright and license details. */
+#include <sys/stat.h>
+
+#include "../util.h"
+
+void
+fnck(const char *a, const char *b,
+ int (*fn)(const char *, const char *, int), int depth)
+{
+ struct stat sta, stb;
+
+ if (!stat(a, &sta)
+ && !stat(b, &stb)
+ && sta.st_dev == stb.st_dev
+ && sta.st_ino == stb.st_ino) {
+ weprintf("%s -> %s: same file\n", a, b);
+ return;
+ }
+
+ if (fn(a, b, depth) < 0)
+ eprintf("%s -> %s:", a, b);
+}