summaryrefslogtreecommitdiff
path: root/util/sbase/libutil/fnck.c
blob: 4f8875baf8dbb3967d391fab744c891ac658a6ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}