int audit(const char *const *argv) { const struct audit_problem *problem; struct pkg_array array; bool head_running = false; int i; modstatdb_open(msdbrw_readonly); if (!*argv) pkg_array_init_from_db(&array); else pkg_array_init_from_names(&array, pkg_array_mapper, (const char **)argv); pkg_array_sort(&array, pkg_sorter_by_nonambig_name_arch); for (problem = audit_problems; problem->check; problem++) { bool head = false; for (i = 0; i < array.n_pkgs; i++) { struct pkginfo *pkg = array.pkgs[i]; if (!problem->check(pkg, problem)) continue; if (!head_running) { if (modstatdb_is_locked()) puts(_( "Another process has locked the database for writing, and might currently be\n" "modifying it, some of the following problems might just be due to that.\n")); head_running = true; } if (!head) { fputs(gettext(problem->explanation), stdout); head = true; } describebriefly(pkg); } if (head) putchar('\n'); } pkg_array_destroy(&array); m_output(stdout, _("<standard output>")); return 0; }
int audit(const char *const *argv) { const struct badstatinfo *bsi; bool head_running = false; enum modstatdb_rw msdb_status; if (*argv) badusage(_("--%s takes no arguments"), cipaction->olong); msdb_status = modstatdb_open(msdbrw_readonly); pkg_infodb_init(msdb_status); for (bsi= badstatinfos; bsi->yesno; bsi++) { struct pkgiterator *it; struct pkginfo *pkg; bool head = false; it = pkg_db_iter_new(); while ((pkg = pkg_db_iter_next_pkg(it))) { if (!bsi->yesno(pkg,bsi)) continue; if (!head_running) { if (modstatdb_is_locked()) puts(_( "Another process has locked the database for writing, and might currently be\n" "modifying it, some of the following problems might just be due to that.\n")); head_running = true; } if (!head) { fputs(gettext(bsi->explanation),stdout); head = true; } describebriefly(pkg); } pkg_db_iter_free(it); if (head) putchar('\n'); } m_output(stdout, _("<standard output>")); return 0; }