1 #include <tools/ccanlint/ccanlint.h>
12 #include <ccan/noerr/noerr.h>
14 static void *check_has_info(struct manifest *m)
21 static const char *describe_has_info(struct manifest *m, void *check_result)
23 return "You have no _info file.\n\n"
24 "The file _info contains the metadata for a ccan package: things\n"
25 "like the dependencies, the documentation for the package as a whole\n"
26 "and license information.\n";
29 static const char template[] =
30 "#include <string.h>\n"
31 "#include \"config.h\"\n"
34 " * %s - YOUR-ONE-LINE-DESCRIPTION-HERE\n"
36 " * This code ... YOUR-BRIEF-SUMMARY-HERE\n"
39 " * FULLY-COMPILABLE-INDENTED-TRIVIAL-BUT-USEFUL-EXAMPLE-HERE\n"
41 "int main(int argc, char *argv[])\n"
43 " /* Expect exactly one argument */\n"
47 " if (strcmp(argv[1], \"depends\") == 0) {\n"
48 " PRINTF-CCAN-PACKAGES-YOU-NEED-ONE-PER-LINE-IF-ANY\n"
55 static void create_info_template(struct manifest *m, void *check_result)
59 if (!ask("Should I create a template _info file for you?"))
62 info = fopen("_info", "w");
64 err(1, "Trying to create a template _info");
66 if (fprintf(info, template, m->basename) < 0) {
67 unlink_noerr("_info");
68 err(1, "Writing template into _info");
73 struct ccanlint has_info = {
74 .name = "Has _info file",
75 .check = check_has_info,
76 .describe = describe_has_info,
77 .handle = create_info_template,
80 REGISTER_TEST(has_info, NULL);