2012-01-30 22:41:33 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <sys/stat.h>
|
2013-03-05 20:46:48 +00:00
|
|
|
|
2012-01-30 22:41:33 +00:00
|
|
|
#include "../util.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
fnck(const char *a, const char *b, int (*fn)(const char *, const char *))
|
|
|
|
{
|
|
|
|
struct stat sta, stb;
|
|
|
|
|
2013-03-05 20:46:48 +00:00
|
|
|
if(stat(a, &sta) == 0
|
|
|
|
&& stat(b, &stb) == 0
|
|
|
|
&& sta.st_dev == stb.st_dev
|
|
|
|
&& sta.st_ino == stb.st_ino) {
|
2012-01-30 22:41:33 +00:00
|
|
|
eprintf("%s -> %s: same file\n", a, b);
|
2013-03-05 20:46:48 +00:00
|
|
|
}
|
|
|
|
|
2012-01-30 22:41:33 +00:00
|
|
|
if(fn(a, b) == -1)
|
|
|
|
eprintf("%s -> %s:", a, b);
|
|
|
|
}
|