X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=d09f68da19dc94932f4ba05d09a44d550e121608;hp=31406cccbfa0386a8cda1b3f451a094b11984150;hb=7ddfc6696d29eacb3d4d896aac93721aee45d844;hpb=7a163ea2dcafc056fdafc8c71ef011e2bfdbeb65 diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 31406ccc..d09f68da 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -1,6 +1,7 @@ /* * ccanlint: assorted checks and advice for a ccan package * Copyright (C) 2008 Rusty Russell, Idris Soule + * Copyright (C) 2010 Rusty Russell, Idris Soule * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -58,7 +59,7 @@ static void indent_print(const char *string) bool ask(const char *question) { - char reply[2]; + char reply[80]; printf("%s ", question); fflush(stdout); @@ -148,11 +149,13 @@ static bool run_test(struct ccanlint *i, printf("\n"); } - if (!quiet && !score->pass) { + if ((!quiet && !score->pass) || verbose) { struct file_error *f; + unsigned int lines = 1; if (score->error) - printf("%s:\n", score->error); + printf("%s%s\n", score->error, + list_empty(&score->per_file_errors) ? "" : ":"); list_for_each(&score->per_file_errors, f, list) { if (f->line) @@ -162,8 +165,12 @@ static bool run_test(struct ccanlint *i, printf("%s:%s\n", f->file->fullname, f->error); else printf("%s\n", f->error); + if (verbose < 2 && ++lines > 5) { + printf("... more (use -vv to see them all)\n"); + break; + } } - if (i->handle) + if (!quiet && !score->pass && i->handle) i->handle(m, score); } @@ -409,7 +416,7 @@ int main(int argc, char *argv[]) opt_register_noarg("--summary|-s", opt_set_bool, &summary, "simply give one line summary"); opt_register_noarg("--verbose|-v", opt_inc_intval, &verbose, - "verbose mode (can specify more than once)"); + "verbose mode (up to -vvvv)"); opt_register_arg("-x|--exclude ", skip_test, NULL, NULL, "exclude (can be used multiple times)"); opt_register_arg("-t|--timeout ", opt_set_uintval, @@ -429,9 +436,9 @@ int main(int argc, char *argv[]) dir = talloc_asprintf_append(NULL, "%s/%s", base_dir, dir); if (dir != base_dir) prefix = talloc_append_string(talloc_basename(NULL, dir), ": "); - if (verbose >= 2) - compile_verbose = true; if (verbose >= 3) + compile_verbose = true; + if (verbose >= 4) tools_verbose = true; /* We move into temporary directory, so gcov dumps its files there. */ @@ -462,7 +469,10 @@ int main(int argc, char *argv[]) } } - add_info_fails(m->info_file); + /* --target overrides _info excludes */ + if (!target) + add_info_fails(m->info_file); + while ((i = get_next_test(&normal_tests)) != NULL) run_test(i, summary, &score, &total_score, m);