Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Use only single output plugin at the time
Browse files Browse the repository at this point in the history
Before this patch we have following output logic
managed by the --csv and --no-html options:

  1. CSV and HTML reports are mutually exclusive
  2. CSV uses stdout as reports destinations
  3. CLI is only used when CSV isn't enabled
  4. The only option to disable CLI is to use CSV mode.

Change --csv and --no-html options handling so
that only single output plugin could be used at
the time.

This patch is prepare to make use stdout in all
report plugins as output destination.

Signed-off-by: Sergey Popovich <[email protected]>
  • Loading branch information
Sergey Popovich authored and Serhii Popovych committed Jan 5, 2016
1 parent 652ae0a commit 9cfb9be
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,6 @@ int main(int argc, char **argv)
self->show_unaffected = show_unaffected;
instance.db = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, package_free);
instance.bdb = NULL;
/* Automatically disable HTML output in CSV mode */
if (csv_mode) {
no_html = true;
}

cve_plugin_manager_init();

Expand Down Expand Up @@ -718,32 +714,23 @@ int main(int argc, char **argv)
*/
if (csv_mode) {
report = cve_plugin_get_by_name("csv");
} else if (!no_html) {
report = cve_plugin_get_by_name("html");
} else {
report = cve_plugin_get_by_name("cli");
}

if (!report || !report->report) {
fprintf(stderr, "No usable output module\n");
goto cleanup;
}

if (!report->report(self)) {
fprintf(stderr, "Report generation failed\n");
goto cleanup;
}

if (!no_html) {
report = cve_plugin_get_by_name("html");
if (!report || !report->report) {
fprintf(stderr, "html module is missing\n");
goto cleanup;
}
if (!report->report(self)) {
fprintf(stderr, "Report generation failed\n");
} else {
ret = EXIT_SUCCESS;
}
} else {
ret = EXIT_SUCCESS;
}
ret = EXIT_SUCCESS;

cleanup:
cve_plugin_manager_destroy();
Expand Down

0 comments on commit 9cfb9be

Please sign in to comment.