]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/ccanlint.c
Make manifest code do chdir into appropriate directory.
[ccan] / tools / ccanlint / ccanlint.c
index 4590ba8c34de081fdd909d381c4a3d2d0b106548..968f655e397f2719217bd4d8ed8f49002787175e 100644 (file)
@@ -241,16 +241,17 @@ int main(int argc, char *argv[])
 {
        int c;
        bool summary = false;
-       unsigned int score, total_score;
+       unsigned int score = 0, total_score = 0;
        struct manifest *m;
        struct ccanlint *i;
-       const char *prefix = "";
+       const char *prefix = "", *dir = ".";
 
        /* I'd love to use long options, but that's not standard. */
        /* FIXME: getopt_long ccan package? */
        while ((c = getopt(argc, argv, "sd:vn")) != -1) {
                switch (c) {
                case 'd':
+                       dir = optarg;
                        prefix = talloc_append_string(talloc_basename(NULL,
                                                                      optarg),
                                                      ": ");
@@ -274,7 +275,7 @@ int main(int argc, char *argv[])
        if (optind < argc)
                usage(argv[0]);
 
-       m = get_manifest(talloc_autofree_context());
+       m = get_manifest(talloc_autofree_context(), dir);
 
        init_tests();
 
@@ -290,7 +291,6 @@ int main(int argc, char *argv[])
 
        if (verbose)
                printf("\nNormal tests:\n");
-       score = total_score = 0;
        while ((i = get_next_test(&normal_tests)) != NULL)
                run_test(i, summary, &score, &total_score, m);