1 /*
2  *
3  * values.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 "namazu.h"
29 
30 /* default directory of where indices are */
31 #ifdef INDEXDIR
32 uchar DEFAULT_DIR[BUFSIZE] = INDEXDIR;
33 #else
34 uchar DEFAULT_DIR[BUFSIZE] = "/home/ccsatoru/NMZ";
35 #endif
36 
37 /* string of HTML 's <BASE HREF="...">  (namazu.conf) */
38 uchar BASE_URL[BUFSIZE] = "";
39 
40 /* strings which is replacement of search results' URL (namazu.conf) */
41 uchar URL_REPLACE_FROM[REPLACE_MAX][BUFSIZE];
42 uchar URL_REPLACE_TO[REPLACE_MAX][BUFSIZE];
43 int url_no=0;
44 
45 /* namazu.conf */
46 #ifdef OPT_NAMAZU_CONF
47 uchar NAMAZU_CONF[BUFSIZE] = OPT_NAMAZU_CONF;
48 #else
49 uchar NAMAZU_CONF[BUFSIZE] = "/usr/local/namazu/lib/namazu.conf";
50 #endif
51 
52 /* namazurc */
53 uchar NAMAZURC[BUFSIZE] = "";
54 
55 /* files which Namazu uses */
56 uchar FLIST[BUFSIZE] = "NMZ.f";
57 uchar FLISTINDEX[BUFSIZE] = "NMZ.fi";
58 uchar INDEX[BUFSIZE] = "NMZ.i";
59 uchar INDEXINDEX[BUFSIZE] = "NMZ.ii";
60 uchar HASH[BUFSIZE] = "NMZ.h";
61 uchar HEADERFILE[BUFSIZE] = "NMZ.head";
62 uchar FOOTERFILE[BUFSIZE] = "NMZ.foot";
63 uchar LOCKFILE[BUFSIZE] = "NMZ.lock";
64 uchar BODYMSGFILE[BUFSIZE] = "NMZ.body";
65 uchar SLOG[BUFSIZE] = "NMZ.slog";
66 uchar BIGENDIAN[BUFSIZE] = "NMZ.be";
67 uchar LITTLEENDIAN[BUFSIZE] = "NMZ.le";
68 uchar WORDLIST[BUFSIZE] = "NMZ.w";
69 uchar FIELDINFO[BUFSIZE] = "NMZ.field.";  /* followed by field name */
70 uchar DATEINDEX[BUFSIZE] = "NMZ.t";
71 
72 uchar PHRASE[BUFSIZE] = "NMZ.p";
73 uchar PHRASEINDEX[BUFSIZE] = "NMZ.pi";
74 
75 /* too much global variables */
76 int HListMax = 20;		/* max number of search results */
77 int HListWhence = 0;		/* number which beginning of search results */
78 int Debug = 0;			/* if debug mode is on: 1 */
79 int ShortFormat = 0;		/* if no display summary: 1  */
80 int MoreShortFormat = 0;        /* if more short format mode: 1  */
81 int HitCountOnly = 0;
82 int ScoreSort = 1;		/* if sort by score: 1 */
83 int HtmlOutput = 1;		/* if display as HTML: 1 */
84 int HidePageIndex = 0;		/* if hide page index: 1 */
85 int ForcePrintForm = 0;		/* if display <FORM> ... </FORM>: 1 */
86 int AllList = 0;		/* if dispal all search results: 1 */
87 int LaterOrder = 1;		/* if sort by late order: 1 */
88 int ConfLoaded = 0;		/* if whould loaded namazu.conf: 1 */
89 int NoReplace = 0;		/* if no replace URL: 1 */
90 int DecodeURL = 0;		/* if replace URL at plaint text mode: 1 */
91 int IsCGI = 0;			/* if CGI mode: 1 */
92 int Logging = 1;		/* if do logging:  1 */
93 int DbNumber = 0;               /* number of databases */
94 int OppositeEndian = 0;         /* if opposite byte order: 1 */
95 int NoReference = 0;		/* if no display reference: 1  */
96 int ModeTknamazu = 0;		/* if tknamazu mode: 1  */
97 
98 #ifdef SCORING
99 #define TFIDF  1
100 #define SIMPLE 0
101 int TfIdf = SCORING;   /* switch of TfIdf mode */
102 #else
103 int TfIdf = 1;
104 #endif
105 
106 int AllDocumentN = 0;  /* number of all of documents */
107 
108 uchar KeyTable[BUFSIZE];		/* table which saving query */
109 uchar *KeyItem[KEY_ITEM_MAX + 1];	/* pointers of items of query */
110 uchar *DbNames[DB_MAX + 1];   /* name of databases */
111 FILE *Flist, *FlistIndex, *Index, *IndexIndex, *Hash, *Phrase, *PhraseIndex;
112 
113