]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/compulsory_tests/has_info.c
From: Joseph Adams <joeyadams3.14159@gmail.com>
[ccan] / tools / ccanlint / compulsory_tests / has_info.c
index e7f2622d45df54eab03dd1cd24228ce7328e2581..a5c825265b3266bf9f6b00edc624345d255dd97f 100644 (file)
@@ -20,8 +20,8 @@ static void *check_has_info(struct manifest *m)
 
 static const char *describe_has_info(struct manifest *m, void *check_result)
 {
 
 static const char *describe_has_info(struct manifest *m, void *check_result)
 {
-       return "You have no _info.c file.\n\n"
-       "The file _info.c contains the metadata for a ccan package: things\n"
+       return "You have no _info file.\n\n"
+       "The file _info contains the metadata for a ccan package: things\n"
        "like the dependencies, the documentation for the package as a whole\n"
        "and license information.\n";
 }
        "like the dependencies, the documentation for the package as a whole\n"
        "and license information.\n";
 }
@@ -56,23 +56,26 @@ static void create_info_template(struct manifest *m, void *check_result)
 {
        FILE *info;
 
 {
        FILE *info;
 
-       if (!ask("Should I create a template _info.c file for you?"))
+       if (!ask("Should I create a template _info file for you?"))
                return;
 
                return;
 
-       info = fopen("_info.c", "w");
+       info = fopen("_info", "w");
        if (!info)
        if (!info)
-               err(1, "Trying to create a template _info.c");
+               err(1, "Trying to create a template _info");
 
        if (fprintf(info, template, m->basename) < 0) {
 
        if (fprintf(info, template, m->basename) < 0) {
-               unlink_noerr("_info.c");
-               err(1, "Writing template into _info.c");
+               unlink_noerr("_info");
+               err(1, "Writing template into _info");
        }
        fclose(info);
 }
 
 struct ccanlint has_info = {
        }
        fclose(info);
 }
 
 struct ccanlint has_info = {
-       .name = "Has _info.c file",
+       .key = "info",
+       .name = "Has _info file",
        .check = check_has_info,
        .describe = describe_has_info,
        .handle = create_info_template,
 };
        .check = check_has_info,
        .describe = describe_has_info,
        .handle = create_info_template,
 };
+
+REGISTER_TEST(has_info, NULL);