X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=196f75f4352f1750f033fbfe4c63b91f3b06fcdb;hb=49a1a4366fdcea418582a97cb0bf700373b89868;hp=83549cc968ffb71feb36da499453e3a3e996deec;hpb=09d5cd70d7e8105a003ed9583eadb077de014f3b;p=ccan diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 83549cc9..196f75f4 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -647,7 +647,7 @@ int main(int argc, char *argv[]) strmap_iterate(&tests, add_to_all, &all); /* This links back to the module's test dir. */ - testlink = tal_fmt(NULL, "%s/test", temp_dir()); + testlink = path_join(NULL, temp_dir(), "test"); /* Defaults to pwd. */ if (argc == 1) { @@ -656,12 +656,8 @@ int main(int argc, char *argv[]) } for (i = 1; i < argc; i++) { - dir = argv[i]; - - if (dir[0] != '/') - dir = tal_fmt(NULL, "%s/%s", base_dir, dir); - while (strends(dir, "/")) - dir[strlen(dir)-1] = '\0'; + dir = path_simplify(NULL, + take(path_join(NULL, base_dir, argv[i]))); got_dir: /* We assume there's a ccan/ in there somewhere... */ @@ -685,7 +681,7 @@ int main(int argc, char *argv[]) /* Create a symlink from temp dir back to src dir's * test directory. */ unlink(testlink); - if (symlink(tal_fmt(m, "%s/test", dir), testlink) != 0) + if (symlink(path_join(m, dir, "test"), testlink) != 0) err(1, "Creating test symlink in %s", temp_dir()); if (!run_tests(&all, summary, m, prefix))