1/* See LICENSE file for copyright and license details. */
2#include <sys/stat.h>
3
4#include "../util.h"
5
6void
7fnck(const char *a, const char *b, int (*fn)(const char *, const char *, int), int depth)
8{
9 struct stat sta, stb;
10
11 if (!stat(a, &sta) && !stat(b, &stb) && sta.st_dev == stb.st_dev && sta.st_ino == stb.st_ino) {
12 weprintf("%s -> %s: same file\n", a, b);
13 return;
14 }
15
16 if (fn(a, b, depth) < 0)
17 eprintf("%s -> %s:", a, b);
18}