sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

fnck.c (456B)


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