Fix tg_termpos1 for 64-bit termpos
[xapian.git] / xapian-applications / omega / commonhelp.cc
blobfe2567933d23ad9ccceaeb83c69e2cfa8ea0bb66
1 /** @file
2 * @brief handle command line help common to omindex and scriptindex
3 */
4 /* Copyright (C) 2005,2006,2008,2009,2010,2013 Olly Betts
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
19 * USA
22 #include <config.h>
24 #include "commonhelp.h"
26 #include <xapian.h>
28 #include <cstring>
29 #include <iostream>
30 #include <string>
32 using namespace std;
34 void print_package_info(const char *name) {
35 cout << name << " - " PACKAGE_STRING << endl;
38 void print_stemmer_help(const char * spaces) {
39 cout << " -s, --stemmer=LANG " << spaces << "set the stemming language (default: english).\n";
40 string wrap = "Possible values: " + Xapian::Stem::get_available_languages();
41 wrap += " (pass 'none' to disable stemming)";
42 const size_t WRAP_AT = 79 - 22 - strlen(spaces);
43 while (wrap.size() > WRAP_AT) {
44 size_t i;
45 for (i = WRAP_AT; i > 0 && wrap[i] != ' '; --i) { }
46 if (i == 0) break;
47 cout << string(22, ' ') << spaces << wrap.substr(0, i) << "\n";
48 wrap.erase(0, i + 1);
50 cout << string(22, ' ') << spaces << wrap << endl;
53 void print_help_and_version_help(const char * spaces) {
54 cout << " -h, --help " << spaces << "display this help and exit\n"
55 " -V, --version " << spaces << "output version information and exit\n"
56 "\n"
57 "Please report bugs at:\n"
58 PACKAGE_BUGREPORT << endl;