aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.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, int (*fn)(const char *, const char *, int), int depth)
      8 {
      9   struct stat sta, stb;
     10 
     11   if (!stat(a, &sta) && !stat(b, &stb) && sta.st_dev == stb.st_dev && sta.st_ino == stb.st_ino) {
     12     weprintf("%s -> %s: same file\n", a, b);
     13     return;
     14   }
     15 
     16   if (fn(a, b, depth) < 0)
     17     eprintf("%s -> %s:", a, b);
     18 }