X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Finfo_exists.c;fp=tools%2Fccanlint%2Fcompulsory_tests%2Finfo_exists.c;h=0000000000000000000000000000000000000000;hp=ac84011978e86edbd0209270b8b07f68ae3d5b21;hb=60824f8a0f758dc7808eb31cc83434ea78f44ed1;hpb=50212d0d271f967d9f5d14c116ec54c0050882a8;ds=sidebyside diff --git a/tools/ccanlint/compulsory_tests/info_exists.c b/tools/ccanlint/compulsory_tests/info_exists.c deleted file mode 100644 index ac840119..00000000 --- a/tools/ccanlint/compulsory_tests/info_exists.c +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static void check_has_info(struct manifest *m, - bool keep, - unsigned int *timeleft, - struct score *score) -{ - if (m->info_file) { - score->pass = true; - score->score = score->total; - } else { - score->error = talloc_strdup(score, - "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"); - } -} - -static const char template[] = - "#include \n" - "#include \"config.h\"\n" - "\n" - "/**\n" - " * %s - YOUR-ONE-LINE-DESCRIPTION-HERE\n" - " *\n" - " * This code ... YOUR-BRIEF-SUMMARY-HERE\n" - " *\n" - " * Example:\n" - " * FULLY-COMPILABLE-INDENTED-TRIVIAL-BUT-USEFUL-EXAMPLE-HERE\n" - " */\n" - "int main(int argc, char *argv[])\n" - "{\n" - " /* Expect exactly one argument */\n" - " if (argc != 2)\n" - " return 1;\n" - "\n" - " if (strcmp(argv[1], \"depends\") == 0) {\n" - " PRINTF-CCAN-PACKAGES-YOU-NEED-ONE-PER-LINE-IF-ANY\n" - " return 0;\n" - " }\n" - "\n" - " return 1;\n" - "}\n"; - -static void create_info_template(struct manifest *m, struct score *score) -{ - FILE *info; - const char *filename; - - if (!ask("Should I create a template _info file for you?")) - return; - - filename = talloc_asprintf(m, "%s/%s", m->dir, "_info"); - info = fopen(filename, "w"); - if (!info) - err(1, "Trying to create a template _info in %s", filename); - - if (fprintf(info, template, m->basename) < 0) { - unlink_noerr(filename); - err(1, "Writing template into %s", filename); - } - fclose(info); -} - -struct ccanlint info_exists = { - .key = "info_exists", - .name = "Module has _info file", - .check = check_has_info, - .handle = create_info_template, - .needs = "" -}; - -REGISTER_TEST(info_exists);