sbase

suckless unix tools
git clone git@git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

fnck.c (445B)


      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 		eprintf("%s -> %s: same file\n", a, b);
     17 	}
     18 
     19 	if (fn(a, b, depth) < 0)
     20 		eprintf("%s -> %s:", a, b);
     21 }