2012-01-30 17:41:33 -05:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <sys/stat.h>
|
2013-03-05 15:46:48 -05:00
|
|
|
|
2012-01-30 17:41:33 -05:00
|
|
|
#include "../util.h"
|
|
|
|
|
|
|
|
void
|
2015-02-09 15:56:23 -05:00
|
|
|
fnck(const char *a, const char *b,
|
2015-03-02 15:43:56 -05:00
|
|
|
int (*fn)(const char *, const char *, int), int depth)
|
2012-01-30 17:41:33 -05:00
|
|
|
{
|
|
|
|
struct stat sta, stb;
|
|
|
|
|
2014-11-19 14:59:37 -05:00
|
|
|
if (!stat(a, &sta)
|
|
|
|
&& !stat(b, &stb)
|
|
|
|
&& sta.st_dev == stb.st_dev
|
|
|
|
&& sta.st_ino == stb.st_ino) {
|
2012-01-30 17:41:33 -05:00
|
|
|
eprintf("%s -> %s: same file\n", a, b);
|
2013-03-05 15:46:48 -05:00
|
|
|
}
|
|
|
|
|
2015-03-02 15:43:56 -05:00
|
|
|
if (fn(a, b, depth) < 0)
|
2012-01-30 17:41:33 -05:00
|
|
|
eprintf("%s -> %s:", a, b);
|
|
|
|
}
|