33 #define PROG_NAME "xapian-check"
34 #define PROG_DESC "Check the consistency of a database or table"
37 cout <<
"Usage: " PROG_NAME " DATABASE_DIRECTORY|PATH_TO_BTREE [[F][t][f][b][v][+]]\n\n"
38 "If a whole database is checked, then additional cross-checks between\n"
39 "the tables are performed.\n\n"
40 "The btree(s) is/are always checked - control the output verbosity with:\n"
41 " F = attempt to fix a broken database (implemented for glass currently)\n"
42 " t = short tree printing\n"
43 " f = full tree printing\n"
44 " b = show free blocks\n"
45 " v = show stats about B-tree (default)\n"
47 " e.g. " PROG_NAME " /var/lib/xapian/data/default\n"
48 " " PROG_NAME " /var/lib/xapian/data/default/postlist fbv\n";
52 main(
int argc,
char **argv)
54 if (argc > 1 && argv[1][0] ==
'-') {
55 if (strcmp(argv[1],
"--help") == 0) {
60 if (strcmp(argv[1],
"--version") == 0) {
65 if (argc < 2 || argc > 3) {
71 const char * opt_string = argv[2];
72 if (!opt_string) opt_string =
"v";
73 for (
const char *
p = opt_string; *
p; ++
p) {
88 cerr <<
"option " << opt_string <<
" unknown\n";
89 cerr <<
"use t,f,b,v and/or + in the option string\n";
97 cout <<
"Total errors found: " << errors <<
'\n';
100 cout <<
"No errors found\n";
105 cerr << argv[0] <<
": Unknown exception\n";
static size_t check(std::string_view path, int opts=0, std::ostream *out=NULL)
Check the integrity of a database or database table.
All exceptions thrown by Xapian are subclasses of Xapian::Error.
std::string get_description() const
Return a string describing this object.
const int DBCHECK_SHOW_FREELIST
Show the bitmap for the B-tree.
const int DBCHECK_SHOW_STATS
Show statistics for the B-tree.
const int DBCHECK_SHORT_TREE
Show a short-format display of the B-tree contents.
const int DBCHECK_FIX
Fix problems.
const int DBCHECK_FULL_TREE
Show a full display of the B-tree contents.
int main(int argc, char **argv)
Public interfaces for the Xapian library.