1 /*
2  *
3  * messages.c -
4  *
5  * Copyright (C) 1997-1999 Satoru Takabayashi  All rights reserved.
6  * This is free software with ABSOLUTELY NO WARRANTY.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  * 02111-1307, USA
22  *
23  * This file must be encoded in EUC-JP encoding.
24  *
25  */
26 
27 #include <stdio.h>
28 #include <string.h>
29 #include "namazu.h"
30 
31 uchar *MSG_MIME_HEADER;
32 
33 #ifdef LANGUAGE
34 uchar Lang[] = LANGUAGE;
35 #else
36 uchar Lang[] = "en";
37 #endif
38 
39 /* information about Namazu */
40 uchar *VERSION = "1.3.0.11";
41 uchar *COPYRIGHT =
42 "  Copyright (C) 1997-1999 Satoru Takabayashi All rights reserved.";
43 
44 uchar *MSG_USAGE, *MSG_TOO_LONG_KEY, *MSG_TOO_MANY_KEYITEM,
45 *MSG_RESULT_HEADER, *MSG_NO_HIT, *MSG_HIT_1, *MSG_HIT_2,
46 *MSG_TOO_MUCH_HIT, *MSG_TOO_MUCH_MATCH, *MSG_INDEXDIR_ERROR,
47 *MSG_REFERENCE_HEADER, *MSG_INVALID_DB_NAME, *MSG_INVALID_QUERY,
48 *MSG_CANNOT_OPEN_INDEX, *MSG_CANNOT_OPEN_REGEX_INDEX,
49 *MSG_CANNOT_OPEN_PHRASE_INDEX, *MSG_CANNOT_OPEN_FIELD_INDEX,
50 *MSG_QUERY_STRING_TOO_LONG;
51 
52 
53 /*
54   beggening '\t' means this string contains HTML tag.
55   It's treated with special care as Namazu's HTML message.
56  */
57 
initialize_message(void)58 void initialize_message(void)
59 {
60     if (is_lang_ja(Lang)) {
61 #if	defined(WIN32) || defined(OS2)
62         MSG_MIME_HEADER = "Content-type: text/html; charset=ISO-2022-JP\n\n";
63 #else
64         MSG_MIME_HEADER = "Content-type: text/html; charset=ISO-2022-JP\r\n\r\n";
65 #endif
66 
67       MSG_USAGE = "%s\n\
68   ��ʸ���������ƥ� Namazu �θ����ץ���� v%s\n\n\
69   usage: namazu [options] <query> [index dir(s)] \n\
70      -n (num)  : ���٤�ɽ��������\n\
71      -w (num)  : ɽ������ꥹ�Ȥ���Ƭ�ֹ�\n\
72      -s        : û���ե����ޥåȤǽ���\n\
73      -S        : ��ä�û���ե����ޥå� (�ꥹ��ɽ��) �ǽ���\n\
74      -v        : usage ��ɽ������ (����ɽ��)\n\
75      -f (file) : namazu.conf ����ꤹ��\n\
76      -h        : HTML �ǽ��Ϥ���\n\
77      -l        : ��������˥����Ȥ���\n\
78      -e        : �Ť���˥����Ȥ���\n\
79      -a        : ������̤��٤�ɽ������\n\
80      -c        : �ҥåȿ��Τߤ�ɽ������\n\
81      -r        : ���ͥҥåȿ���ɽ�����ʤ�\n\
82      -o (file) : ���ꤷ���ե�����˸�����̤���Ϥ���\n\
83      -C        : ����ե�����졼��������Ƥ�ɽ������\n\
84      -H        : ��θ�����̤ؤΥ����ɽ������ (�ۤ�̵��̣) \n\
85      -F        : <FORM> ... </FORM> ����ʬ����Ū��ɽ������\n\
86      -R        : URL ���֤�������Ԥ�ʤ�\n\
87      -U        : plain text �ǽ��Ϥ������ URL encode ��������Ԥ�ʤ�\n\
88      -L (lang) : ��å������θ�������ꤹ�� ja �ޤ��� en\n";
89 
90         /* output messages (Japanese message should be outputed by
91            euctojisput function */
92         MSG_TOO_LONG_KEY =
93             "\t<H2>���顼!</H2>\n<P>��������Ĺ�����ޤ���</P>\n";
94         MSG_TOO_MANY_KEYITEM =
95             "\t<H2>���顼!</H2>\n<P>�������ι��ܤ�¿�����ޤ���</P>\n";
96         MSG_QUERY_STRING_TOO_LONG = "CGI�Υ����꡼��Ĺ�����ޤ�";
97         MSG_INVALID_QUERY =
98             "\t<H2>���顼!</H2>\n<P>�������������Ǥ���</P>\n";
99         MSG_RESULT_HEADER = "\t<H2>�������</H2>\n";
100         MSG_NO_HIT = "\t<P>�������˥ޥå�����ʸ��Ϥ���ޤ���Ǥ�����</P>\n";
101         MSG_HIT_1 = "\t<P><STRONG>�������˥ޥå����� ";
102         MSG_HIT_2 = "\t �Ĥ�ʸ�����Ĥ���ޤ�����</STRONG></P>\n\n";
103         MSG_TOO_MUCH_HIT = " (�ҥåȿ���¿������Τ�̵�뤷�ޤ���)";
104         MSG_TOO_MUCH_MATCH = " (�ޥå�����ñ�줬¿������Τ�̵�뤷�ޤ���)";
105         MSG_CANNOT_OPEN_INDEX = " (����ǥå����������ޤ���Ǥ���)\n";
106         MSG_CANNOT_OPEN_REGEX_INDEX = " (����ɽ���ѥ���ǥå����������ޤ���Ǥ���)";
107         MSG_CANNOT_OPEN_FIELD_INDEX = " (�ե�����ɸ����ѥ���ǥå����������ޤ���Ǥ���)";
108         MSG_CANNOT_OPEN_PHRASE_INDEX = " (�ե졼�������ѥ���ǥå����������ޤ���Ǥ���)";
109         MSG_INDEXDIR_ERROR = "INDEXDIR ��������ǧ���Ƥ�������\n";
110         MSG_REFERENCE_HEADER = "\t<STRONG>���ͥҥåȿ�:</STRONG> ";
111         MSG_INVALID_DB_NAME = "������ dbname �λ���Ǥ�";
112     } else {
113 #if	defined(WIN32) || defined(OS2)
114         MSG_MIME_HEADER = "Content-type: text/html\n\n";
115 #else
116         MSG_MIME_HEADER = "Content-type: text/html\r\n\r\n";
117 #endif
118 
119         MSG_USAGE = "%s\n\
120   Search Program of Namazu v%s\n\n\
121   usage: namazu [options] <query> [index dir(s)] \n\
122      -n (num)  : set number of documents shown at once.\n\
123      -w (num)  : set first number of documents shown.\n\
124      -s        : output by short format.\n\
125      -S        : output by more short format (simple listing).\n\
126      -v        : print this help and exit.\n\
127      -f (file) : set pathname of namazu.conf.\n\
128      -h        : output by HTML format.\n\
129      -l        : sort documents in reverse order.\n\
130      -e        : sort documents in normal order.\n\
131      -a        : output all documents.\n\
132      -c        : output only hit conunts\n\
133      -r        : do not display reference hit counts.\n\
134      -o (file) : set output file name.\n\
135      -C        : print current configuration.\n\
136      -H        : output further result link (nearly meaningless) .\n\
137      -F        : force <FORM> ... </FORM> region to output.\n\
138      -R        : do not replace URL string.\n\
139      -U        : do not decode URL encode when plain text output.\n\
140      -L (lang) : set output language (ja or en)\n";
141 
142         MSG_TOO_LONG_KEY =
143             "\t<H2>Error!</H2>\n<P>Too long query.</P>\n";
144         MSG_TOO_MANY_KEYITEM =
145             "\t<H2>Error!</H2>\n<P>Too many queries.</P>\n";
146         MSG_QUERY_STRING_TOO_LONG = "Too long CGI query length";
147         MSG_INVALID_QUERY =
148             "\t<H2>Error!</H2>\n<P>Invalid query.</P>\n";
149         MSG_RESULT_HEADER = "\t<H2>Results:</H2>\n";
150         MSG_NO_HIT = "\t<P>No match.</P>\n";
151         MSG_HIT_1 = "\t<P><STRONG> Total ";
152         MSG_HIT_2 = "\t documents match your query.</STRONG></P>\n\n";
153         MSG_TOO_MUCH_HIT = " (Too many pages. Ignored.)";
154         MSG_TOO_MUCH_MATCH = " (Too many words. Ignored.)";
155         MSG_CANNOT_OPEN_INDEX = " (cannot open index)\n";
156         MSG_CANNOT_OPEN_FIELD_INDEX = " (cannot open field index)";
157         MSG_CANNOT_OPEN_REGEX_INDEX = " (cannot open regex index)";
158         MSG_CANNOT_OPEN_PHRASE_INDEX = " (cannot open phrase index)";
159         MSG_INDEXDIR_ERROR =
160             "To Administrator:\nCheck the definition of INDEXDIR.\n";
161         MSG_REFERENCE_HEADER = "Word count: ";
162         MSG_INVALID_DB_NAME = "Invalid dbname.";
163     }
164     strcpy(HEADERFILE, "NMZ.head.");
165     strcpy(FOOTERFILE, "NMZ.foot.");
166     strcpy(BODYMSGFILE, "NMZ.body.");
167     strcat(HEADERFILE, Lang);
168     strcat(FOOTERFILE, Lang);
169     strcat(BODYMSGFILE, Lang);
170 }
171 
172 
173 
174