+/* Walk up tp find /ccan/ => ccan directory. */
+static unsigned int ccan_dir_prefix(const char *fulldir)
+{
+ unsigned int i;
+
+ assert(fulldir[0] == '/');
+ for (i = strlen(fulldir) - 1; i > 0; i--) {
+ if (strncmp(fulldir+i, "/ccan", 5) != 0)
+ continue;
+ if (fulldir[i+5] != '\0' && fulldir[i+5] != '/')
+ continue;
+ return i + 1;
+ }
+ errx(1, "Could not find /ccan/ dir in %s", fulldir);
+}
+