1 /*
2  *
3  * usage.c -
4  *
5  * $Id: usage.c,v 1.26.8.7 2007-12-05 16:59:36 opengl2772 Exp $
6  *
7  * Copyright (C) 1997-1999 Satoru Takabayashi All rights reserved.
8  * Copyright (C) 2000-2007 Namazu Project All rights reserved.
9  * This is free software with ABSOLUTELY NO WARRANTY.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  * 02111-1307, USA
25  *
26  *
27  */
28 
29 #ifdef HAVE_CONFIG_H
30 #  include "config.h"
31 #endif
32 
33 #include <stdio.h>
34 #include "namazu.h"
35 #include "libnamazu.h"
36 #include "codeconv.h"
37 #include "message.h"
38 #include "usage.h"
39 #include "i18n.h"
40 
41 /*
42  *
43  * Public functions
44  *
45  */
46 
47 /*
48  * Display the usage and version info and exit
49  */
50 void
show_usage(void)51 show_usage(void)
52 {
53     char *usage = _("\
54 namazu %s, a search program of Namazu.\n\n\
55 Usage: namazu [options] <query> [index]... \n\
56     -n, --max=NUM        set the number of documents shown to NUM.\n\
57     -w, --whence=NUM     set the first number of documents shown to NUM.\n\
58     -l, --list           print the results by listing the format.\n\
59     -s, --short          print the results in a short format.\n\
60         --result=EXT     set NMZ.result.EXT for printing the results.\n\
61         --late           sort the documents in late order.\n\
62         --early          sort the documents in early order.\n\
63         --sort=METHOD    set a sort METHOD (score, date, field:name)\n\
64         --ascending      sort in ascending order (default: descending)\n\
65     -a, --all            print all results.\n\
66     -c, --count          print only the number of hits.\n\
67     -h, --html           print in HTML format.\n\
68     -r, --no-references  do not display the reference hit counts.\n\
69     -H, --page           print the links of further results. \n\
70                          (This is nearly meaningless)\n\
71     -F, --form           force to print the <form> ... </form> region.\n\
72     -R, --no-replace     do not replace the URI string.\n\
73     -U, --no-decode-uri  do not decode the URI when printing in a plain format.\n\
74     -o, --output=FILE    set the output file name to FILE.\n\
75     -f, --config=FILE    set the config file name to FILE.\n\
76     -C, --show-config    print the current configuration.\n\
77     -q, --quiet          do not display extra messages except search results.\n\
78     -d, --debug          be in debug mode.\n\
79     -v, --version        show the namazu version and exit.\n\
80         --help           show this help and exit.\n\
81         --norc           do not read the personal initialization files.\n\
82         --               Terminate option list.\n\
83 \n\
84 Report bugs to <%s>\n\
85 or <%s>.\n\
86 ");
87 
88     printf(usage, VERSION, TRAC_URI, MAILING_ADDRESS);
89 }
90 
91 
92 void
show_mini_usage(void)93 show_mini_usage(void)
94 {
95     fputs(_("Usage: namazu [options] <query> [index]...\n"), stdout);
96     fputs(_("Try `namazu --help' for more information.\n"), stdout);
97 }
98 
99 void
show_version(void)100 show_version(void)
101 {
102     printf("namazu of Namazu %s\n", VERSION);
103     printf("%s\n", COPYRIGHT);
104     printf("This is free software; you can redistribute it and/or modify\n");
105     printf("it under the terms of the GNU General Public License as published by\n");
106     printf("the Free Software Foundation; either version 2, or (at your option)\n");
107     printf("any later version.\n\n");
108     printf("This program is distributed in the hope that it will be useful,\n");
109     printf("but WITHOUT ANY WARRANTY; without even the implied warranty\n");
110     printf("of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n");
111     printf("GNU General Public License for more details.\n");
112 }
113