1 /***             analog 6.0             http://www.analog.cx/             ***/
2 /*** This program is copyright (c) Stephen R. E. Turner 1995 - 2004 except as
3  *** stated otherwise.
4  ***
5  *** This program is free software. You can redistribute it and/or modify it
6  *** under the terms of version 2 of the GNU General Public License, which you
7  *** should have received with it.
8  ***
9  *** This program is distributed in the hope that it will be useful, but
10  *** without any warranty, expressed or implied.   ***/
11 
12 /*** globals.c; declaration and initialisation of globals, and defaults ***/
13 /* See also init.c and init2.c */
14 
15 #include "anlghea3.h"
16 
17 /* Program time */
18 time_t origstarttime, starttime;
19 timecode_t starttimec, starttimeuxc;
20 char *starttimestr;
21 /* NB starttime and starttimec are displaced by TIMEOFFSET in correct(), but
22    starttimestr (used in warnings) and starttimeuxc (used in DNS) are not. */
23 
24 /* What to read from input lines */
25 unsigned int year, month, date, hour, minute, code;
26 unsigned long unixtime, proctime;
27 double bytes;
28 char am;
29 
30 /* Input processing */
31 char *block_start, *block_end, *block_bell, *record_start, *pos;
32 logical termchar[256];
33 
34 /* Memory allocation */
35 Memman *xmemman, *amemman, mm[ITEM_NUMBER], mmq, mms;
36 char *workspace; /* scratch space for aliasing: see note at top of alias.c */
37 /* NB Be careful not to nest two usages of workspace. */
38 
39 /* Are we running from form? */
40 logical cgi = FALSE;
41 
42 /* DNS lookups: externs so that no worries about whether to pass them around */
43 #ifndef NODNS
44 choice dnslevel;
45 char *dnsfile, *dnslockfile;
46 FILE *dnsfilep = NULL, *dnslock = NULL;
47 Hashtable *dnstable;
48 unsigned int dnsgoodhrs, dnsbadhrs;
49 #ifndef NOALARM
50 unsigned int dnstimeout;
51 JMP_BUF jumpbuf;
52 #endif
53 #endif
54 
55 /* Signal entries for unwanted hash entries (NULL is already used for unset) */
56 Hashentry *unwanted_entry, *blank_entry;
57 Hashindex *dummy_item;
58 
59 /* Translating reports to other arrays */
60 choice *rep2type, *rep2reqs, *rep2reqs7, *rep2date, *rep2firstd;
61 unsigned int *rep2gran, *rep2lng, *rep2datefmt, *rep2colhead, *rep2busystr;
62 unsigned int *col2colhead, *method2sing, *method2pl, *method2date;
63 unsigned int *method2pc, *method2relpc, *method2sort;
64 logical *repistree;
65 char *byteprefix = " kMGTPEZY";  /* Room for growth :)  Note initial space */
66 /* NB Output versions of the byte prefixes are in the language files */
67 
68 /* Domain levels; making this global is messy but easiest */
69 Strpairlist **domlevels;
70 
71 /* Log formats */
72 Inputformatlist *logformat = NULL, *deflogformat;
73 logical newloglist = TRUE, iscache = FALSE;
74 int tz = 0, stz = 0;
75 choice wantitem[INPUT_NUMBER];
76 #ifndef NOPIPES
77 Strpairlist *uncompresshead = NULL;
78 #endif
79 
80 /* Debugging, warnings, pretty printing */
81 FILE *errfile;
82 char *commandname = NULL, *commandpath = NULL;
83 char *debug_args = NULL, *warn_args = NULL;
84 logical anywarns = FALSE, errmess = FALSE, vblesonly = FALSE;
85 unsigned int errwidth = ERRLINELENGTH;
86 unsigned long progressfreq = 0;
87 unsigned int ppcol = 0;
88 
89 /* What's recorded by cache files. Array size V5_DATA_NUMBER in anlghea3.h. */
90 /* don't record "last 7" stuff because it won't be correct at read time */
91 choice cache_records[V5_DATA_NUMBER] = {REQUESTS, PAGES, REDIR, FAIL, SUCCDATE,
92 					REDIRDATE, FAILDATE, SUCCFIRSTD,
93 					REDIRFIRSTD, FAILFIRSTD};
94 
95 /* Date names for unlocalised text. See also ENGMONTHLEN etc. in anlghea3.h. */
96 char *engmonths[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
97 		       "Sep", "Oct", "Nov", "Dec"};
98 char *englongdays[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
99 			"Friday", "Saturday"};
100 char *engshortdays[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
101 
102 /* Names for things, always in order of enums in anlghea3.h */
103 char *item_type[] = {"virtual hosts", "files", "users", "referrers",
104 		     "browsers", "hosts"};
105 /* In methodname, we don't need them all, because some only occur internally */
106 char *methodname[] = {"requests","7-day requests", "pages", "7-day pages", "",
107 		      "", "", "", "last date", "", "", "first date", "", "",
108 		      "bytes", "7-day bytes", "alphabetical", "random"};
109 /* Filenames for each language, in order of enum in anlghea3.h */
110 char *country[] = {"am", "baq", /*"ba",*/ "bg", "bgm", "cat", "cn", "tw",
111 		   /*"hr",*/ "cz", "cz1", "dk", "nl", "uk", "us", "fi", "fr",
112 		   "de", /*"gr",*/ "hu", /*"is",*/ "id", "it", "jpe", "jpj",
113 		   "jps", "jpu", "kr", "lv", /*"lt",*/ "no", "no2", "pl", "pt",
114 		   "br", /*"ro",*/ "ru", "ru1", "yu", "sk", "sk1", "si", "si1",
115 		   "es", "se", "se2", "tr", "ua"};
116 /* Report code letters in order of enum in anlghea3.h */
117 /* Any new ones must also be added to reportorder in anlghea2.h */
118 char repcodes[] = "1QmWDH45dhw67xrEItiSlLofskKBvRMujJZNnYybpzcP";
119 
120 /* Column code letters in order of enum in anlghea3.h */
121 char colcodes[] = "xRSPQBCrspqbcdDeEN";
122 
123 /* Names for the anchors within the report, in the same order */
124 /* At most eight letters, because we use them as filenames too. (This limit is
125    assumed in piechart()). */
126 char *anchorname[] = {"year", "quartly", "month", "week", "dayrep", "hourrep",
127 		      "quartrep", "fiverep",  "daysum", "hoursum", "weekhour",
128 		      "quartsum", "fivesum", "gensum", "req", "redir", "fail",
129 		      "type", "dir", "host", "redihost", "failhost", "dom",
130 		      "ref", "refsite", "redirref", "failref", "browrep",
131 		      "vhost", "redirvh", "failvh", "user", "rediuser",
132 		      "failuser", "org", "searchq", "searchw", "isearchq",
133 		      "isearchw", "browsum", "os", "size", "code", "proctime"};
134 /* These report names are in English, so not the same as in langfile */
135 /* Again in order of enum in anlghea3.h */
136 char *repname[] = {"Yearly Report", "Quarterly Report", "Monthly Report",
137 		   "Weekly Report", "Daily Report", "Hourly Report",
138 		   "Quarter-Hour Report", "Five-Minute Report",
139 		   "Daily Summary", "Hourly Summary",
140 		   "Hour of the Week Summary", "Quarter-Hour Summary",
141 		   "Five-Minute Summary", "General Summary", "Request Report",
142 		   "Redirection Report", "Failure Report", "File Type Report",
143 		   "Directory Report", "Host Report",
144 		   "Host Redirection Report", "Host Failure Report",
145 		   "Domain Report", "Referrer Report", "Referring Site Report",
146 		   "Redirected Referrer Report", "Failed Referrer Report",
147 		   "Browser Report", "Virtual Host Report",
148 		   "Virtual Host Redirection Report",
149 		   "Virtual Host Failure Report", "User Report",
150 		   "User Redirection Report", "User Failure Report",
151 		   "Organisation Report", "Search Query Report",
152 		   "Search Word Report", "Internal Search Query Report",
153 		   "Internal Search Word Report", "Browser Summary",
154 		   "Operating System Report", "File Size Report",
155 		   "Status Code Report", "Processing Time Report"};
156 
157 #ifdef EBCDIC
158 /* EBCDIC-to-ASCII tables:
159   These tables are bijective - there are no ambigous or duplicate characters.
160  */
161 const unsigned char os_toascii[256] = {
162 #ifdef _OSD_POSIX /* Fujitsu-Siemens' EDF04 character set on BS2000: */
163 /*00*/  0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
164         0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
165 /*10*/  0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
166         0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
167 /*20*/  0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
168         0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
169 /*30*/  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
170         0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
171 /*40*/  0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
172         0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
173 /*50*/  0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
174         0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
175 /*60*/  0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
176         0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
177 /*70*/  0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
178         0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
179 /*80*/  0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
180         0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
181 /*90*/  0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
182         0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
183 /*a0*/  0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
184         0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
185 /*b0*/  0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
186         0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
187 /*c0*/  0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
188         0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
189 /*d0*/  0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
190         0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
191 /*e0*/  0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
192         0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
193 /*f0*/  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
194         0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e  /*0123456789.{.}.~*/
195 
196 #elif defined(OS390) || defined(AS400) || defined(TPF)  /* IBM's OS/390 and TPF systems: */
197 /*
198 Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
199 */
200     0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f:           */
201     0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
202     0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f:           */
203     0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
204     0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f:           */
205     0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
206     0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f:           */
207     0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
208     0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f:           */
209     0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /*  ...........<(+| */
210     0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f:           */
211     0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
212     0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f:           */
213     0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
214     0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f:           */
215     0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
216     0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f:           */
217     0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
218     0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f:           */
219     0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
220     0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af:           */
221     0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
222     0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf:           */
223     0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
224     0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf:           */
225     0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
226     0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df:           */
227     0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
228     0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef:           */
229     0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
230     0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff:           */
231     0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f  /* 0123456789...... */
232 #else
233 #error Unimplemented EBCDIC platform. Please send information about your system to <martin@apache.org>!
234 #endif
235 };
236 /* Bijective ascii-to-ebcdic table: */
237 const unsigned char os_toebcdic[256] = {
238 #ifdef _OSD_POSIX /* Fujitsu-Siemens' EDF04 character set on BS2000: */
239 /*00*/  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
240         0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,  /*................*/
241 /*10*/  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
242         0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,  /*................*/
243 /*20*/  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
244         0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,  /* !"#$%&'()*+,-./ */
245 /*30*/  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
246         0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,  /*0123456789:;<=>?*/
247 /*40*/  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
248         0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,  /*@ABCDEFGHIJKLMNO*/
249 /*50*/  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
250         0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d,  /*PQRSTUVWXYZ[\]^_*/
251 /*60*/  0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
252         0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,  /*`abcdefghijklmno*/
253 /*70*/  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
254         0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07,  /*pqrstuvwxyz{|}~.*/
255 /*80*/  0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
256         0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14,  /*................*/
257 /*90*/  0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
258         0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f,  /*................*/
259 /*a0*/  0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
260         0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1,  /*................*/
261 /*b0*/  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
262         0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,  /*................*/
263 /*c0*/  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
264         0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,  /*................*/
265 /*d0*/  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
266         0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59,  /*................*/
267 /*e0*/  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
268         0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,  /*................*/
269 /*f0*/  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
270         0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf   /*................*/
271 #elif defined(OS390) || defined(AS400) || defined(TPF)  /* IBM's OS/390 and TPF systems: */
272 /*
273 The US-ASCII to EBCDIC (character set IBM-1047) table:
274 This table is bijective (no ambiguous or duplicate characters)
275 */
276     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f:           */
277     0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
278     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f:           */
279     0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
280     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f:           */
281     0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /*  !"#$%&'()*+,-./ */
282     0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f:           */
283     0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
284     0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f:           */
285     0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
286     0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f:           */
287     0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
288     0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f:           */
289     0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
290     0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f:           */
291     0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
292     0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f:           */
293     0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
294     0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f:           */
295     0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
296     0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af:           */
297     0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
298     0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf:           */
299     0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
300     0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf:           */
301     0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
302     0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df:           */
303     0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
304     0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef:           */
305     0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
306     0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff:           */
307     0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf  /* ................ */
308 #else
309 #error Unimplemented EBCDIC platform. Please send information about your system to <martin@apache.org>!
310 #endif
311 };
312 #endif
313 
314 logical convertchar[256] = {
315   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* 00 - 0F */
316   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* 10 - 1F */
317   1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,   /* 20 - 2F */
318   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0,   /* 30 - 3F */
319   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   /* 40 - 4F */
320   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   /* 50 - 5F */
321   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,   /* 60 - 6F */
322   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,   /* 70 - 7F */
323   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* 80 - 8F */
324   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* 90 - 9F */
325   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* A0 - AF */
326   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* B0 - BF */
327   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* C0 - CF */
328   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* D0 - DF */
329   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   /* E0 - EF */
330   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};  /* F0 - FF */
331 /* %nm escapes to convert in do_alias(r|f). We convert all ASCII printable
332    characters (0x20 - 0x7E) with the exception of % (0x25) [to distinguish
333    %25ab from %ab]; and ? (0x3f), & (0x26), ; (0x3b) and = (0x3d) [to split
334    query strings up correctly]. Could argue for + (0x2b) in query strings, but
335    messes search reports up if we do this. */
336 
337 logical unprintable[256];
338 /* Unprintable chars for the reports. This is charset dependent. But NB not the
339    same as isctrl() or !isprint() even for ASCII range. */
340 
341 /* The outputters */
342 Outputter cro_outputter =
343   {cro_pagewidth, cro_cgihead, cro_stylehead, cro_pagetitle, cro_timings,
344    cro_closehead, cro_pagebotstart, cro_credit, cro_runtime, cro_pagefoot,
345    cro_stylefoot, cro_reporttitle, cro_reportfooter, cro_reportdesc,
346    cro_reportspan, cro_gensumhead, cro_gensumfoot, cro_gensumline,
347    cro_gensumlineb, cro_lastseven, cro_prestart, cro_preend, cro_hrule,
348    cro_endash, cro_putch, cro_strlength, cro_allowmonth, cro_calcwidths,
349    cro_declareunit, cro_colheadstart, cro_colheadcol, cro_colheadend,
350    cro_colheadustart, cro_colheadunderline, cro_colheaduend, cro_rowstart,
351    cro_levelcell, cro_namecell, cro_ulcell, cro_strcell, cro_bytescell,
352    cro_pccell, cro_indexcell, cro_rowend, cro_blankline, cro_barchart,
353    cro_busyprintf, cro_notlistedstr, cro_whatincluded, NULL, NULL, NULL, NULL,
354    cro_includefile, cro_riscosfiletype};
355 Outputter html_outputter =
356   {html_pagewidth, html_cgihead, html_stylehead, html_pagetitle, html_timings,
357    html_closehead, html_pagebotstart, html_credit, html_runtime, html_pagefoot,
358    html_stylefoot, html_reporttitle, html_reportfooter, html_reportdesc,
359    html_reportspan, html_gensumhead, html_gensumfoot, html_gensumline,
360    html_gensumlineb, html_lastseven, html_prestart, html_preend, html_hrule,
361    html_endash, html_putch, html_strlength, html_allowmonth, html_calcwidths,
362    html_declareunit, html_colheadstart, html_colheadcol, html_colheadend,
363    html_colheadustart, html_colheadunderline, html_colheaduend, html_rowstart,
364    html_levelcell, html_namecell, html_ulcell, html_strcell, html_bytescell,
365    html_pccell, html_indexcell, html_rowend, html_blankline, html_barchart,
366    html_busyprintf, html_notlistedstr, html_whatincluded, html_whatinchead,
367    html_whatincfoot, html_whatincprintstr, html_printdouble, html_includefile,
368    html_riscosfiletype};
369 Outputter latex_outputter =
370   {latex_pagewidth, latex_cgihead, latex_stylehead, latex_pagetitle,
371    latex_timings, latex_closehead, latex_pagebotstart, latex_credit,
372    latex_runtime, latex_pagefoot, latex_stylefoot, latex_reporttitle,
373    latex_reportfooter, latex_reportdesc, latex_reportspan, latex_gensumhead,
374    latex_gensumfoot, latex_gensumline, latex_gensumlineb, latex_lastseven,
375    latex_prestart, latex_preend, latex_hrule, latex_endash, latex_putch,
376    latex_strlength, latex_allowmonth, latex_calcwidths, latex_declareunit,
377    latex_colheadstart, latex_colheadcol, latex_colheadend, latex_colheadustart,
378    latex_colheadunderline, latex_colheaduend, latex_rowstart, latex_levelcell,
379    latex_namecell, latex_ulcell, latex_strcell, latex_bytescell, latex_pccell,
380    latex_indexcell, latex_rowend, latex_blankline, latex_barchart,
381    latex_busyprintf, latex_notlistedstr, latex_whatincluded, latex_whatinchead,
382    latex_whatincfoot, latex_whatincprintstr, latex_printdouble,
383    latex_includefile, latex_riscosfiletype};
384 Outputter plain_outputter =
385   {plain_pagewidth, plain_cgihead, plain_stylehead, plain_pagetitle,
386    plain_timings, plain_closehead, plain_pagebotstart, plain_credit,
387    plain_runtime, plain_pagefoot, plain_stylefoot, plain_reporttitle,
388    plain_reportfooter, plain_reportdesc, plain_reportspan, plain_gensumhead,
389    plain_gensumfoot, plain_gensumline, plain_gensumlineb, plain_lastseven,
390    plain_prestart, plain_preend, plain_hrule, plain_endash, plain_putch,
391    plain_strlength, plain_allowmonth, plain_calcwidths, plain_declareunit,
392    plain_colheadstart, plain_colheadcol, plain_colheadend, plain_colheadustart,
393    plain_colheadunderline, plain_colheaduend, plain_rowstart, plain_levelcell,
394    plain_namecell, plain_ulcell, plain_strcell, plain_bytescell, plain_pccell,
395    plain_indexcell, plain_rowend, plain_blankline, plain_barchart,
396    plain_busyprintf, plain_notlistedstr, plain_whatincluded, plain_whatinchead,
397    plain_whatincfoot, plain_whatincprintstr, plain_printdouble,
398    plain_includefile, plain_riscosfiletype};
399 Outputter xhtml_outputter =
400   {xhtml_pagewidth, xhtml_cgihead, xhtml_stylehead, xhtml_pagetitle,
401    xhtml_timings, xhtml_closehead, xhtml_pagebotstart, xhtml_credit,
402    xhtml_runtime, xhtml_pagefoot, xhtml_stylefoot, xhtml_reporttitle,
403    xhtml_reportfooter, xhtml_reportdesc, xhtml_reportspan, xhtml_gensumhead,
404    xhtml_gensumfoot, xhtml_gensumline, xhtml_gensumlineb, xhtml_lastseven,
405    xhtml_prestart, xhtml_preend, xhtml_hrule, xhtml_endash, xhtml_putch,
406    xhtml_strlength, xhtml_allowmonth, xhtml_calcwidths, xhtml_declareunit,
407    xhtml_colheadstart, xhtml_colheadcol, xhtml_colheadend, xhtml_colheadustart,
408    xhtml_colheadunderline, xhtml_colheaduend, xhtml_rowstart, xhtml_levelcell,
409    xhtml_namecell, xhtml_ulcell, xhtml_strcell, xhtml_bytescell, xhtml_pccell,
410    xhtml_indexcell, xhtml_rowend, xhtml_blankline, xhtml_barchart,
411    xhtml_busyprintf, xhtml_notlistedstr, xhtml_whatincluded, xhtml_whatinchead,
412    xhtml_whatincfoot, xhtml_whatincprintstr, xhtml_printdouble,
413    xhtml_includefile, xhtml_riscosfiletype};
414 Outputter xml_outputter =
415   {xml_pagewidth, xml_cgihead, xml_stylehead, xml_pagetitle, xml_timings,
416    xml_closehead, xml_pagebotstart, xml_credit, xml_runtime, xml_pagefoot,
417    xml_stylefoot, xml_reporttitle, xml_reportfooter, xml_reportdesc,
418    xml_reportspan, xml_gensumhead, xml_gensumfoot, xml_gensumline,
419    xml_gensumlineb, xml_lastseven, xml_prestart, xml_preend, xml_hrule,
420    xml_endash, xml_putch, xml_strlength, xml_allowmonth, xml_calcwidths,
421    xml_declareunit, xml_colheadstart, xml_colheadcol, xml_colheadend,
422    xml_colheadustart, xml_colheadunderline, xml_colheaduend, xml_rowstart,
423    xml_levelcell, xml_namecell, xml_ulcell, xml_strcell, xml_bytescell,
424    xml_pccell, xml_indexcell, xml_rowend, xml_blankline, xml_barchart,
425    xml_busyprintf, xml_notlistedstr, xml_whatincluded, xml_whatinchead,
426    xml_whatincfoot, xml_whatincprintstr, xml_printdouble, xml_includefile,
427    xml_riscosfiletype};
428 
429 Inputfns inpfns[] = { /* first the ITEM fns in any order */
430   /* See also ITEMFNS_NUMBER in anlghea3.c */
431   /* Also, some letters, namely those with &parsestring and other codes that
432      take following separators (see list in strtoinfmt() in init.c), need to be
433      included in the list in report_logfmt() in settings.c. */
434   {'v', ITEM_VHOST, &parsestring, &mm[ITEM_VHOST]},
435   {'r', ITEM_FILE, &parsestring, &mm[ITEM_FILE]},
436   {'u', ITEM_USER, &parsestring, &mm[ITEM_USER]},
437   {'f', ITEM_REFERRER, &parsestring, &mm[ITEM_REFERRER]},
438   {'B', ITEM_BROWSER, &parsestring, &mm[ITEM_BROWSER]},
439   {'S', ITEM_HOST, &parsestring, &mm[ITEM_HOST]},
440   {'F', ITEM_REFERRER, &parseref, &mm[ITEM_REFERRER]},
441   {'A', ITEM_BROWSER, &parsemsbrow, &mm[ITEM_BROWSER]},
442   {'q', INP_QUERY, &parsestring, &mmq},
443   {'s', INP_IP, &parsestring, &mms},
444   {'n', INP_MIN, &parseuint2strict, (void *)&minute},
445   {'h', INP_HOUR, &parseuint2, (void *)&hour},
446   {'a', INP_AM, &parseam, (void *)&am},
447   {'d', INP_DATE, &parseuint2, (void *)&date},
448   {'m', INP_MONTH, &parsenmonth, (void *)&month},
449   {'M', INP_MONTH, &parsemonth, (void *)&month},
450   {'y', INP_YEAR, &parseyear2, (void *)&year},
451   {'Y', INP_YEAR, &parseuint4strict, (void *)&year},
452   {'Z', INP_YEAR, &parseyear2or4, (void *)&year},
453   {'U', INP_UNIXTIME, &parseunixtime, (void *)&unixtime},
454   {'T', INP_PROCTIME, &parseunixtime, (void *)&proctime},
455   {'t', INP_PROCTIME, &parseproctime, (void *)&proctime},
456   {'D', INP_PROCTIME, &parseproctimeu, (void *)&proctime},
457   {'c', INP_CODE, &parsescode, (void *)&code},
458   {'C', INP_CODE, &parsecode, (void *)&code},
459   {'b', INP_BYTES, &parseudint, (void *)&bytes},
460   {'w', UNSET, &parsespace, NULL},
461   {'W', UNSET, &parseoptspace, NULL},
462   {'j', UNSET, &parsejunk, NULL},
463   {'x', UNSET, &parselogfmt, NULL},
464   {'\0', UNSET, &checkchar, NULL}  /* this one must be last as marker */
465 };
466 Inputfns pnlinpfn = {'\n', UNSET, &parsenewline, NULL};
467 Inputfns ccinpfn = {'\0', UNSET, &checkchar, NULL};
468 Inputfns pjinpfn = {'j', UNSET, &parsejunk, NULL};
469 
470 Options opts;
471 /* So that in future we can have several sets of options, and yet still
472    declare cf[] neatly as below, we shunt them in and out of opts */
473 Configfns cf[] = {
474   {"TIMECOLS", &configallcols, (void *)(opts.outopts.cols)},
475   {"YEARCOLS", &configcols, (void *)(opts.outopts.cols[REP_YEAR])},
476   {"QUARTERLYCOLS", &configcols, (void *)(opts.outopts.cols[REP_QUARTERLY])},
477   {"MONTHCOLS", &configcols, (void *)(opts.outopts.cols[REP_MONTH])},
478   {"WEEKCOLS", &configcols, (void *)(opts.outopts.cols[REP_WEEK])},
479   {"DAYREPCOLS", &configcols, (void *)(opts.outopts.cols[REP_DAYREP])},
480   {"FULLDAYCOLS", &configcols, (void *)(opts.outopts.cols[REP_DAYREP])},
481   {"DAYSUMCOLS", &configcols, (void *)(opts.outopts.cols[REP_DAYSUM])},
482   {"DAYCOLS", &configcols, (void *)(opts.outopts.cols[REP_DAYSUM])},
483   {"HOURREPCOLS", &configcols, (void *)(opts.outopts.cols[REP_HOURREP])},
484   {"FULLHOURCOLS", &configcols, (void *)(opts.outopts.cols[REP_HOURREP])},
485   {"HOURSUMCOLS", &configcols, (void *)(opts.outopts.cols[REP_HOURSUM])},
486   {"HOURCOLS", &configcols, (void *)(opts.outopts.cols[REP_HOURSUM])},
487   {"WEEKHOURCOLS", &configcols,
488    (void *)(opts.outopts.cols[REP_WEEKHOUR])},
489   {"QUARTERREPCOLS", &configcols, (void *)(opts.outopts.cols[REP_QUARTERREP])},
490   {"QUARTERCOLS", &configcols, (void *)(opts.outopts.cols[REP_QUARTERREP])},
491   {"QUARTERSUMCOLS", &configcols, (void *)(opts.outopts.cols[REP_QUARTERSUM])},
492   {"FIVEREPCOLS", &configcols, (void *)(opts.outopts.cols[REP_FIVEREP])},
493   {"FIVECOLS", &configcols, (void *)(opts.outopts.cols[REP_FIVEREP])},
494   {"FIVESUMCOLS", &configcols, (void *)(opts.outopts.cols[REP_FIVESUM])},
495   {"REQCOLS", &configcols, (void *)(opts.outopts.cols[REP_REQ])},
496   {"REDIRCOLS", &configcols, (void *)(opts.outopts.cols[REP_REDIR])},
497   {"FAILCOLS", &configcols, (void *)(opts.outopts.cols[REP_FAIL])},
498   {"TYPECOLS", &configcols, (void *)(opts.outopts.cols[REP_TYPE])},
499   {"SIZECOLS", &configcols, (void *)(opts.outopts.cols[REP_SIZE])},
500   {"PROCTIMECOLS", &configcols, (void *)(opts.outopts.cols[REP_PROCTIME])},
501   {"DIRCOLS", &configcols, (void *)(opts.outopts.cols[REP_DIR])},
502   {"HOSTCOLS", &configcols, (void *)(opts.outopts.cols[REP_HOST])},
503   {"REDIRHOSTCOLS", &configcols, (void *)(opts.outopts.cols[REP_REDIRHOST])},
504   {"FAILHOSTCOLS", &configcols, (void *)(opts.outopts.cols[REP_FAILHOST])},
505   {"DOMCOLS", &configcols, (void *)(opts.outopts.cols[REP_DOM])},
506   {"ORGCOLS", &configcols, (void *)(opts.outopts.cols[REP_ORG])},
507   {"REFCOLS", &configcols, (void *)(opts.outopts.cols[REP_REF])},
508   {"REFSITECOLS", &configcols, (void *)(opts.outopts.cols[REP_REFSITE])},
509   {"REDIRREFCOLS", &configcols, (void *)(opts.outopts.cols[REP_REDIRREF])},
510   {"FAILREFCOLS", &configcols, (void *)(opts.outopts.cols[REP_FAILREF])},
511   {"BROWREPCOLS", &configcols, (void *)(opts.outopts.cols[REP_BROWREP])},
512   {"FULLBROWCOLS", &configcols, (void *)(opts.outopts.cols[REP_BROWREP])},
513   {"BROWSUMCOLS", &configcols, (void *)(opts.outopts.cols[REP_BROWSUM])},
514   {"BROWCOLS", &configcols, (void *)(opts.outopts.cols[REP_BROWSUM])},
515   {"OSCOLS", &configcols, (void *)(opts.outopts.cols[REP_OS])},
516   {"VHOSTCOLS", &configcols, (void *)(opts.outopts.cols[REP_VHOST])},
517   {"REDIRVHOSTCOLS", &configcols, (void *)(opts.outopts.cols[REP_REDIRVHOST])},
518   {"FAILVHOSTCOLS", &configcols, (void *)(opts.outopts.cols[REP_FAILVHOST])},
519   {"USERCOLS", &configcols, (void *)(opts.outopts.cols[REP_USER])},
520   {"REDIRUSERCOLS", &configcols, (void *)(opts.outopts.cols[REP_REDIRUSER])},
521   {"FAILUSERCOLS", &configcols, (void *)(opts.outopts.cols[REP_FAILUSER])},
522   {"SEARCHQUERYCOLS", &configcols, (void *)(opts.outopts.cols[REP_SEARCHREP])},
523   {"SEARCHWORDCOLS", &configcols, (void *)(opts.outopts.cols[REP_SEARCHSUM])},
524   {"INTSEARCHQUERYCOLS", &configcols,
525    (void *)(opts.outopts.cols[REP_INTSEARCHREP])},
526   {"INTSEARCHWORDCOLS", &configcols,
527    (void *)(opts.outopts.cols[REP_INTSEARCHSUM])},
528   {"STATUSCOLS", &configcols, (void *)(opts.outopts.cols[REP_CODE])},
529   {"YEARGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_YEAR])},
530   {"QUARTERLYGRAPH", &configgraph,
531    (void *)&(opts.outopts.graph[REP_QUARTERLY])},
532   {"MONTHGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_MONTH])},
533   {"WEEKGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_WEEK])},
534   {"DAYREPGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_DAYREP])},
535   {"FULLDAYGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_DAYREP])},
536   {"DAYSUMGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_DAYSUM])},
537   {"DAYGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_DAYSUM])},
538   {"HOURREPGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_HOURREP])},
539   {"FULLHOURGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_HOURREP])},
540   {"HOURSUMGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_HOURSUM])},
541   {"HOURGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_HOURSUM])},
542   {"WEEKHOURGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_WEEKHOUR])},
543   {"QUARTERREPGRAPH", &configgraph,
544    (void *)&(opts.outopts.graph[REP_QUARTERREP])},
545   {"QUARTERGRAPH", &configgraph,
546    (void *)&(opts.outopts.graph[REP_QUARTERREP])},
547   {"QUARTERSUMGRAPH", &configgraph,
548    (void *)&(opts.outopts.graph[REP_QUARTERSUM])},
549   {"FIVEREPGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_FIVEREP])},
550   {"FIVEGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_FIVEREP])},
551   {"FIVESUMGRAPH", &configgraph, (void *)&(opts.outopts.graph[REP_FIVESUM])},
552   {"ALLGRAPH", &configallgraph, (void *)(opts.outopts.graph)},
553   {"ALLGRAPHS", &configallgraph, (void *)(opts.outopts.graph)},
554 #ifndef NOGRAPHICS
555   {"REQCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_REQ)])},
556   {"REDIRCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_REDIR)])},
557   {"FAILCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_FAIL)])},
558   {"TYPECHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_TYPE)])},
559   {"SIZECHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_SIZE)])},
560   {"PROCTIMECHART", &configchoice,
561    (void *)&(opts.outopts.chartby[G(REP_PROCTIME)])},
562   {"DIRCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_DIR)])},
563   {"HOSTCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_HOST)])},
564   {"REDIRHOSTCHART", &configchoice,
565    (void *)&(opts.outopts.chartby[G(REP_REDIRHOST)])},
566   {"FAILHOSTCHART", &configchoice,
567    (void *)&(opts.outopts.chartby[G(REP_FAILHOST)])},
568   {"DOMCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_DOM)])},
569   {"ORGCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_ORG)])},
570   {"REFCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_REF)])},
571   {"REFSITECHART", &configchoice,
572    (void *)&(opts.outopts.chartby[G(REP_REFSITE)])},
573   {"REDIRREFCHART", &configchoice,
574    (void *)&(opts.outopts.chartby[G(REP_REDIRREF)])},
575   {"FAILREFCHART", &configchoice,
576    (void *)&(opts.outopts.chartby[G(REP_FAILREF)])},
577   {"BROWREPCHART", &configchoice,
578    (void *)&(opts.outopts.chartby[G(REP_BROWREP)])},
579   {"BROWSUMCHART", &configchoice,
580    (void *)&(opts.outopts.chartby[G(REP_BROWSUM)])},
581   {"OSCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_OS)])},
582   {"VHOSTCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_VHOST)])},
583   {"REDIRVHOSTCHART", &configchoice,
584    (void *)&(opts.outopts.chartby[G(REP_REDIRVHOST)])},
585   {"FAILVHOSTCHART", &configchoice,
586    (void *)&(opts.outopts.chartby[G(REP_FAILVHOST)])},
587   {"USERCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_USER)])},
588   {"REDIRUSERCHART", &configchoice,
589    (void *)&(opts.outopts.chartby[G(REP_REDIRUSER)])},
590   {"FAILUSERCHART", &configchoice,
591    (void *)&(opts.outopts.chartby[G(REP_FAILUSER)])},
592   {"SEARCHQUERYCHART", &configchoice,
593    (void *)&(opts.outopts.chartby[G(REP_SEARCHREP)])},
594   {"SEARCHWORDCHART", &configchoice,
595    (void *)&(opts.outopts.chartby[G(REP_SEARCHSUM)])},
596   {"INTSEARCHQUERYCHART", &configchoice,
597    (void *)&(opts.outopts.chartby[G(REP_INTSEARCHREP)])},
598   {"INTSEARCHWORDCHART", &configchoice,
599    (void *)&(opts.outopts.chartby[G(REP_INTSEARCHSUM)])},
600   {"STATUSCHART", &configchoice, (void *)&(opts.outopts.chartby[G(REP_CODE)])},
601   {"ALLCHART", &configallchart, (void *)(opts.outopts.chartby)},
602   {"ALLCHARTS", &configallchart, (void *)(opts.outopts.chartby)},
603   {"REQCHARTEXPAND", &configstrlist,
604    (void *)&(opts.outopts.expandhead[G(REP_REQ)])},
605   {"REDIRCHARTEXPAND", &configstrlist,
606    (void *)&(opts.outopts.expandhead[G(REP_REDIR)])},
607   {"FAILCHARTEXPAND", &configstrlist,
608    (void *)&(opts.outopts.expandhead[G(REP_FAIL)])},
609   {"TYPECHARTEXPAND", &configstrlist,
610    (void *)&(opts.outopts.expandhead[G(REP_TYPE)])},
611   {"DIRCHARTEXPAND", &configstrlist,
612    (void *)&(opts.outopts.expandhead[G(REP_DIR)])},
613   {"DOMCHARTEXPAND", &configstrlist,  /* NB special case in configstrlist */
614    (void *)&(opts.outopts.expandhead[G(REP_DOM)])},
615   {"ORGCHARTEXPAND", &configstrlist,
616    (void *)&(opts.outopts.expandhead[G(REP_ORG)])},
617   {"REFCHARTEXPAND", &configstrlist,
618    (void *)&(opts.outopts.expandhead[G(REP_REF)])},
619   {"REFSITECHARTEXPAND", &configstrlist,
620    (void *)&(opts.outopts.expandhead[G(REP_REFSITE)])},
621   {"REDIRREFCHARTEXPAND", &configstrlist,
622    (void *)&(opts.outopts.expandhead[G(REP_REDIRREF)])},
623   {"FAILREFCHARTEXPAND", &configstrlist,
624    (void *)&(opts.outopts.expandhead[G(REP_FAILREF)])},
625   {"BROWSUMCHARTEXPAND", &configstrlist,
626    (void *)&(opts.outopts.expandhead[G(REP_BROWSUM)])},
627   {"BROWCHARTEXPAND", &configstrlist,
628    (void *)&(opts.outopts.expandhead[G(REP_BROWSUM)])},
629   {"OSCHARTEXPAND", &configstrlist,
630    (void *)&(opts.outopts.expandhead[G(REP_OS)])},
631   {"CHARTDIR", &configstr, (void *)&(opts.outopts.chartdir)},
632   {"LOCALCHARTDIR", &configstr, (void *)&(opts.outopts.localchartdir)},
633 #ifdef HAVE_GD
634   {"JPEGCHARTS", &configchoice, (void *)&(opts.outopts.jpegcharts)},
635 #endif
636 #endif  /* NOGRAPHICS */
637   {"PNGIMAGES", &configchoice, (void *)&(opts.outopts.pngimages)},
638   {"BARSTYLE", &configbarstyle, (void *)&(opts.outopts.barstyle)},
639   {"COMPSEP", &configstr, (void *)&(opts.outopts.compsep)},
640   {"PRESEP", &configstr, (void *)&(opts.outopts.compsep)},
641   {"HOSTNAME", &configstr, (void *)&(opts.outopts.hostname)},
642   {"HOSTURL", &configstr, (void *)&(opts.outopts.hosturl)},
643   {"LOGO", &configstr, (void *)&(opts.outopts.logo)},
644   {"LOGOURL", &configstr, (void *)&(opts.outopts.logourl)},
645   {"STYLESHEET", &configstr, (void *)&(opts.outopts.stylesheet)},
646   {"CSSPREFIX", &configstr, (void *)&(opts.outopts.cssprefix)},
647   {"BASEURL", &configstr, (void *)&(opts.outopts.baseurl)},
648   {"LOGFORMAT", &configlogfmt, (void *)&logformat},
649   {"DEFAULTLOGFORMAT", &configlogfmt, (void *)&deflogformat},
650   {"APACHELOGFORMAT", &configapachelogfmt, (void *)&logformat},
651   {"APACHEDEFAULTLOGFORMAT", &configapachelogfmt, (void *)&deflogformat},
652   {"TIMEOFFSET", &configoffset, (void *)&stz},
653   {"LOGTIMEOFFSET", &configoffset, (void *)&tz},
654   {"LOGFILE", &configlogfile, (void *)(opts.miscopts.logfile)},
655   {"CACHEFILE", &configcachefile, (void *)(opts.miscopts.logfile)},
656   {"IMAGEDIR", &configstr, (void *)&(opts.outopts.imagedir)},
657   {"HEADERFILE", &configstr, (void *)&(opts.outopts.headerfile)},
658   {"FOOTERFILE", &configstr, (void *)&(opts.outopts.footerfile)},
659   {"LANGUAGE", &configlang, (void *)&(opts.outopts.lang)},
660   {"LANGFILE", &configstr, (void *)&(opts.outopts.lang.file)},
661   {"OUTFILE", &configoutfile, (void *)&(opts.outopts.outfile)},
662   {"CACHEOUTFILE", &configstr, (void *)&(opts.outopts.cacheoutfile)},
663   {"ERRFILE", &configerrfile, (void *)&errfile},
664   {"DOMAINSFILE", &configstr, (void *)&(opts.outopts.domainsfile)},
665   {"DESCFILE", &configstr, (void *)&(opts.outopts.descfile)},
666   {"DIRSUFFIX", &configstr, (void *)&(opts.miscopts.dirsuffix)},
667   {"SEPCHAR", &configchar, (void *)&(opts.outopts.sepchar)},
668   {"REPSEPCHAR", &configchar, (void *)&(opts.outopts.repsepchar)},
669   {"DECPOINT", &configchar, (void *)&(opts.outopts.decpt)},
670   {"DECPT", &configchar, (void *)&(opts.outopts.decpt)},
671   {"MARKCHAR", &configchar, (void *)&(opts.outopts.markchar)},
672   {"REQFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_REQ)])},
673   {"REQARGSFLOOR", &configfloor, (void *)&(opts.outopts.subfloor[G(REP_REQ)])},
674   {"REDIRFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_REDIR)])},
675   {"REDIRARGSFLOOR", &configfloor,
676    (void *)&(opts.outopts.subfloor[G(REP_REDIR)])},
677   {"FAILFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_FAIL)])},
678   {"FAILARGSFLOOR", &configfloor,
679    (void *)&(opts.outopts.subfloor[G(REP_FAIL)])},
680   {"TYPEFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_TYPE)])},
681   {"SUBTYPEFLOOR", &configfloor,
682    (void *)&(opts.outopts.subfloor[G(REP_TYPE)])},
683   {"DIRFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_DIR)])},
684   {"SUBDIRFLOOR", &configfloor, (void *)&(opts.outopts.subfloor[G(REP_DIR)])},
685   {"HOSTFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_HOST)])},
686   {"REDIRHOSTFLOOR", &configfloor,
687    (void *)&(opts.outopts.floor[G(REP_REDIRHOST)])},
688   {"FAILHOSTFLOOR", &configfloor,
689    (void *)&(opts.outopts.floor[G(REP_FAILHOST)])},
690   {"DOMFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_DOM)])},
691   {"SUBDOMFLOOR", &configfloor, (void *)&(opts.outopts.subfloor[G(REP_DOM)])},
692   {"ORGFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_ORG)])},
693   {"SUBORGFLOOR", &configfloor, (void *)&(opts.outopts.subfloor[G(REP_ORG)])},
694   {"REFFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_REF)])},
695   {"REFARGSFLOOR", &configfloor, (void *)&(opts.outopts.subfloor[G(REP_REF)])},
696   {"REFSITEFLOOR", &configfloor,
697    (void *)&(opts.outopts.floor[G(REP_REFSITE)])},
698   {"REFDIRFLOOR", &configfloor,
699    (void *)&(opts.outopts.subfloor[G(REP_REFSITE)])},
700   {"SUBREFSITEFLOOR", &configfloor,
701    (void *)&(opts.outopts.subfloor[G(REP_REFSITE)])},
702   {"REDIRREFFLOOR", &configfloor,
703    (void *)&(opts.outopts.floor[G(REP_REDIRREF)])},
704   {"REDIRREFARGSFLOOR", &configfloor,
705    (void *)&(opts.outopts.subfloor[G(REP_REDIRREF)])},
706   {"FAILREFFLOOR", &configfloor,
707    (void *)&(opts.outopts.floor[G(REP_FAILREF)])},
708   {"FAILREFARGSFLOOR", &configfloor,
709    (void *)&(opts.outopts.subfloor[G(REP_FAILREF)])},
710   {"BROWREPFLOOR", &configfloor,
711    (void *)&(opts.outopts.floor[G(REP_BROWREP)])},
712   {"FULLBROWFLOOR", &configfloor,
713    (void *)&(opts.outopts.floor[G(REP_BROWREP)])},
714   {"BROWSUMFLOOR", &configfloor,
715    (void *)&(opts.outopts.floor[G(REP_BROWSUM)])},
716   {"BROWFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_BROWSUM)])},
717   {"SUBBROWFLOOR", &configfloor,
718    (void *)&(opts.outopts.subfloor[G(REP_BROWSUM)])},
719   {"OSFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_OS)])},
720   {"SUBOSFLOOR", &configfloor, (void *)&(opts.outopts.subfloor[G(REP_OS)])},
721   {"VHOSTFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_VHOST)])},
722   {"REDIRVHOSTFLOOR", &configfloor,
723    (void *)&(opts.outopts.floor[G(REP_REDIRVHOST)])},
724   {"FAILVHOSTFLOOR", &configfloor,
725    (void *)&(opts.outopts.floor[G(REP_FAILVHOST)])},
726   {"USERFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_USER)])},
727   {"REDIRUSERFLOOR", &configfloor,
728    (void *)&(opts.outopts.floor[G(REP_REDIRUSER)])},
729   {"FAILUSERFLOOR", &configfloor,
730    (void *)&(opts.outopts.floor[G(REP_FAILUSER)])},
731   {"SEARCHQUERYFLOOR", &configfloor,
732    (void *)&(opts.outopts.floor[G(REP_SEARCHREP)])},
733   {"SEARCHWORDFLOOR", &configfloor,
734    (void *)&(opts.outopts.floor[G(REP_SEARCHSUM)])},
735   {"INTSEARCHQUERYFLOOR", &configfloor,
736    (void *)&(opts.outopts.floor[G(REP_INTSEARCHREP)])},
737   {"INTSEARCHWORDFLOOR", &configfloor,
738    (void *)&(opts.outopts.floor[G(REP_INTSEARCHSUM)])},
739   {"STATUSFLOOR", &configfloor, (void *)&(opts.outopts.floor[G(REP_CODE)])},
740   {"FILEALIAS", &configalias, (void *)&(opts.aliashead[ITEM_FILE])},
741   {"HOSTALIAS", &configalias, (void *)&(opts.aliashead[ITEM_HOST])},
742   {"REFALIAS", &configalias, (void *)&(opts.aliashead[ITEM_REFERRER])},
743   {"BROWALIAS", &configalias, (void *)&(opts.aliashead[ITEM_BROWSER])},
744   {"USERALIAS", &configalias, (void *)&(opts.aliashead[ITEM_USER])},
745   {"VHOSTALIAS", &configalias, (void *)&(opts.aliashead[ITEM_VHOST])},
746   {"SEARCHENGINE", &configstrpair2list, (void *)&(opts.searchengines)},
747   {"INTSEARCHENGINE", &configstrpair2list, (void *)&(opts.intsearchengines)},
748   {"REQALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_REQ)])},
749   {"REQOUTPUTALIAS", &configalias,
750    (void *)&(opts.outopts.aliashead[G(REP_REQ)])},
751   {"REDIRALIAS", &configalias,
752    (void *)&(opts.outopts.aliashead[G(REP_REDIR)])},
753   {"REDIROUTPUTALIAS", &configalias,
754    (void *)&(opts.outopts.aliashead[G(REP_REDIR)])},
755   {"FAILALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_FAIL)])},
756   {"FAILOUTPUTALIAS", &configalias,
757    (void *)&(opts.outopts.aliashead[G(REP_FAIL)])},
758   {"TYPEALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_TYPE)])},
759   {"TYPEOUTPUTALIAS", &configalias,
760    (void *)&(opts.outopts.aliashead[G(REP_TYPE)])},
761   {"DIRALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_DIR)])},
762   {"DIROUTPUTALIAS", &configalias,
763    (void *)&(opts.outopts.aliashead[G(REP_DIR)])},
764   {"HOSTREPALIAS", &configalias,
765    (void *)&(opts.outopts.aliashead[G(REP_HOST)])},
766   {"HOSTOUTPUTALIAS", &configalias,
767    (void *)&(opts.outopts.aliashead[G(REP_HOST)])},
768   {"REDIRHOSTALIAS", &configalias,
769    (void *)&(opts.outopts.aliashead[G(REP_REDIRHOST)])},
770   {"REDIRHOSTOUTPUTALIAS", &configalias,
771    (void *)&(opts.outopts.aliashead[G(REP_REDIRHOST)])},
772   {"FAILHOSTALIAS", &configalias,
773    (void *)&(opts.outopts.aliashead[G(REP_FAILHOST)])},
774   {"FAILHOSTOUTPUTALIAS", &configalias,
775    (void *)&(opts.outopts.aliashead[G(REP_FAILHOST)])},
776   {"DOMALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_DOM)])},
777   {"DOMOUTPUTALIAS", &configalias,
778    (void *)&(opts.outopts.aliashead[G(REP_DOM)])},
779   {"ORGALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_ORG)])},
780   {"ORGOUTPUTALIAS", &configalias,
781    (void *)&(opts.outopts.aliashead[G(REP_ORG)])},
782   {"REFREPALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_REF)])},
783   {"REFOUTPUTALIAS", &configalias,
784    (void *)&(opts.outopts.aliashead[G(REP_REF)])},
785   {"REFSITEALIAS", &configalias,
786    (void *)&(opts.outopts.aliashead[G(REP_REFSITE)])},
787   {"REFSITEOUTPUTALIAS", &configalias,
788    (void *)&(opts.outopts.aliashead[G(REP_REFSITE)])},
789   {"REDIRREFALIAS", &configalias,
790    (void *)&(opts.outopts.aliashead[G(REP_REDIRREF)])},
791   {"REDIRREFOUTPUTALIAS", &configalias,
792    (void *)&(opts.outopts.aliashead[G(REP_REDIRREF)])},
793   {"FAILREFALIAS", &configalias,
794    (void *)&(opts.outopts.aliashead[G(REP_FAILREF)])},
795   {"FAILREFOUTPUTALIAS", &configalias,
796    (void *)&(opts.outopts.aliashead[G(REP_FAILREF)])},
797   {"BROWREPALIAS", &configalias,
798    (void *)&(opts.outopts.aliashead[G(REP_BROWREP)])},
799   {"BROWREPOUTPUTALIAS", &configalias,
800    (void *)&(opts.outopts.aliashead[G(REP_BROWREP)])},
801   {"FULLBROWOUTPUTALIAS", &configalias,
802    (void *)&(opts.outopts.aliashead[G(REP_BROWREP)])},
803   {"BROWSUMALIAS", &configalias,
804    (void *)&(opts.outopts.aliashead[G(REP_BROWSUM)])},
805   {"BROWSUMOUTPUTALIAS", &configalias,
806    (void *)&(opts.outopts.aliashead[G(REP_BROWSUM)])},
807   {"BROWOUTPUTALIAS", &configalias,
808    (void *)&(opts.outopts.aliashead[G(REP_BROWSUM)])},
809   {"OSALIAS", &configalias, (void *)&(opts.outopts.aliashead[G(REP_OS)])},
810   {"OSOUTPUTALIAS", &configalias,
811    (void *)&(opts.outopts.aliashead[G(REP_OS)])},
812   {"VHOSTREPALIAS", &configalias,
813    (void *)&(opts.outopts.aliashead[G(REP_VHOST)])},
814   {"VHOSTOUTPUTALIAS", &configalias,
815    (void *)&(opts.outopts.aliashead[G(REP_VHOST)])},
816   {"REDIRVHOSTALIAS", &configalias,
817    (void *)&(opts.outopts.aliashead[G(REP_REDIRVHOST)])},
818   {"REDIRVHOSTOUTPUTALIAS", &configalias,
819    (void *)&(opts.outopts.aliashead[G(REP_REDIRVHOST)])},
820   {"FAILVHOSTALIAS", &configalias,
821    (void *)&(opts.outopts.aliashead[G(REP_FAILVHOST)])},
822   {"FAILVHOSTOUTPUTALIAS", &configalias,
823    (void *)&(opts.outopts.aliashead[G(REP_FAILVHOST)])},
824   {"USERREPALIAS", &configalias,
825    (void *)&(opts.outopts.aliashead[G(REP_USER)])},
826   {"USEROUTPUTALIAS", &configalias,
827    (void *)&(opts.outopts.aliashead[G(REP_USER)])},
828   {"REDIRUSERALIAS", &configalias,
829    (void *)&(opts.outopts.aliashead[G(REP_REDIRUSER)])},
830   {"REDIRUSEROUTPUTALIAS", &configalias,
831    (void *)&(opts.outopts.aliashead[G(REP_REDIRUSER)])},
832   {"FAILUSERALIAS", &configalias,
833    (void *)&(opts.outopts.aliashead[G(REP_FAILUSER)])},
834   {"FAILUSEROUTPUTALIAS", &configalias,
835    (void *)&(opts.outopts.aliashead[G(REP_FAILUSER)])},
836 #ifndef NOPIPES
837   {"UNCOMPRESS", &configstrpairlist, (void *)&uncompresshead},
838 #endif
839   {"REQARGS", &configtree, (void *)&(opts.outopts.tree[G(REP_REQ)])},
840   {"REDIRARGS", &configtree, (void *)&(opts.outopts.tree[G(REP_REDIR)])},
841   {"FAILARGS", &configtree, (void *)&(opts.outopts.tree[G(REP_FAIL)])},
842   {"REFARGS", &configtree, (void *)&(opts.outopts.tree[G(REP_REF)])},
843   {"REDIRREFARGS", &configtree, (void *)&(opts.outopts.tree[G(REP_REDIRREF)])},
844   {"FAILREFARGS", &configtree, (void *)&(opts.outopts.tree[G(REP_FAILREF)])},
845   {"SUBDOMAIN", &configtree, (void *)&(opts.outopts.tree[G(REP_DOM)])},
846   {"SUBDOM", &configtree, (void *)&(opts.outopts.tree[G(REP_DOM)])},
847   {"SUBDIR", &configtree, (void *)&(opts.outopts.tree[G(REP_DIR)])},
848   {"SUBTYPE", &configtree, (void *)&(opts.outopts.tree[G(REP_TYPE)])},
849   {"REFDIR", &configtree, (void *)&(opts.outopts.tree[G(REP_REFSITE)])},
850   {"SUBREFSITE", &configtree, (void *)&(opts.outopts.tree[G(REP_REFSITE)])},
851   {"SUBBROW", &configtree, (void *)&(opts.outopts.tree[G(REP_BROWSUM)])},
852   {"SUBOS", &configtree, (void *)&(opts.outopts.tree[G(REP_OS)])},
853   {"SUBORG", &configstrlist, (void *)&(opts.outopts.suborgs)},
854   {"SUBORG2", &configtree, (void *)&(opts.outopts.tree[G(REP_ORG)])},
855   /* have to postpone SUBORG's until domains file has been read */
856   {"FILEINCLUDE", &configinc, (void *)&(opts.wanthead[ITEM_FILE])},
857   {"FILEEXCLUDE", &configexc, (void *)&(opts.wanthead[ITEM_FILE])},
858   {"HOSTINCLUDE", &confighostinc, (void *)&(opts.wanthead[ITEM_HOST])},
859   {"HOSTEXCLUDE", &confighostexc, (void *)&(opts.wanthead[ITEM_HOST])},
860   {"REFINCLUDE", &configinc, (void *)&(opts.wanthead[ITEM_REFERRER])},
861   {"REFEXCLUDE", &configexc, (void *)&(opts.wanthead[ITEM_REFERRER])},
862   {"BROWINCLUDE", &configinc, (void *)&(opts.wanthead[ITEM_BROWSER])},
863   {"BROWEXCLUDE", &configexc, (void *)&(opts.wanthead[ITEM_BROWSER])},
864   {"USERINCLUDE", &configinc, (void *)&(opts.wanthead[ITEM_USER])},
865   {"USEREXCLUDE", &configexc, (void *)&(opts.wanthead[ITEM_USER])},
866   {"VHOSTINCLUDE", &configinc, (void *)&(opts.wanthead[ITEM_VHOST])},
867   {"VHOSTEXCLUDE", &configexc, (void *)&(opts.wanthead[ITEM_VHOST])},
868   {"STATUSINCLUDE", &configscinc, (void *)(opts.code2type)},
869   {"STATUSEXCLUDE", &configscexc, (void *)(opts.code2type)},
870   {"304ISSUCCESS", &configchoice, (void *)&(opts.succ304)},
871   {"REQINCLUDE", &configinc, (void *)&(opts.outopts.wanthead[G(REP_REQ)])},
872   {"REQEXCLUDE", &configexc, (void *)&(opts.outopts.wanthead[G(REP_REQ)])},
873   {"REDIRINCLUDE", &configinc, (void *)&(opts.outopts.wanthead[G(REP_REDIR)])},
874   {"REDIREXCLUDE", &configexc, (void *)&(opts.outopts.wanthead[G(REP_REDIR)])},
875   {"FAILINCLUDE", &configinc, (void *)&(opts.outopts.wanthead[G(REP_FAIL)])},
876   {"FAILEXCLUDE", &configexc, (void *)&(opts.outopts.wanthead[G(REP_FAIL)])},
877   {"TYPEINCLUDE", &configincd, (void *)&(opts.outopts.wanthead[G(REP_TYPE)])},
878   {"TYPEEXCLUDE", &configexcd, (void *)&(opts.outopts.wanthead[G(REP_TYPE)])},
879   {"DIRINCLUDE", &configincs, (void *)&(opts.outopts.wanthead[G(REP_DIR)])},
880   {"DIREXCLUDE", &configexcs, (void *)&(opts.outopts.wanthead[G(REP_DIR)])},
881   {"HOSTREPINCLUDE", &confighostinc,
882    (void *)&(opts.outopts.wanthead[G(REP_HOST)])},
883   {"HOSTREPEXCLUDE", &confighostexc,
884    (void *)&(opts.outopts.wanthead[G(REP_HOST)])},
885   {"REDIRHOSTINCLUDE", &confighostinc,
886    (void *)&(opts.outopts.wanthead[G(REP_REDIRHOST)])},
887   {"REDIRHOSTEXCLUDE", &confighostexc,
888    (void *)&(opts.outopts.wanthead[G(REP_REDIRHOST)])},
889   {"FAILHOSTINCLUDE", &confighostinc,
890    (void *)&(opts.outopts.wanthead[G(REP_FAILHOST)])},
891   {"FAILHOSTEXCLUDE", &confighostexc,
892    (void *)&(opts.outopts.wanthead[G(REP_FAILHOST)])},
893   {"DOMINCLUDE", &configincd, (void *)&(opts.outopts.wanthead[G(REP_DOM)])},
894   {"DOMEXCLUDE", &configexcd, (void *)&(opts.outopts.wanthead[G(REP_DOM)])},
895   {"ORGINCLUDE", &configinc, (void *)&(opts.outopts.wanthead[G(REP_ORG)])},
896   {"ORGEXCLUDE", &configexc, (void *)&(opts.outopts.wanthead[G(REP_ORG)])},
897   {"REFREPINCLUDE", &configinc, (void *)&(opts.outopts.wanthead[G(REP_REF)])},
898   {"REFREPEXCLUDE", &configexc, (void *)&(opts.outopts.wanthead[G(REP_REF)])},
899   {"REFSITEINCLUDE", &configincs,
900    (void *)&(opts.outopts.wanthead[G(REP_REFSITE)])},
901   {"REFSITEEXCLUDE", &configexcs,
902    (void *)&(opts.outopts.wanthead[G(REP_REFSITE)])},
903   {"REDIRREFINCLUDE", &configinc,
904    (void *)&(opts.outopts.wanthead[G(REP_REDIRREF)])},
905   {"REDIRREFEXCLUDE", &configexc,
906    (void *)&(opts.outopts.wanthead[G(REP_REDIRREF)])},
907   {"FAILREFINCLUDE", &configinc,
908    (void *)&(opts.outopts.wanthead[G(REP_FAILREF)])},
909   {"FAILREFEXCLUDE", &configexc,
910    (void *)&(opts.outopts.wanthead[G(REP_FAILREF)])},
911   {"BROWSUMINCLUDE", &configinc,
912    (void *)&(opts.outopts.wanthead[G(REP_BROWSUM)])},
913   {"BROWSUMEXCLUDE", &configexc,
914    (void *)&(opts.outopts.wanthead[G(REP_BROWSUM)])},
915   {"BROWREPINCLUDE", &configinc,
916    (void *)&(opts.outopts.wanthead[G(REP_BROWREP)])},
917   {"BROWREPEXCLUDE", &configexc,
918    (void *)&(opts.outopts.wanthead[G(REP_BROWREP)])},
919   {"FULLBROWINCLUDE", &configinc,
920    (void *)&(opts.outopts.wanthead[G(REP_BROWREP)])},
921   {"FULLBROWEXCLUDE", &configexc,
922    (void *)&(opts.outopts.wanthead[G(REP_BROWREP)])},
923   {"OSINCLUDE", &configinc, (void *)&(opts.outopts.wanthead[G(REP_OS)])},
924   {"OSEXCLUDE", &configexc, (void *)&(opts.outopts.wanthead[G(REP_OS)])},
925   {"VHOSTREPINCLUDE", &configinc,
926    (void *)&(opts.outopts.wanthead[G(REP_VHOST)])},
927   {"VHOSTREPEXCLUDE", &configexc,
928    (void *)&(opts.outopts.wanthead[G(REP_VHOST)])},
929   {"REDIRVHOSTINCLUDE", &configinc,
930    (void *)&(opts.outopts.wanthead[G(REP_REDIRVHOST)])},
931   {"REDIRVHOSTEXCLUDE", &configexc,
932    (void *)&(opts.outopts.wanthead[G(REP_REDIRVHOST)])},
933   {"FAILVHOSTINCLUDE", &configinc,
934    (void *)&(opts.outopts.wanthead[G(REP_FAILVHOST)])},
935   {"FAILVHOSTEXCLUDE", &configexc,
936    (void *)&(opts.outopts.wanthead[G(REP_FAILVHOST)])},
937   {"USERREPINCLUDE", &configinc,
938    (void *)&(opts.outopts.wanthead[G(REP_USER)])},
939   {"USERREPEXCLUDE", &configexc,
940    (void *)&(opts.outopts.wanthead[G(REP_USER)])},
941   {"REDIRUSERINCLUDE", &configinc,
942    (void *)&(opts.outopts.wanthead[G(REP_REDIRUSER)])},
943   {"REDIRUSEREXCLUDE", &configexc,
944    (void *)&(opts.outopts.wanthead[G(REP_REDIRUSER)])},
945   {"FAILUSERINCLUDE", &configinc,
946    (void *)&(opts.outopts.wanthead[G(REP_FAILUSER)])},
947   {"FAILUSEREXCLUDE", &configexc,
948    (void *)&(opts.outopts.wanthead[G(REP_FAILUSER)])},
949   {"SEARCHQUERYINCLUDE", &configinc,
950    (void *)&(opts.outopts.wanthead[G(REP_SEARCHREP)])},
951   {"SEARCHQUERYEXCLUDE", &configexc,
952    (void *)&(opts.outopts.wanthead[G(REP_SEARCHREP)])},
953   {"SEARCHWORDINCLUDE", &configinc,
954    (void *)&(opts.outopts.wanthead[G(REP_SEARCHSUM)])},
955   {"SEARCHWORDEXCLUDE", &configexc,
956    (void *)&(opts.outopts.wanthead[G(REP_SEARCHSUM)])},
957   {"INTSEARCHQUERYINCLUDE", &configinc,
958    (void *)&(opts.outopts.wanthead[G(REP_INTSEARCHREP)])},
959   {"INTSEARCHQUERYEXCLUDE", &configexc,
960    (void *)&(opts.outopts.wanthead[G(REP_INTSEARCHREP)])},
961   {"INTSEARCHWORDINCLUDE", &configinc,
962    (void *)&(opts.outopts.wanthead[G(REP_INTSEARCHSUM)])},
963   {"INTSEARCHWORDEXCLUDE", &configexc,
964    (void *)&(opts.outopts.wanthead[G(REP_INTSEARCHSUM)])},
965   {"LINKINCLUDE", &configinc, (void *)&(opts.outopts.link[G(REP_REQ)])},
966   {"LINKEXCLUDE", &configexc, (void *)&(opts.outopts.link[G(REP_REQ)])},
967   {"REQLINKINCLUDE", &configinc, (void *)&(opts.outopts.link[G(REP_REQ)])},
968   {"REQLINKEXCLUDE", &configexc, (void *)&(opts.outopts.link[G(REP_REQ)])},
969   {"REDIRLINKINCLUDE", &configinc, (void *)&(opts.outopts.link[G(REP_REDIR)])},
970   {"REDIRLINKEXCLUDE", &configexc, (void *)&(opts.outopts.link[G(REP_REDIR)])},
971   {"FAILLINKINCLUDE", &configinc, (void *)&(opts.outopts.link[G(REP_FAIL)])},
972   {"FAILLINKEXCLUDE", &configexc, (void *)&(opts.outopts.link[G(REP_FAIL)])},
973   {"REFLINKINCLUDE", &configinc, (void *)&(opts.outopts.link[G(REP_REF)])},
974   {"REFLINKEXCLUDE", &configexc, (void *)&(opts.outopts.link[G(REP_REF)])},
975   {"REDIRREFLINKINCLUDE", &configinc,
976    (void *)&(opts.outopts.link[G(REP_REDIRREF)])},
977   {"REDIRREFLINKEXCLUDE", &configexc,
978    (void *)&(opts.outopts.link[G(REP_REDIRREF)])},
979   {"FAILREFLINKINCLUDE", &configinc,
980    (void *)&(opts.outopts.link[G(REP_FAILREF)])},
981   {"FAILREFLINKEXCLUDE", &configexc,
982    (void *)&(opts.outopts.link[G(REP_FAILREF)])},
983   {"ARGSINCLUDE", &configinc, (void *)&(opts.argshead)},
984   {"ARGSEXCLUDE", &configexc, (void *)&(opts.argshead)},
985   {"REFARGSINCLUDE", &configinc, (void *)&(opts.refargshead)},
986   {"REFARGSEXCLUDE", &configexc, (void *)&(opts.refargshead)},
987   {"PAGEINCLUDE", &configinc, (void *)&(opts.ispagehead)},
988   {"PAGEEXCLUDE", &configexc, (void *)&(opts.ispagehead)},
989   {"ROBOTINCLUDE", &configinc, (void *)&(opts.robots)},
990   {"ROBOTEXCLUDE", &configexc, (void *)&(opts.robots)},
991   {"REQSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_REQ)])},
992   {"REQARGSSORTBY", &configchoice,
993    (void *)&(opts.outopts.subsortby[G(REP_REQ)])},
994   {"REDIRSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_REDIR)])},
995   {"REDIRARGSSORTBY", &configchoice,
996    (void *)&(opts.outopts.subsortby[G(REP_REDIR)])},
997   {"FAILSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_FAIL)])},
998   {"FAILARGSSORTBY", &configchoice,
999    (void *)&(opts.outopts.subsortby[G(REP_FAIL)])},
1000   {"TYPESORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_TYPE)])},
1001   {"SUBTYPESORTBY", &configchoice,
1002    (void *)&(opts.outopts.subsortby[G(REP_TYPE)])},
1003   {"DIRSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_DIR)])},
1004   {"SUBDIRSORTBY", &configchoice,
1005    (void *)&(opts.outopts.subsortby[G(REP_DIR)])},
1006   {"HOSTSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_HOST)])},
1007   {"REDIRHOSTSORTBY", &configchoice,
1008    (void *)&(opts.outopts.sortby[G(REP_REDIRHOST)])},
1009   {"FAILHOSTSORTBY", &configchoice,
1010    (void *)&(opts.outopts.sortby[G(REP_FAILHOST)])},
1011   {"DOMSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_DOM)])},
1012   {"SUBDOMSORTBY", &configchoice,
1013    (void *)&(opts.outopts.subsortby[G(REP_DOM)])},
1014   {"ORGSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_ORG)])},
1015   {"SUBORGSORTBY", &configchoice,
1016    (void *)&(opts.outopts.subsortby[G(REP_ORG)])},
1017   {"REFSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_REF)])},
1018   {"REFARGSSORTBY", &configchoice,
1019    (void *)&(opts.outopts.subsortby[G(REP_REF)])},
1020   {"REFSITESORTBY", &configchoice,
1021    (void *)&(opts.outopts.sortby[G(REP_REFSITE)])},
1022   {"REFDIRSORTBY", &configchoice,
1023    (void *)&(opts.outopts.subsortby[G(REP_REFSITE)])},
1024   {"SUBREFSITESORTBY", &configchoice,
1025    (void *)&(opts.outopts.subsortby[G(REP_REFSITE)])},
1026   {"REDIRREFSORTBY", &configchoice,
1027    (void *)&(opts.outopts.sortby[G(REP_REDIRREF)])},
1028   {"REDIRREFARGSSORTBY", &configchoice,
1029    (void *)&(opts.outopts.subsortby[G(REP_REDIRREF)])},
1030   {"FAILREFSORTBY", &configchoice,
1031    (void *)&(opts.outopts.sortby[G(REP_FAILREF)])},
1032   {"FAILREFARGSSORTBY", &configchoice,
1033    (void *)&(opts.outopts.subsortby[G(REP_FAILREF)])},
1034   {"BROWREPSORTBY", &configchoice,
1035    (void *)&(opts.outopts.sortby[G(REP_BROWREP)])},
1036   {"FULLBROWSORTBY", &configchoice,
1037    (void *)&(opts.outopts.sortby[G(REP_BROWREP)])},
1038   {"BROWSUMSORTBY", &configchoice,
1039    (void *)&(opts.outopts.sortby[G(REP_BROWSUM)])},
1040   {"BROWSORTBY", &configchoice,
1041    (void *)&(opts.outopts.sortby[G(REP_BROWSUM)])},
1042   {"SUBBROWSORTBY", &configchoice,
1043    (void *)&(opts.outopts.subsortby[G(REP_BROWSUM)])},
1044   {"OSSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_OS)])},
1045   {"SUBOSSORTBY", &configchoice, (void *)&(opts.outopts.subsortby[G(REP_OS)])},
1046   {"STATUSSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_CODE)])},
1047   {"VHOSTSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_VHOST)])},
1048   {"REDIRVHOSTSORTBY", &configchoice,
1049    (void *)&(opts.outopts.sortby[G(REP_REDIRVHOST)])},
1050   {"FAILVHOSTSORTBY", &configchoice,
1051    (void *)&(opts.outopts.sortby[G(REP_FAILVHOST)])},
1052   {"USERSORTBY", &configchoice, (void *)&(opts.outopts.sortby[G(REP_USER)])},
1053   {"REDIRUSERSORTBY", &configchoice,
1054    (void *)&(opts.outopts.sortby[G(REP_REDIRUSER)])},
1055   {"FAILUSERSORTBY", &configchoice,
1056    (void *)&(opts.outopts.sortby[G(REP_FAILUSER)])},
1057   {"SEARCHQUERYSORTBY", &configchoice,
1058    (void *)&(opts.outopts.sortby[G(REP_SEARCHREP)])},
1059   {"SEARCHWORDSORTBY", &configchoice,
1060    (void *)&(opts.outopts.sortby[G(REP_SEARCHSUM)])},
1061   {"INTSEARCHQUERYSORTBY", &configchoice,
1062    (void *)&(opts.outopts.sortby[G(REP_INTSEARCHREP)])},
1063   {"INTSEARCHWORDSORTBY", &configchoice,
1064    (void *)&(opts.outopts.sortby[G(REP_INTSEARCHSUM)])},
1065   {"ALL", &configall, (void *)(opts.outopts.repq)},
1066   {"ALLBACK", &configallback, (void *)(opts.outopts.back)},
1067   {"YEARLY", &configchoice, (void *)&(opts.outopts.repq[REP_YEAR])},
1068   {"QUARTERLY", &configchoice, (void *)&(opts.outopts.repq[REP_QUARTERLY])},
1069   {"MONTHLY", &configchoice, (void *)&(opts.outopts.repq[REP_MONTH])},
1070   {"WEEKLY", &configchoice, (void *)&(opts.outopts.repq[REP_WEEK])},
1071   {"DAILYREP", &configchoice, (void *)&(opts.outopts.repq[REP_DAYREP])},
1072   {"FULLDAILY", &configchoice, (void *)&(opts.outopts.repq[REP_DAYREP])},
1073   {"DAILYSUM", &configchoice, (void *)&(opts.outopts.repq[REP_DAYSUM])},
1074   {"DAILY", &configchoice, (void *)&(opts.outopts.repq[REP_DAYSUM])},
1075   {"HOURLYREP", &configchoice, (void *)&(opts.outopts.repq[REP_HOURREP])},
1076   {"FULLHOURLY", &configchoice, (void *)&(opts.outopts.repq[REP_HOURREP])},
1077   {"HOURLYSUM", &configchoice, (void *)&(opts.outopts.repq[REP_HOURSUM])},
1078   {"HOURLY", &configchoice, (void *)&(opts.outopts.repq[REP_HOURSUM])},
1079   {"WEEKHOUR", &configchoice, (void *)&(opts.outopts.repq[REP_WEEKHOUR])},
1080   {"QUARTERREP", &configchoice, (void *)&(opts.outopts.repq[REP_QUARTERREP])},
1081   {"QUARTER", &configchoice, (void *)&(opts.outopts.repq[REP_QUARTERREP])},
1082   {"QUARTERSUM", &configchoice, (void *)&(opts.outopts.repq[REP_QUARTERSUM])},
1083   {"FIVEREP", &configchoice, (void *)&(opts.outopts.repq[REP_FIVEREP])},
1084   {"FIVE", &configchoice, (void *)&(opts.outopts.repq[REP_FIVEREP])},
1085   {"FIVESUM", &configchoice, (void *)&(opts.outopts.repq[REP_FIVESUM])},
1086   {"GENERAL", &configchoice, (void *)&(opts.outopts.repq[REP_GENSUM])},
1087   {"LASTSEVEN", &configchoice, (void *)&(opts.outopts.last7)},
1088   {"RUNTIME", &configchoice, (void *)&(opts.outopts.runtime)},
1089   {"GOTOS", &configchoice, (void *)&(opts.outopts.gotos)},
1090   {"REPORTSPAN", &configchoice, (void *)&(opts.outopts.repspan)},
1091   {"REPORTSPANTHRESHOLD", &configuint, (void *)&(opts.outopts.rsthresh)},
1092   {"RSTHRESH", &configuint, (void *)&(opts.outopts.rsthresh)},
1093   {"DESCRIPTIONS", &configchoice, (void *)&(opts.outopts.descriptions)},
1094   {"REQUEST", &configchoice, (void *)&(opts.outopts.repq[REP_REQ])},
1095   {"REDIR", &configchoice, (void *)&(opts.outopts.repq[REP_REDIR])},
1096   {"REDIRECTION", &configchoice, (void *)&(opts.outopts.repq[REP_REDIR])},
1097   {"FAILURE", &configchoice, (void *)&(opts.outopts.repq[REP_FAIL])},
1098   {"FILETYPE", &configchoice, (void *)&(opts.outopts.repq[REP_TYPE])},
1099   {"SIZE", &configchoice, (void *)&(opts.outopts.repq[REP_SIZE])},
1100   {"PROCTIME", &configchoice, (void *)&(opts.outopts.repq[REP_PROCTIME])},
1101   {"DIRECTORY", &configchoice, (void *)&(opts.outopts.repq[REP_DIR])},
1102   {"HOST", &configchoice, (void *)&(opts.outopts.repq[REP_HOST])},
1103   {"REDIRHOST", &configchoice, (void *)&(opts.outopts.repq[REP_REDIRHOST])},
1104   {"FAILHOST", &configchoice, (void *)&(opts.outopts.repq[REP_FAILHOST])},
1105   {"DOMAIN", &configchoice, (void *)&(opts.outopts.repq[REP_DOM])},
1106   {"ORGANISATION", &configchoice, (void *)&(opts.outopts.repq[REP_ORG])},
1107   {"ORGANIZATION", &configchoice, (void *)&(opts.outopts.repq[REP_ORG])},
1108   {"REFERRER", &configchoice, (void *)&(opts.outopts.repq[REP_REF])},
1109   {"REFERER", &configchoice, (void *)&(opts.outopts.repq[REP_REF])},
1110   {"REFSITE", &configchoice, (void *)&(opts.outopts.repq[REP_REFSITE])},
1111   {"REDIRREF", &configchoice, (void *)&(opts.outopts.repq[REP_REDIRREF])},
1112   {"FAILREF", &configchoice, (void *)&(opts.outopts.repq[REP_FAILREF])},
1113   {"BROWSERREP", &configchoice, (void *)&(opts.outopts.repq[REP_BROWREP])},
1114   {"BROWREP", &configchoice, (void *)&(opts.outopts.repq[REP_BROWREP])},
1115   {"FULLBROWSER", &configchoice, (void *)&(opts.outopts.repq[REP_BROWREP])},
1116   {"BROWSERSUM", &configchoice, (void *)&(opts.outopts.repq[REP_BROWSUM])},
1117   {"BROWSUM", &configchoice, (void *)&(opts.outopts.repq[REP_BROWSUM])},
1118   {"BROWSER", &configchoice, (void *)&(opts.outopts.repq[REP_BROWSUM])},
1119   {"OSREP", &configchoice, (void *)&(opts.outopts.repq[REP_OS])},
1120   {"VHOST", &configchoice, (void *)&(opts.outopts.repq[REP_VHOST])},
1121   {"REDIRVHOST", &configchoice, (void *)&(opts.outopts.repq[REP_REDIRVHOST])},
1122   {"FAILVHOST", &configchoice, (void *)&(opts.outopts.repq[REP_FAILVHOST])},
1123   {"USER", &configchoice, (void *)&(opts.outopts.repq[REP_USER])},
1124   {"REDIRUSER", &configchoice, (void *)&(opts.outopts.repq[REP_REDIRUSER])},
1125   {"FAILUSER", &configchoice, (void *)&(opts.outopts.repq[REP_FAILUSER])},
1126   {"SEARCHQUERY", &configchoice, (void *)&(opts.outopts.repq[REP_SEARCHREP])},
1127   {"SEARCHWORD", &configchoice, (void *)&(opts.outopts.repq[REP_SEARCHSUM])},
1128   {"INTSEARCHQUERY", &configchoice,
1129    (void *)&(opts.outopts.repq[REP_INTSEARCHREP])},
1130   {"INTSEARCHWORD", &configchoice,
1131    (void *)&(opts.outopts.repq[REP_INTSEARCHSUM])},
1132   {"STATUS", &configchoice, (void *)&(opts.outopts.repq[REP_CODE])},
1133   {"YEARBACK", &configchoice, (void *)&(opts.outopts.back[REP_YEAR])},
1134   {"QUARTERLYBACK", &configchoice,
1135    (void *)&(opts.outopts.back[REP_QUARTERLY])},
1136   {"MONTHBACK", &configchoice, (void *)&(opts.outopts.back[REP_MONTH])},
1137   {"WEEKBACK", &configchoice, (void *)&(opts.outopts.back[REP_WEEK])},
1138   {"DAYBACK", &configchoice, (void *)&(opts.outopts.back[REP_DAYREP])},
1139   {"DAYREPBACK", &configchoice, (void *)&(opts.outopts.back[REP_DAYREP])},
1140   {"FULLDAYBACK", &configchoice, (void *)&(opts.outopts.back[REP_DAYREP])},
1141   {"HOURBACK", &configchoice, (void *)&(opts.outopts.back[REP_HOURREP])},
1142   {"HOURREPBACK", &configchoice, (void *)&(opts.outopts.back[REP_HOURREP])},
1143   {"FULLHOURBACK", &configchoice, (void *)&(opts.outopts.back[REP_HOURREP])},
1144   {"QUARTERBACK", &configchoice, (void *)&(opts.outopts.back[REP_QUARTERREP])},
1145   {"QUARTERREPBACK", &configchoice,
1146    (void *)&(opts.outopts.back[REP_QUARTERREP])},
1147   {"FIVEBACK", &configchoice, (void *)&(opts.outopts.back[REP_FIVEREP])},
1148   {"FIVEREPBACK", &configchoice, (void *)&(opts.outopts.back[REP_FIVEREP])},
1149   {"RAWBYTES", &configchoice, (void *)&(opts.outopts.rawbytes)},
1150   {"BYTESDP", &configuint, (void *)&(opts.outopts.bytesdp)},
1151   {"NOROBOTS", &configchoice, (void *)&(opts.outopts.norobots)},
1152   {"SETTINGS", &configchoice, (void *)&vblesonly},
1153   {"CGI", &configchoice, (void *)&cgi},
1154   {"OUTPUT", &configchoice, (void *)&(opts.outopts.outstyle)},
1155   {"PDFLATEX", &configchoice, (void *)&(opts.outopts.pdflatex)},
1156   {"CASE", &configchoice, (void *)&(opts.miscopts.case_insensitive)},
1157   {"USERCASE", &configchoice, (void *)&(opts.miscopts.usercase_insensitive)},
1158   {"SEARCHCHARCONVERT", &configchoice, (void *)&(opts.outopts.searchconv)},
1159   {"YEARROWS", &configuint, (void *)&(opts.outopts.rows[REP_YEAR])},
1160   {"QUARTERLYROWS", &configuint, (void *)&(opts.outopts.rows[REP_QUARTERLY])},
1161   {"MONTHROWS", &configuint, (void *)&(opts.outopts.rows[REP_MONTH])},
1162   {"WEEKROWS", &configuint, (void *)&(opts.outopts.rows[REP_WEEK])},
1163   {"DAYROWS", &configuint, (void *)&(opts.outopts.rows[REP_DAYREP])},
1164   {"DAYREPROWS", &configuint, (void *)&(opts.outopts.rows[REP_DAYREP])},
1165   {"FULLDAYROWS", &configuint, (void *)&(opts.outopts.rows[REP_DAYREP])},
1166   {"HOURROWS", &configuint, (void *)&(opts.outopts.rows[REP_HOURREP])},
1167   {"HOURREPROWS", &configuint, (void *)&(opts.outopts.rows[REP_HOURREP])},
1168   {"FULLHOURROWS", &configuint, (void *)&(opts.outopts.rows[REP_HOURREP])},
1169   {"QUARTERROWS", &configuint, (void *)&(opts.outopts.rows[REP_QUARTERREP])},
1170   {"QUARTERREPROWS", &configuint,
1171    (void *)&(opts.outopts.rows[REP_QUARTERREP])},
1172   {"FIVEROWS", &configuint, (void *)&(opts.outopts.rows[REP_FIVEREP])},
1173   {"FIVEREPROWS", &configuint, (void *)&(opts.outopts.rows[REP_FIVEREP])},
1174   {"FILELOWMEM", &configlowmem, (void *)&(opts.miscopts.lowmem[ITEM_FILE])},
1175   {"HOSTLOWMEM", &configlowmem, (void *)&(opts.miscopts.lowmem[ITEM_HOST])},
1176   {"REFLOWMEM", &configlowmem, (void *)&(opts.miscopts.lowmem[ITEM_REFERRER])},
1177   {"BROWLOWMEM", &configlowmem, (void *)&(opts.miscopts.lowmem[ITEM_BROWSER])},
1178   {"USERLOWMEM", &configlowmem, (void *)&(opts.miscopts.lowmem[ITEM_USER])},
1179   {"VHOSTLOWMEM", &configlowmem, (void *)&(opts.miscopts.lowmem[ITEM_VHOST])},
1180   {"ASCIIPAGEWIDTH", &configuint, (void *)&(opts.outopts.plainpagewidth)},
1181   {"PLAINPAGEWIDTH", &configuint, (void *)&(opts.outopts.plainpagewidth)},
1182   {"HTMLPAGEWIDTH", &configuint, (void *)&(opts.outopts.htmlpagewidth)},
1183   {"LATEXPAGEWIDTH", &configuint, (void *)&(opts.outopts.latexpagewidth)},
1184   {"MINGRAPHWIDTH", &configuint, (void *)&(opts.outopts.mingraphwidth)},
1185   {"ERRLINELENGTH", &configuint, (void *)&errwidth},
1186   {"PROGRESSFREQ", &configulong, (void *)&progressfreq},
1187   {"WEEKBEGINSON", &configchoice, (void *)&(opts.outopts.weekbeginson)},
1188   {"FROM", &configstr, (void *)&(opts.dman.fromstr)},
1189   {"TO", &configstr, (void *)&(opts.dman.tostr)},
1190   {"REPORTORDER", &configrepord, (void *)(opts.outopts.reporder)},
1191   {"DEBUG", &configdebug, (void *)&debug_args},
1192   {"WARNINGS", &configdebug, (void *)&warn_args},
1193   {"GENSUMLINES", &configdebug, (void *)&(opts.outopts.gensumlines)},
1194   {"DOMLEVEL", &configdomlevel, (void *)&domlevels},
1195 #ifndef NODNS
1196   {"DNS", &configchoice, (void *)&dnslevel},
1197   {"DNSFILE", &configstr, (void *)&dnsfile},
1198   {"DNSLOCKFILE", &configstr, (void *)&dnslockfile},
1199   {"DNSGOODHOURS", &configuint, (void *)&dnsgoodhrs},
1200   {"DNSBADHOURS", &configuint, (void *)&dnsbadhrs},
1201 #ifndef NOALARM
1202   {"DNSTIMEOUT", &configuint, (void *)&dnstimeout},
1203 #endif
1204 #endif
1205   {"CONFIGFILE", &configcall, NULL},
1206   {"", NULL, NULL}  /* at end as marker */
1207 };
1208 
globals(char * comname)1209 void globals(char *comname) {
1210 #ifndef NOFOLLOW
1211   struct stat buf;
1212   char *path, *pathcp, *s, *t = NULL;
1213   size_t l = 0;
1214   logical done;
1215 #endif
1216   int i;
1217 
1218   time(&starttime);
1219   starttimestr = ctime(&starttime);
1220   starttimestr[24] = '\0';
1221   (void)parsedate(starttime, "-00-00-00:-00-00", &starttimec, FALSE, FALSE);
1222   (void)parsedate(starttime, "-00-00-00:-00-00", &starttimeuxc, FALSE, TRUE);
1223   /* parsedate() is needed because we don't know the encoding of time() */
1224   errfile = stderr;
1225   setvbuf(stderr, NULL, ERRBUFMODE, BUFSIZ);
1226   signal(SIGTERM, sighandler);
1227   signal(SIGINT, sighandler);
1228 #ifdef SIGHUP
1229   signal(SIGHUP, sighandler);
1230 #endif
1231 #ifdef SIGQUIT
1232   signal(SIGQUIT, sighandler);
1233 #endif
1234 #ifdef SIGPIPE
1235   signal(SIGPIPE, SIG_IGN);
1236 #endif
1237   workspace = (char *)xmalloc(BLOCKSIZE);
1238   block_start = (char *)xmalloc(BLOCKSIZE + 1);  /* 1 for terminating char */
1239   for (i = 0; i < ITEM_NUMBER; i++) {
1240     mm[i].curr_pos = NULL;
1241     mm[i].first = NULL;
1242     mm[i].alignment = 1;
1243   }
1244   mmq.curr_pos = NULL;
1245   mmq.first = NULL;
1246   mmq.alignment = 1;
1247   mms.curr_pos = NULL;
1248   mms.first = NULL;
1249   mms.alignment = 1;
1250   xmemman = (Memman *)xmalloc(sizeof(Memman));
1251   xmemman->curr_pos = NULL;
1252   xmemman->first = NULL;
1253   xmemman->alignment = ALIGNSIZE;
1254   amemman = (Memman *)xmalloc(sizeof(Memman));
1255   amemman->curr_pos = NULL;
1256   amemman->first = NULL;
1257   amemman->alignment = ALIGNSIZE;
1258   for (i = 0; i < 256; i++)
1259     termchar[i] = FALSE;
1260   termchar[(unsigned char)'\r'] = TRUE;
1261   termchar[(unsigned char)'\n'] = TRUE;
1262   termchar[(unsigned char)'\0'] = TRUE;
1263 
1264   if (IS_EMPTY_STRING(comname))
1265     COPYSTR(commandname, "analog")  /* no semicolon by defn of COPYSTR */
1266   else
1267     COPYSTR(commandname, comname);
1268 #ifndef NOFOLLOW
1269   commandpath = (char *)xmalloc(PATH_MAX);
1270   done = FALSE;
1271   if (strpbrk(commandname, PATHSEPS) == NULL &&
1272       (path = getenv("PATH")) != NULL) {
1273     pathcp = (char *)xmalloc(strlen(path) + 1);
1274     strcpy(pathcp, path);
1275     for (s = strtok(pathcp, ":"); !done && s != NULL; s = strtok(NULL, ":")) {
1276       ENSURE_LEN(t, l, strlen(s) + strlen(commandname) + 2);
1277       sprintf(t, "%s%c%s", s, DIRSEP, commandname);
1278       if (realpath(t, commandpath) != NULL && access(commandpath, X_OK) == 0 &&
1279 	  stat(commandpath, &buf) == 0 && S_ISREG(buf.st_mode))
1280 	done = TRUE;
1281     }
1282   }
1283   else if (realpath(commandname, commandpath) != NULL)
1284     done = TRUE;
1285   if (!done)
1286     strcpy(commandpath, commandname);
1287   commandpath = (char *)xrealloc((void *)commandpath, strlen(commandpath) + 1);
1288 #else
1289   commandpath = commandname;
1290 #endif
1291 
1292   unwanted_entry = newhashentry(DATA_NUMBER, FALSE);
1293   blank_entry = newhashentry(DATA_NUMBER, FALSE);
1294   dummy_item = (Hashindex *)submalloc(xmemman, sizeof(Hashindex));
1295   dummy_item->own = newhashentry(DATA_NUMBER, FALSE);
1296   rep2lng = (unsigned int *)xmalloc(REP_NUMBER * sizeof(unsigned int));
1297   rep2lng[REP_GENSUM] = gensum_;
1298   rep2lng[REP_YEAR] = yearrep_;
1299   rep2lng[REP_QUARTERLY] = quarterlyrep_;
1300   rep2lng[REP_MONTH] = monthrep_;
1301   rep2lng[REP_WEEK] = weekrep_;
1302   rep2lng[REP_DAYREP] = dayrep_;
1303   rep2lng[REP_DAYSUM] = daysum_;
1304   rep2lng[REP_HOURREP] = hourrep_;
1305   rep2lng[REP_HOURSUM] = hoursum_;
1306   rep2lng[REP_WEEKHOUR] = weekhoursum_;
1307   rep2lng[REP_QUARTERREP] = quarterrep_;
1308   rep2lng[REP_QUARTERSUM] = quartersum_;
1309   rep2lng[REP_FIVEREP] = fiverep_;
1310   rep2lng[REP_FIVESUM] = fivesum_;
1311   rep2lng[REP_REQ] = reqrep_;
1312   rep2lng[REP_REDIR] = redirrep_;
1313   rep2lng[REP_FAIL] = failrep_;
1314   rep2lng[REP_TYPE] = typerep_;
1315   rep2lng[REP_SIZE] = sizerep_;
1316   rep2lng[REP_PROCTIME] = proctimerep_;
1317   rep2lng[REP_DIR] = dirrep_;
1318   rep2lng[REP_HOST] = hostrep_;
1319   rep2lng[REP_REDIRHOST] = redirhostrep_;
1320   rep2lng[REP_FAILHOST] = failhostrep_;
1321   rep2lng[REP_DOM] = domrep_;
1322   rep2lng[REP_ORG] = orgrep_;
1323   rep2lng[REP_REF] = refrep_;
1324   rep2lng[REP_REFSITE] = refsiterep_;
1325   rep2lng[REP_REDIRREF] = redirrefrep_;
1326   rep2lng[REP_FAILREF] = failrefrep_;
1327   rep2lng[REP_BROWREP] = browrep_;
1328   rep2lng[REP_BROWSUM] = browsum_;
1329   rep2lng[REP_OS] = osrep_;
1330   rep2lng[REP_VHOST] = vhostrep_;
1331   rep2lng[REP_REDIRVHOST] = redirvhostrep_;
1332   rep2lng[REP_FAILVHOST] = failvhostrep_;
1333   rep2lng[REP_USER] = userrep_;
1334   rep2lng[REP_REDIRUSER] = rediruserrep_;
1335   rep2lng[REP_FAILUSER] = failuserrep_;
1336   rep2lng[REP_SEARCHREP] = searchrep_;
1337   rep2lng[REP_SEARCHSUM] = searchsum_;
1338   rep2lng[REP_INTSEARCHREP] = intsearchrep_;
1339   rep2lng[REP_INTSEARCHSUM] = intsearchsum_;
1340   rep2lng[REP_CODE] = statrep_;
1341   rep2type = (choice *)xmalloc(REP_NUMBER * sizeof(choice));
1342   rep2type[REP_YEAR] = INP_DATE;
1343   rep2type[REP_QUARTERLY] = INP_DATE;
1344   rep2type[REP_MONTH] = INP_DATE;
1345   rep2type[REP_WEEK] = INP_DATE;
1346   rep2type[REP_DAYREP] = INP_DATE;
1347   rep2type[REP_DAYSUM] = INP_DATE;
1348   rep2type[REP_HOURREP] = INP_DATE;
1349   rep2type[REP_HOURSUM] = INP_DATE;
1350   rep2type[REP_WEEKHOUR] = INP_DATE;
1351   rep2type[REP_QUARTERREP] = INP_DATE;
1352   rep2type[REP_QUARTERSUM] = INP_DATE;
1353   rep2type[REP_FIVEREP] = INP_DATE;
1354   rep2type[REP_FIVESUM] = INP_DATE;
1355   rep2type[REP_GENSUM] = UNSET;
1356   rep2type[REP_REQ] = ITEM_FILE;
1357   rep2type[REP_TYPE] = ITEM_FILE;
1358   rep2type[REP_DIR] = ITEM_FILE;
1359   rep2type[REP_REDIR] = ITEM_FILE;
1360   rep2type[REP_FAIL] = ITEM_FILE;
1361   rep2type[REP_HOST] = ITEM_HOST;
1362   rep2type[REP_REDIRHOST] = ITEM_HOST;
1363   rep2type[REP_FAILHOST] = ITEM_HOST;
1364   rep2type[REP_DOM] = ITEM_HOST;
1365   rep2type[REP_ORG] = ITEM_HOST;
1366   rep2type[REP_USER] = ITEM_USER;
1367   rep2type[REP_REDIRUSER] = ITEM_USER;
1368   rep2type[REP_FAILUSER] = ITEM_USER;
1369   rep2type[REP_REF] = ITEM_REFERRER;
1370   rep2type[REP_REFSITE] = ITEM_REFERRER;
1371   rep2type[REP_REDIRREF] = ITEM_REFERRER;
1372   rep2type[REP_FAILREF] = ITEM_REFERRER;
1373   rep2type[REP_SEARCHREP] = ITEM_REFERRER;
1374   rep2type[REP_SEARCHSUM] = ITEM_REFERRER;
1375   rep2type[REP_INTSEARCHREP] = ITEM_FILE;
1376   rep2type[REP_INTSEARCHSUM] = ITEM_FILE;
1377   rep2type[REP_BROWREP] = ITEM_BROWSER;
1378   rep2type[REP_BROWSUM] = ITEM_BROWSER;
1379   rep2type[REP_OS] = ITEM_BROWSER;
1380   rep2type[REP_VHOST] = ITEM_VHOST;
1381   rep2type[REP_REDIRVHOST] = ITEM_VHOST;
1382   rep2type[REP_FAILVHOST] = ITEM_VHOST;
1383   rep2type[REP_SIZE] = INP_BYTES;
1384   rep2type[REP_PROCTIME] = INP_PROCTIME;
1385   rep2type[REP_CODE] = INP_CODE;
1386   repistree = (logical *)xmalloc(GENREP_NUMBER * sizeof(logical));
1387   for (i = 0; i < GENREP_NUMBER; i++)
1388     repistree[i] = FALSE;
1389   repistree[G(REP_REQ)] = TRUE;
1390   repistree[G(REP_REDIR)] = TRUE;
1391   repistree[G(REP_FAIL)] = TRUE;
1392   repistree[G(REP_REF)] = TRUE;
1393   repistree[G(REP_REDIRREF)] = TRUE;
1394   repistree[G(REP_FAILREF)] = TRUE;
1395   repistree[G(REP_TYPE)] = TRUE;
1396   repistree[G(REP_DIR)] = TRUE;
1397   repistree[G(REP_DOM)] = TRUE;
1398   repistree[G(REP_ORG)] = TRUE;
1399   repistree[G(REP_REFSITE)] = TRUE;
1400   repistree[G(REP_BROWSUM)] = TRUE;
1401   repistree[G(REP_OS)] = TRUE;
1402   rep2reqs = (choice *)xmalloc(GENREP_NUMBER * sizeof(choice));
1403   rep2reqs7 = (choice *)xmalloc(GENREP_NUMBER * sizeof(choice));
1404   rep2date = (choice *)xmalloc(GENREP_NUMBER * sizeof(choice));
1405   rep2firstd = (choice *)xmalloc(GENREP_NUMBER * sizeof(choice));
1406   for (i = 0; i < GENREP_NUMBER; i++)
1407     rep2reqs[i] = REQUESTS;
1408   rep2reqs[G(REP_REDIR)] = REDIR;
1409   rep2reqs[G(REP_FAIL)] = FAIL;
1410   rep2reqs[G(REP_REDIRHOST)] = REDIR;
1411   rep2reqs[G(REP_FAILHOST)] = FAIL;
1412   rep2reqs[G(REP_REDIRUSER)] = REDIR;
1413   rep2reqs[G(REP_FAILUSER)] = FAIL;
1414   rep2reqs[G(REP_REDIRREF)] = REDIR;
1415   rep2reqs[G(REP_FAILREF)] = FAIL;
1416   rep2reqs[G(REP_REDIRVHOST)] = REDIR;
1417   rep2reqs[G(REP_FAILVHOST)] = FAIL;
1418   for (i = 0; i < GENREP_NUMBER; i++) {
1419     rep2reqs7[i] = (rep2reqs[i] == REDIR)?REDIR7:\
1420       ((rep2reqs[i] == FAIL)?FAIL7:REQUESTS7);
1421     rep2date[i] = (rep2reqs[i] == REDIR)?REDIRDATE:\
1422       ((rep2reqs[i] == FAIL)?FAILDATE:SUCCDATE);
1423     rep2firstd[i] = (rep2reqs[i] == REDIR)?REDIRFIRSTD:\
1424       ((rep2reqs[i] == FAIL)?FAILFIRSTD:SUCCFIRSTD);
1425   }
1426   rep2gran = (unsigned int *)xmalloc(DATEREP_NUMBER * sizeof(unsigned int));
1427   rep2gran[REP_DAYREP] = 1;
1428   rep2gran[REP_HOURREP] = 24;
1429   rep2gran[REP_QUARTERREP] = 96;
1430   rep2gran[REP_FIVEREP] = 288;
1431   rep2gran[REP_YEAR] = 1;
1432   rep2gran[REP_QUARTERLY] = 1;
1433   rep2gran[REP_MONTH] = 1;
1434   rep2gran[REP_WEEK] = 1;
1435   rep2gran[REP_DAYSUM] = 1;
1436   rep2gran[REP_HOURSUM] = 24;
1437   rep2gran[REP_WEEKHOUR] = 24;
1438   rep2gran[REP_QUARTERSUM] = 96;
1439   rep2gran[REP_FIVESUM] = 288;
1440   rep2datefmt = (unsigned int *)xmalloc(DATEREP_NUMBER * sizeof(unsigned int));
1441   rep2datefmt[REP_DAYREP] = dayrepfmt_;
1442   rep2datefmt[REP_DAYSUM] = daysumfmt_;
1443   rep2datefmt[REP_HOURREP] = hourrepfmt_;
1444   rep2datefmt[REP_QUARTERREP] = quarterrepfmt_;
1445   rep2datefmt[REP_FIVEREP] = quarterrepfmt_;
1446   rep2datefmt[REP_WEEK] = weekfmt_;
1447   rep2datefmt[REP_MONTH] = monthfmt_;
1448   rep2datefmt[REP_QUARTERLY] = quarterlyfmt_;
1449   rep2datefmt[REP_YEAR] = yearfmt_;
1450   rep2datefmt[REP_HOURSUM] = hoursumfmt_;
1451   rep2datefmt[REP_WEEKHOUR] = weekhoursumfmt_;
1452   rep2datefmt[REP_QUARTERSUM] = quartersumfmt_;
1453   rep2datefmt[REP_FIVESUM] = quartersumfmt_;
1454   rep2colhead = (unsigned int *)xmalloc(REP_NUMBER * sizeof(unsigned int));
1455   rep2colhead[REP_DAYREP] = date_;
1456   rep2colhead[REP_DAYSUM] = day_;
1457   rep2colhead[REP_HOURREP] = time_;
1458   rep2colhead[REP_HOURSUM] = hr_;
1459   rep2colhead[REP_WEEKHOUR] = hr_;
1460   rep2colhead[REP_QUARTERREP] = time_;
1461   rep2colhead[REP_QUARTERSUM] = time_;
1462   rep2colhead[REP_FIVEREP] = time_;
1463   rep2colhead[REP_FIVESUM] = time_;
1464   rep2colhead[REP_WEEK] = weekbeg_;
1465   rep2colhead[REP_MONTH] = month_;
1466   rep2colhead[REP_QUARTERLY] = quarteryr_;
1467   rep2colhead[REP_YEAR] = year_;
1468   rep2colhead[REP_REQ] = file_;
1469   rep2colhead[REP_REDIR] = file_;
1470   rep2colhead[REP_FAIL] = file_;
1471   rep2colhead[REP_TYPE] = ext_;
1472   rep2colhead[REP_SIZE] = size_;
1473   rep2colhead[REP_PROCTIME] = seconds_;
1474   rep2colhead[REP_DIR] = dir_;
1475   rep2colhead[REP_HOST] = host_;
1476   rep2colhead[REP_REDIRHOST] = host_;
1477   rep2colhead[REP_FAILHOST] = host_;
1478   rep2colhead[REP_DOM] = dom_;
1479   rep2colhead[REP_ORG] = org_;
1480   rep2colhead[REP_REF] = url_;
1481   rep2colhead[REP_REFSITE] = site_;
1482   rep2colhead[REP_REDIRREF] = url_;
1483   rep2colhead[REP_FAILREF] = url_;
1484   rep2colhead[REP_BROWREP] = browser_;
1485   rep2colhead[REP_BROWSUM] = browser_;
1486   rep2colhead[REP_OS] = os_;
1487   rep2colhead[REP_VHOST] = vhost_;
1488   rep2colhead[REP_REDIRVHOST] = vhost_;
1489   rep2colhead[REP_FAILVHOST] = vhost_;
1490   rep2colhead[REP_USER] = user_;
1491   rep2colhead[REP_REDIRUSER] = user_;
1492   rep2colhead[REP_FAILUSER] = user_;
1493   rep2colhead[REP_SEARCHREP] = search_;
1494   rep2colhead[REP_SEARCHSUM] = search_;
1495   rep2colhead[REP_INTSEARCHREP] = search_;
1496   rep2colhead[REP_INTSEARCHSUM] = search_;
1497   rep2colhead[REP_CODE] = code_;
1498   rep2busystr = (unsigned int *)xmalloc(DATEREPORTS_NUMBER * sizeof(unsigned int));
1499   rep2busystr[REP_DAYREP] = busyday_;
1500   rep2busystr[REP_HOURREP] = busyhour_;
1501   rep2busystr[REP_QUARTERREP] = busyquarterhr_;
1502   rep2busystr[REP_FIVEREP] = busyfive_;
1503   rep2busystr[REP_WEEK] = busyweek_;
1504   rep2busystr[REP_MONTH] = busymonth_;
1505   rep2busystr[REP_QUARTERLY] = busyquarteryr_;
1506   rep2busystr[REP_YEAR] = busyyear_;
1507   col2colhead = (unsigned int *)xmalloc(COL_NUMBER * sizeof(unsigned int));
1508   col2colhead[COL_REQS] = nreqs_;
1509   col2colhead[COL_PAGES] = npgs_;
1510   col2colhead[COL_BYTES] = nbytes_;
1511   col2colhead[COL_PREQS] = preqs_;
1512   col2colhead[COL_PPAGES] = ppgs_;
1513   col2colhead[COL_PBYTES] = pbytes_;
1514   col2colhead[COL_REQS7] = nreqs7_;
1515   col2colhead[COL_PAGES7] = npgs7_;
1516   col2colhead[COL_BYTES7] = nbytes7_;
1517   col2colhead[COL_PREQS7] = preqs7_;
1518   col2colhead[COL_PPAGES7] = ppgs7_;
1519   col2colhead[COL_PBYTES7] = pbytes7_;
1520   col2colhead[COL_DATE] = lastdate_;
1521   col2colhead[COL_TIME] = lasttime_;
1522   col2colhead[COL_FIRSTD] = firstdate_;
1523   col2colhead[COL_FIRSTT] = firsttime_;
1524   col2colhead[COL_INDEX] = index_;
1525   method2sing = (unsigned int *)xmalloc(METHOD_NUMBER * sizeof(unsigned int));
1526   method2sing[REQUESTS] = request_;
1527   method2sing[REQUESTS7] = request7_;
1528   method2sing[PAGES] = pagereq_;
1529   method2sing[PAGES7] = pagereq7_;
1530   method2sing[REDIR] = redirreq_;
1531   method2sing[REDIR7] = redirreq7_;
1532   method2sing[FAIL] = failreq_;
1533   method2sing[FAIL7] = failreq7_;
1534   method2sing[BYTES] = bytetraffic_;
1535   method2sing[BYTES7] = bytetraffic7_;
1536   method2pl = (unsigned int *)xmalloc(METHOD_NUMBER * sizeof(unsigned int));
1537   method2pl[REQUESTS] = requests_;
1538   method2pl[REQUESTS7] = requests7_;
1539   method2pl[PAGES] = pagereqs_;
1540   method2pl[PAGES7] = pagereqs7_;
1541   method2pl[REDIR] = redirreqs_;
1542   method2pl[REDIR7] = redirreqs7_;
1543   method2pl[FAIL] = failreqs_;
1544   method2pl[FAIL7] = failreqs7_;
1545   method2pl[BYTES] = bytestraffic_;
1546   method2pl[BYTES7] = bytestraffic7_;
1547   method2date = (unsigned int *)xmalloc(METHOD_NUMBER * sizeof(unsigned int));
1548   method2date[SUCCDATE] = sincedate_;
1549   method2date[REDIRDATE] = sinceredirdate_;
1550   method2date[FAILDATE] = sincefaildate_;
1551   method2date[SUCCFIRSTD] = sincefirstd_;
1552   method2date[REDIRFIRSTD] = sinceredirfirstd_;
1553   method2date[FAILFIRSTD] = sincefailfirstd_;
1554   method2pc = (unsigned int *)xmalloc(METHOD_NUMBER * sizeof(unsigned int));
1555   method2pc[REQUESTS] = prequests_;
1556   method2pc[REQUESTS7] = prequests7_;
1557   method2pc[PAGES] = ppages_;
1558   method2pc[PAGES7] = ppages7_;
1559   method2pc[REDIR] = predirs_;
1560   method2pc[REDIR7] = predirs7_;
1561   method2pc[FAIL] = pfails_;
1562   method2pc[FAIL7] = pfails7_;
1563   method2pc[BYTES] = ptraffic_;
1564   method2pc[BYTES7] = ptraffic7_;
1565   method2relpc = (unsigned int *)xmalloc(METHOD_NUMBER * sizeof(unsigned int));
1566   method2relpc[REQUESTS] = pmrequests_;
1567   method2relpc[REQUESTS7] = pmrequests7_;
1568   method2relpc[PAGES] = pmpages_;
1569   method2relpc[PAGES7] = pmpages7_;
1570   method2relpc[REDIR] = pmredirs_;
1571   method2relpc[REDIR7] = pmredirs7_;
1572   method2relpc[FAIL] = pmfails_;
1573   method2relpc[FAIL7] = pmfails7_;
1574   method2relpc[BYTES] = pmtraffic_;
1575   method2relpc[BYTES7] = pmtraffic7_;
1576   method2sort = (unsigned int *)xmalloc(METHOD_NUMBER * sizeof(unsigned int));
1577   method2sort[REQUESTS] = nrequests_;
1578   method2sort[REQUESTS7] = nrequests7_;
1579   method2sort[PAGES] = npages_;
1580   method2sort[PAGES7] = npages7_;
1581   method2sort[REDIR] = nredirs_;
1582   method2sort[REDIR7] = nredirs7_;
1583   method2sort[FAIL] = nfails_;
1584   method2sort[FAIL7] = nfails7_;
1585   method2sort[SUCCDATE] = succdate_;
1586   method2sort[REDIRDATE] = redirdate_;
1587   method2sort[FAILDATE] = faildate_;
1588   method2sort[SUCCFIRSTD] = succfirstd_;
1589   method2sort[REDIRFIRSTD] = redirfirstd_;
1590   method2sort[FAILFIRSTD] = failfirstd_;
1591   method2sort[BYTES] = traffic_;
1592   method2sort[BYTES7] = traffic7_;
1593 }
1594 
defaults(Options * op)1595 void defaults(Options *op) {
1596   double codethresh[] = {100., 101., 199., 200., 201., 202., 203., 204., 205.,
1597 			 206., 299., 300., 301., 302., 303., 304., 305., 306.,
1598 			 307., 399., 400., 401., 402., 403., 404., 405., 406.,
1599 			 407., 408., 409., 410., 411., 412., 413., 414., 415.,
1600 			 416., 417., 499., 500., 501., 502., 503.,
1601 			 504., 505., 506., 599., -1.};
1602   double sizethresh[] = {0., 10., 100., 1024., 10240., 102400., 1048576.,
1603 			 10485760., 104857600., 1073741824., -1.};
1604   double ptthresh[] = {0., 10., 20., 50., 100., 200., 500., 1000., 2000.,
1605 		       5000., 10000., 20000., 60000., 120000., 300000.,
1606 		       600000., -1.};
1607   /* These thresholds have to be coordinated with the names in arrayrep().
1608      The max codethresh & ptthresh also feature near the end of readcache(). */
1609   double *thresh;
1610   int i, j, k;
1611 
1612   op->conffilelist = NULL;
1613   confline(op, "DEBUG", "OFF", NULL, -1);
1614   confline(op, "WARNINGS", "ON", NULL, -1);
1615   op->outopts.gensumlines = NULL;
1616   confline(op, "GENSUMLINES", "ON", NULL, -1);
1617   deflogformat = (Inputformatlist *)submalloc(xmemman,
1618 					      sizeof(Inputformatlist));
1619   logformat = (Inputformatlist *)submalloc(xmemman, sizeof(Inputformatlist));
1620   deflogformat->used = TRUE;
1621   logformat->used = TRUE;
1622   configlogfmt((void *)&deflogformat, "DEFAULTLOGFORMAT", "AUTO", NULL, -1);
1623   configlogfmt((void *)&logformat, "LOGFORMAT", "DEFAULT", NULL, -1);
1624   deflogformat->used = TRUE;
1625   op->miscopts.logfile[0] = NULL;
1626   op->miscopts.logfile[1] = NULL;
1627   confline(op, "LOGFILE", LOGFILE, NULL, -1);
1628   confline(op, "CACHEFILE", CACHEFILE, NULL, -1);
1629   op->outopts.domainsfile = NULL;
1630   op->outopts.descfile = NULL;
1631   COPYSTR(op->miscopts.dirsuffix, DIRSUFFIX);
1632 #ifndef NODNS
1633   dnslevel = DNS;
1634   dnsgoodhrs = DNSGOODHOURS;
1635   dnsbadhrs = DNSBADHOURS;
1636   COPYSTR(dnsfile, DNSFILE);
1637   COPYSTR(dnslockfile, DNSLOCKFILE);
1638 #ifndef NOALARM
1639   dnstimeout = DNSTIMEOUT;
1640 #endif
1641 #endif
1642   op->miscopts.case_insensitive = CASE_INSENSITIVE;
1643   op->miscopts.usercase_insensitive = USERCASE_INSENSITIVE;
1644   op->outopts.searchconv = SEARCHCHARCONVERT;
1645   op->outopts.outstyle = OUTPUT;
1646   op->outopts.html = TRUE;
1647   op->outopts.pdflatex = TRUE;
1648   COPYSTR(op->outopts.headerfile, HEADERFILE);
1649   COPYSTR(op->outopts.footerfile, FOOTERFILE);
1650   COPYSTR(op->outopts.outfile, OUTFILE);
1651   COPYSTR(op->outopts.cacheoutfile, CACHEOUTFILE);
1652   COPYSTR(op->outopts.imagedir, IMAGEDIR);
1653   op->outopts.chartdir = NULL;
1654   op->outopts.localchartdir = NULL;
1655   op->outopts.jpegcharts = FALSE;
1656   op->outopts.pngimages = PNGIMAGES;
1657   confline(op, "YEARCOLS", YEARCOLS, NULL, -1);
1658   confline(op, "QUARTERLYCOLS", QUARTERLYCOLS, NULL, -1);
1659   confline(op, "MONTHCOLS", MONTHCOLS, NULL, -1);
1660   confline(op, "WEEKCOLS", WEEKCOLS, NULL, -1);
1661   confline(op, "DAYREPCOLS", DAYREPCOLS, NULL, -1);
1662   confline(op, "DAYSUMCOLS", DAYSUMCOLS, NULL, -1);
1663   confline(op, "HOURREPCOLS", HOURREPCOLS, NULL, -1);
1664   confline(op, "HOURSUMCOLS", HOURSUMCOLS, NULL, -1);
1665   confline(op, "WEEKHOURCOLS", WEEKHOURCOLS, NULL, -1);
1666   confline(op, "QUARTERREPCOLS", QUARTERREPCOLS, NULL, -1);
1667   confline(op, "QUARTERSUMCOLS", QUARTERSUMCOLS, NULL, -1);
1668   confline(op, "FIVEREPCOLS", FIVEREPCOLS, NULL, -1);
1669   confline(op, "FIVESUMCOLS", FIVESUMCOLS, NULL, -1);
1670   confline(op, "REQCOLS", REQCOLS, NULL, -1);
1671   confline(op, "REDIRCOLS", REDIRCOLS, NULL, -1);
1672   confline(op, "FAILCOLS", FAILCOLS, NULL, -1);
1673   confline(op, "TYPECOLS", TYPECOLS, NULL, -1);
1674   confline(op, "SIZECOLS", SIZECOLS, NULL, -1);
1675   confline(op, "PROCTIMECOLS", PROCTIMECOLS, NULL, -1);
1676   confline(op, "DIRCOLS", DIRCOLS, NULL, -1);
1677   confline(op, "HOSTCOLS", HOSTCOLS, NULL, -1);
1678   confline(op, "REDIRHOSTCOLS", REDIRHOSTCOLS, NULL, -1);
1679   confline(op, "FAILHOSTCOLS", FAILHOSTCOLS, NULL, -1);
1680   confline(op, "DOMCOLS", DOMCOLS, NULL, -1);
1681   confline(op, "ORGCOLS", ORGCOLS, NULL, -1);
1682   confline(op, "REFCOLS", REFCOLS, NULL, -1);
1683   confline(op, "REFSITECOLS", REFSITECOLS, NULL, -1);
1684   confline(op, "REDIRREFCOLS", REDIRREFCOLS, NULL, -1);
1685   confline(op, "FAILREFCOLS", FAILREFCOLS, NULL, -1);
1686   confline(op, "BROWREPCOLS", BROWREPCOLS, NULL, -1);
1687   confline(op, "BROWSUMCOLS", BROWSUMCOLS, NULL, -1);
1688   confline(op, "OSCOLS", OSCOLS, NULL, -1);
1689   confline(op, "VHOSTCOLS", VHOSTCOLS, NULL, -1);
1690   confline(op, "REDIRVHOSTCOLS", REDIRVHOSTCOLS, NULL, -1);
1691   confline(op, "FAILVHOSTCOLS", FAILVHOSTCOLS, NULL, -1);
1692   confline(op, "USERCOLS", USERCOLS, NULL, -1);
1693   confline(op, "REDIRUSERCOLS", REDIRUSERCOLS, NULL, -1);
1694   confline(op, "FAILUSERCOLS", FAILUSERCOLS, NULL, -1);
1695   confline(op, "SEARCHQUERYCOLS", SEARCHQUERYCOLS, NULL, -1);
1696   confline(op, "SEARCHWORDCOLS", SEARCHWORDCOLS, NULL, -1);
1697   confline(op, "INTSEARCHQUERYCOLS", INTSEARCHQUERYCOLS, NULL, -1);
1698   confline(op, "INTSEARCHWORDCOLS", INTSEARCHWORDCOLS, NULL, -1);
1699   confline(op, "STATUSCOLS", STATUSCOLS, NULL, -1);
1700   op->outopts.repq[REP_YEAR] = YEARLY;
1701   op->outopts.repq[REP_QUARTERLY] = QUARTERLY;
1702   op->outopts.repq[REP_MONTH] = MONTHLY;
1703   op->outopts.repq[REP_WEEK] = WEEKLY;
1704   op->outopts.repq[REP_DAYREP] = DAILYREP;
1705   op->outopts.repq[REP_DAYSUM] = DAILYSUM;
1706   op->outopts.repq[REP_HOURREP] = HOURLYREP;
1707   op->outopts.repq[REP_HOURSUM] = HOURLYSUM;
1708   op->outopts.repq[REP_WEEKHOUR] = WEEKHOUR;
1709   op->outopts.repq[REP_QUARTERREP] = QUARTERREP;
1710   op->outopts.repq[REP_QUARTERSUM] = QUARTERSUM;
1711   op->outopts.repq[REP_FIVEREP] = FIVEREP;
1712   op->outopts.repq[REP_FIVESUM] = FIVESUM;
1713   op->outopts.repq[REP_GENSUM] = GENERAL;
1714   op->outopts.repq[REP_REQ] = REQUEST;
1715   op->outopts.repq[REP_REDIR] = REDIRREP;
1716   op->outopts.repq[REP_FAIL] = FAILREP;
1717   op->outopts.repq[REP_TYPE] = FILETYPE;
1718   op->outopts.repq[REP_SIZE] = SIZEREP;
1719   op->outopts.repq[REP_PROCTIME] = PROCTIME;
1720   op->outopts.repq[REP_DIR] = DIRECTORY;
1721   op->outopts.repq[REP_HOST] = HOST;
1722   op->outopts.repq[REP_REDIRHOST] = REDIRHOST;
1723   op->outopts.repq[REP_FAILHOST] = FAILHOST;
1724   op->outopts.repq[REP_DOM] = DOMAINREP;
1725   op->outopts.repq[REP_ORG] = ORGANISATION;
1726   op->outopts.repq[REP_REF] = REFERRER;
1727   op->outopts.repq[REP_REFSITE] = REFSITE;
1728   op->outopts.repq[REP_REDIRREF] = REDIRREF;
1729   op->outopts.repq[REP_FAILREF] = FAILREF;
1730   op->outopts.repq[REP_BROWREP] = BROWSERREP;
1731   op->outopts.repq[REP_BROWSUM] = BROWSERSUM;
1732   op->outopts.repq[REP_OS] = OSREP;
1733   op->outopts.repq[REP_VHOST] = VHOST;
1734   op->outopts.repq[REP_REDIRVHOST] = REDIRVHOST;
1735   op->outopts.repq[REP_FAILVHOST] = FAILVHOST;
1736   op->outopts.repq[REP_USER] = USER;
1737   op->outopts.repq[REP_REDIRUSER] = REDIRUSER;
1738   op->outopts.repq[REP_FAILUSER] = FAILUSER;
1739   op->outopts.repq[REP_SEARCHREP] = SEARCHQUERY;
1740   op->outopts.repq[REP_SEARCHSUM] = SEARCHWORD;
1741   op->outopts.repq[REP_INTSEARCHREP] = INTSEARCHQUERY;
1742   op->outopts.repq[REP_INTSEARCHSUM] = INTSEARCHWORD;
1743   op->outopts.repq[REP_CODE] = STATUS;
1744   op->outopts.last7 = LASTSEVEN;
1745   op->outopts.runtime = RUNTIME;
1746   op->outopts.gotos = GOTOS;
1747   op->outopts.repspan = REPORTSPAN;
1748   op->outopts.rsthresh = REPORTSPANTHRESHOLD;
1749   op->outopts.descriptions = DESCRIPTIONS;
1750   op->outopts.lang.code = LANGUAGE;
1751   op->outopts.lang.file = NULL;
1752   op->outopts.graph[REP_YEAR] = YEARGRAPH;
1753   op->outopts.graph[REP_QUARTERLY] = QUARTERLYGRAPH;
1754   op->outopts.graph[REP_MONTH] = MONTHGRAPH;
1755   op->outopts.graph[REP_WEEK] = WEEKGRAPH;
1756   op->outopts.graph[REP_DAYREP] = DAYREPGRAPH;
1757   op->outopts.graph[REP_DAYSUM] = DAYSUMGRAPH;
1758   op->outopts.graph[REP_HOURREP] = HOURREPGRAPH;
1759   op->outopts.graph[REP_HOURSUM] = HOURSUMGRAPH;
1760   op->outopts.graph[REP_WEEKHOUR] = WEEKHOURGRAPH;
1761   op->outopts.graph[REP_QUARTERREP] = QUARTERREPGRAPH;
1762   op->outopts.graph[REP_QUARTERSUM] = QUARTERSUMGRAPH;
1763   op->outopts.graph[REP_FIVEREP] = FIVEREPGRAPH;
1764   op->outopts.graph[REP_FIVESUM] = FIVESUMGRAPH;
1765   op->outopts.back[REP_YEAR] = YEARBACK;
1766   op->outopts.back[REP_QUARTERLY] = QUARTERLYBACK;
1767   op->outopts.back[REP_MONTH] = MONTHBACK;
1768   op->outopts.back[REP_WEEK] = WEEKBACK;
1769   op->outopts.back[REP_DAYREP] = DAYBACK;
1770   op->outopts.back[REP_HOURREP] = HOURBACK;
1771   op->outopts.back[REP_QUARTERREP] = QUARTERBACK;
1772   op->outopts.back[REP_FIVEREP] = FIVEBACK;
1773   op->outopts.rows[REP_YEAR] = YEARROWS;
1774   op->outopts.rows[REP_QUARTERLY] = QUARTERLYROWS;
1775   op->outopts.rows[REP_MONTH] = MONTHROWS;
1776   op->outopts.rows[REP_WEEK] = WEEKROWS;
1777   op->outopts.rows[REP_DAYREP] = DAYROWS;
1778   op->outopts.rows[REP_HOURREP] = HOURROWS;
1779   op->outopts.rows[REP_QUARTERREP] = QUARTERROWS;
1780   op->outopts.rows[REP_FIVEREP] = FIVEROWS;
1781 #ifndef NOGRAPHICS
1782   op->outopts.chartby[G(REP_REQ)] = REQCHART;
1783   op->outopts.chartby[G(REP_REDIR)] = REDIRCHART;
1784   op->outopts.chartby[G(REP_FAIL)] = FAILCHART;
1785   op->outopts.chartby[G(REP_TYPE)] = TYPECHART;
1786   op->outopts.chartby[G(REP_DIR)] = DIRCHART;
1787   op->outopts.chartby[G(REP_HOST)] = HOSTCHART;
1788   op->outopts.chartby[G(REP_REDIRHOST)] = REDIRHOSTCHART;
1789   op->outopts.chartby[G(REP_FAILHOST)] = FAILHOSTCHART;
1790   op->outopts.chartby[G(REP_DOM)] = DOMCHART;
1791   op->outopts.chartby[G(REP_REF)] = REFCHART;
1792   op->outopts.chartby[G(REP_REFSITE)] = REFSITECHART;
1793   op->outopts.chartby[G(REP_REDIRREF)] = REDIRREFCHART;
1794   op->outopts.chartby[G(REP_FAILREF)] = FAILREFCHART;
1795   op->outopts.chartby[G(REP_BROWREP)] = BROWREPCHART;
1796   op->outopts.chartby[G(REP_VHOST)] = VHOSTCHART;
1797   op->outopts.chartby[G(REP_REDIRVHOST)] = REDIRVHOSTCHART;
1798   op->outopts.chartby[G(REP_FAILVHOST)] = FAILVHOSTCHART;
1799   op->outopts.chartby[G(REP_USER)] = USERCHART;
1800   op->outopts.chartby[G(REP_REDIRUSER)] = REDIRUSERCHART;
1801   op->outopts.chartby[G(REP_FAILUSER)] = FAILUSERCHART;
1802   op->outopts.chartby[G(REP_ORG)] = ORGCHART;
1803   op->outopts.chartby[G(REP_SEARCHREP)] = SEARCHQUERYCHART;
1804   op->outopts.chartby[G(REP_SEARCHSUM)] = SEARCHWORDCHART;
1805   op->outopts.chartby[G(REP_INTSEARCHREP)] = INTSEARCHQUERYCHART;
1806   op->outopts.chartby[G(REP_INTSEARCHSUM)] = INTSEARCHWORDCHART;
1807   op->outopts.chartby[G(REP_BROWSUM)] = BROWSUMCHART;
1808   op->outopts.chartby[G(REP_OS)] = OSCHART;
1809   op->outopts.chartby[G(REP_SIZE)] = SIZECHART;
1810   op->outopts.chartby[G(REP_CODE)] = STATUSCHART;
1811   op->outopts.chartby[G(REP_PROCTIME)] = PROCTIMECHART;
1812 #else
1813   for (i = 0; i < GENREP_NUMBER; i++)
1814     op->outopts.chartby[i] = CHART_NONE;/* to avoid recording spurious stuff */
1815 #endif  /* NOGRAPHICS */
1816   for (i = 0; i < GENREP_NUMBER; i++) {
1817     /* initialise all SUBSORTBYs to UNSET. Then we can use this later as a test
1818        for whether the report is a hierarchical report. Also set all SUBFLOOR
1819        methods to UNSET so that we don't count any unneeded data by mistake. */
1820     op->outopts.subsortby[i] = UNSET;
1821     op->outopts.subfloor[i].floorby = UNSET;
1822   }
1823   op->outopts.sortby[G(REP_REQ)] = REQSORTBY;
1824   op->outopts.subsortby[G(REP_REQ)] = REQSORTBY;
1825   op->outopts.sortby[G(REP_REDIR)] = REDIRSORTBY;
1826   op->outopts.subsortby[G(REP_REDIR)] = REDIRSORTBY;
1827   op->outopts.sortby[G(REP_FAIL)] = FAILSORTBY;
1828   op->outopts.subsortby[G(REP_FAIL)] = FAILSORTBY;
1829   op->outopts.sortby[G(REP_TYPE)] = TYPESORTBY;
1830   op->outopts.subsortby[G(REP_TYPE)] = TYPESORTBY;
1831   op->outopts.sortby[G(REP_DIR)] = DIRSORTBY;
1832   op->outopts.subsortby[G(REP_DIR)] = DIRSORTBY;
1833   op->outopts.sortby[G(REP_HOST)] = HOSTSORTBY;
1834   op->outopts.sortby[G(REP_REDIRHOST)] = REDIRHOSTSORTBY;
1835   op->outopts.sortby[G(REP_FAILHOST)] = FAILHOSTSORTBY;
1836   op->outopts.sortby[G(REP_DOM)] = DOMSORTBY;
1837   op->outopts.subsortby[G(REP_DOM)] = DOMSORTBY;
1838   op->outopts.sortby[G(REP_ORG)] = ORGSORTBY;
1839   op->outopts.subsortby[G(REP_ORG)] = ORGSORTBY;
1840   op->outopts.sortby[G(REP_REF)] = REFSORTBY;
1841   op->outopts.subsortby[G(REP_REF)] = REFSORTBY;
1842   op->outopts.sortby[G(REP_REFSITE)] = REFSITESORTBY;
1843   op->outopts.subsortby[G(REP_REFSITE)] = REFSITESORTBY;
1844   op->outopts.sortby[G(REP_REDIRREF)] = REDIRREFSORTBY;
1845   op->outopts.subsortby[G(REP_REDIRREF)] = REDIRREFSORTBY;
1846   op->outopts.sortby[G(REP_FAILREF)] = FAILREFSORTBY;
1847   op->outopts.subsortby[G(REP_FAILREF)] = FAILREFSORTBY;
1848   op->outopts.sortby[G(REP_BROWREP)] = BROWREPSORTBY;
1849   op->outopts.sortby[G(REP_BROWSUM)] = BROWSUMSORTBY;
1850   op->outopts.subsortby[G(REP_BROWSUM)] = BROWSUMSORTBY;
1851   op->outopts.sortby[G(REP_OS)] = OSSORTBY;
1852   op->outopts.subsortby[G(REP_OS)] = OSSORTBY;
1853   op->outopts.sortby[G(REP_VHOST)] = VHOSTSORTBY;
1854   op->outopts.sortby[G(REP_REDIRVHOST)] = REDIRVHOSTSORTBY;
1855   op->outopts.sortby[G(REP_FAILVHOST)] = FAILVHOSTSORTBY;
1856   op->outopts.sortby[G(REP_USER)] = USERSORTBY;
1857   op->outopts.sortby[G(REP_REDIRUSER)] = REDIRUSERSORTBY;
1858   op->outopts.sortby[G(REP_FAILUSER)] = FAILUSERSORTBY;
1859   op->outopts.sortby[G(REP_SEARCHREP)] = SEARCHQUERYSORTBY;
1860   op->outopts.sortby[G(REP_SEARCHSUM)] = SEARCHWORDSORTBY;
1861   op->outopts.sortby[G(REP_INTSEARCHREP)] = INTSEARCHQUERYSORTBY;
1862   op->outopts.sortby[G(REP_INTSEARCHSUM)] = INTSEARCHWORDSORTBY;
1863   op->outopts.sortby[G(REP_CODE)] = STATUSSORTBY;
1864   op->outopts.sortby[G(REP_SIZE)] = ALPHABETICAL;
1865   op->outopts.sortby[G(REP_PROCTIME)] = ALPHABETICAL;
1866   confline(op, "REQFLOOR", REQFLOOR, NULL, -1);
1867   confline(op, "REQARGSFLOOR", REQARGSFLOOR, NULL, -1);
1868   confline(op, "REDIRFLOOR", REDIRFLOOR, NULL, -1);
1869   confline(op, "REDIRARGSFLOOR", REDIRARGSFLOOR, NULL, -1);
1870   confline(op, "FAILFLOOR", FAILFLOOR, NULL, -1);
1871   confline(op, "FAILARGSFLOOR", FAILARGSFLOOR, NULL, -1);
1872   confline(op, "TYPEFLOOR", TYPEFLOOR, NULL, -1);
1873   confline(op, "SUBTYPEFLOOR", SUBTYPEFLOOR, NULL, -1);
1874   confline(op, "DIRFLOOR", DIRFLOOR, NULL, -1);
1875   confline(op, "SUBDIRFLOOR", SUBDIRFLOOR, NULL, -1);
1876   confline(op, "HOSTFLOOR", HOSTFLOOR, NULL, -1);
1877   confline(op, "REDIRHOSTFLOOR", REDIRHOSTFLOOR, NULL, -1);
1878   confline(op, "FAILHOSTFLOOR", FAILHOSTFLOOR, NULL, -1);
1879   confline(op, "DOMFLOOR", DOMFLOOR, NULL, -1);
1880   confline(op, "SUBDOMFLOOR", SUBDOMFLOOR, NULL, -1);
1881   confline(op, "ORGFLOOR", ORGFLOOR, NULL, -1);
1882   confline(op, "SUBORGFLOOR", SUBORGFLOOR, NULL, -1);
1883   confline(op, "REFFLOOR", REFFLOOR, NULL, -1);
1884   confline(op, "REFARGSFLOOR", REFARGSFLOOR, NULL, -1);
1885   confline(op, "REFSITEFLOOR", REFSITEFLOOR, NULL, -1);
1886   confline(op, "REFDIRFLOOR", REFDIRFLOOR, NULL, -1);
1887   confline(op, "REDIRREFFLOOR", REDIRREFFLOOR, NULL, -1);
1888   confline(op, "REDIRREFARGSFLOOR", REDIRREFARGSFLOOR, NULL, -1);
1889   confline(op, "FAILREFFLOOR", FAILREFFLOOR, NULL, -1);
1890   confline(op, "FAILREFARGSFLOOR", FAILREFARGSFLOOR, NULL, -1);
1891   confline(op, "BROWREPFLOOR", BROWREPFLOOR, NULL, -1);
1892   confline(op, "BROWSUMFLOOR", BROWSUMFLOOR, NULL, -1);
1893   confline(op, "SUBBROWFLOOR", SUBBROWFLOOR, NULL, -1);
1894   confline(op, "OSFLOOR", OSFLOOR, NULL, -1);
1895   confline(op, "SUBOSFLOOR", SUBOSFLOOR, NULL, -1);
1896   confline(op, "VHOSTFLOOR", VHOSTFLOOR, NULL, -1);
1897   confline(op, "REDIRVHOSTFLOOR", REDIRVHOSTFLOOR, NULL, -1);
1898   confline(op, "FAILVHOSTFLOOR", FAILVHOSTFLOOR, NULL, -1);
1899   confline(op, "USERFLOOR", USERFLOOR, NULL, -1);
1900   confline(op, "REDIRUSERFLOOR", REDIRUSERFLOOR, NULL, -1);
1901   confline(op, "FAILUSERFLOOR", FAILUSERFLOOR, NULL, -1);
1902   confline(op, "SEARCHQUERYFLOOR", SEARCHQUERYFLOOR, NULL, -1);
1903   confline(op, "SEARCHWORDFLOOR", SEARCHWORDFLOOR, NULL, -1);
1904   confline(op, "INTSEARCHQUERYFLOOR", INTSEARCHQUERYFLOOR, NULL, -1);
1905   confline(op, "INTSEARCHWORDFLOOR", INTSEARCHWORDFLOOR, NULL, -1);
1906   confline(op, "STATUSFLOOR", STATUSFLOOR, NULL, -1);
1907   confline(op, "REPORTORDER", REPORTORDER, NULL, -1);
1908   op->outopts.barstyle = BARSTYLE;
1909   op->outopts.markchar = MARKCHAR;
1910   op->outopts.rawbytes = RAWBYTES;
1911   op->outopts.bytesdp = BYTESDP;
1912   op->outopts.norobots = NOROBOTS;
1913   COPYSTR(op->outopts.hostname, HOSTNAME);
1914   COPYSTR(op->outopts.hosturl, HOSTURL);
1915   op->outopts.baseurl = NULL;
1916   COPYSTR(op->outopts.logo, LOGO);
1917   COPYSTR(op->outopts.logourl, LOGOURL);
1918   COPYSTR(op->outopts.stylesheet, STYLESHEET);
1919   COPYSTR(op->outopts.cssprefix, CSSPREFIX);
1920   op->outopts.weekbeginson = WEEKBEGINSON;
1921   op->outopts.plainpagewidth = PLAINPAGEWIDTH;
1922   op->outopts.htmlpagewidth = HTMLPAGEWIDTH;
1923   op->outopts.latexpagewidth = LATEXPAGEWIDTH;
1924   op->outopts.mingraphwidth = MINGRAPHWIDTH;
1925   op->outopts.sepchar = (char)UNSET;
1926   op->outopts.repsepchar = (char)UNSET;
1927   op->outopts.decpt = (char)UNSET;
1928   COPYSTR(op->outopts.compsep, COMPSEP);
1929   for (i = 0; i < GENREP_NUMBER; i++) {
1930     op->outopts.link[i] = NULL;
1931     op->outopts.wanthead[i] = NULL;
1932     op->outopts.aliashead[i] = NULL;
1933     op->outopts.expandhead[i] = NULL;
1934     op->outopts.tree[i] = (Tree *)xmalloc(sizeof(Tree));
1935     op->outopts.tree[i]->tree = NULL;
1936     op->outopts.tree[i]->space = (Memman *)xmalloc(sizeof(Memman));
1937     op->outopts.tree[i]->space->curr_pos = NULL;
1938     op->outopts.tree[i]->space->first = NULL;
1939     op->outopts.tree[i]->space->alignment = ALIGNSIZE;
1940   }
1941   domlevels = (Strpairlist **)xmalloc(DOMLEVEL_NUMBER * sizeof(Strpairlist *));
1942   for (i = 0; i < DOMLEVEL_NUMBER; i++)
1943     domlevels[i] = NULL;
1944   op->outopts.tree[G(REP_REQ)]->cutfn = &rnextname;
1945   op->outopts.tree[G(REP_REDIR)]->cutfn = &rnextname;
1946   op->outopts.tree[G(REP_FAIL)]->cutfn = &rnextname;
1947   op->outopts.tree[G(REP_REF)]->cutfn = &rnextname;
1948   op->outopts.tree[G(REP_REDIRREF)]->cutfn = &rnextname;
1949   op->outopts.tree[G(REP_FAILREF)]->cutfn = &rnextname;
1950   op->outopts.tree[G(REP_TYPE)]->cutfn = &tnextname;
1951   op->outopts.tree[G(REP_DIR)]->cutfn = &inextname;
1952   op->outopts.tree[G(REP_DOM)]->cutfn = &onextname;
1953   op->outopts.tree[G(REP_REFSITE)]->cutfn = &snextname;
1954   op->outopts.tree[G(REP_BROWSUM)]->cutfn = &bnextname;
1955   op->outopts.tree[G(REP_OS)]->cutfn = &pnextname;
1956   op->outopts.tree[G(REP_ORG)]->cutfn = &Znextname;
1957   for (i = 0; i < DERVREP_NUMBER; i++) {
1958     op->outopts.derv[i] = (Derv *)xmalloc(sizeof(Derv));
1959     op->outopts.derv[i]->table = rehash(NULL, HASHSIZE, NULL);
1960     op->outopts.derv[i]->space = (Memman *)xmalloc(sizeof(Memman));
1961     op->outopts.derv[i]->space->curr_pos = NULL;
1962     op->outopts.derv[i]->space->first = NULL;
1963     op->outopts.derv[i]->space->alignment = 1;
1964   }
1965   op->outopts.derv[REP_SEARCHREP - FIRST_DERVREP]->cutfn = &Nnextname;
1966   op->outopts.derv[REP_SEARCHSUM - FIRST_DERVREP]->cutfn = &nnextname;
1967   op->outopts.derv[REP_INTSEARCHREP - FIRST_DERVREP]->cutfn = &Nnextname;
1968   op->outopts.derv[REP_INTSEARCHSUM - FIRST_DERVREP]->cutfn = &nnextname;
1969   op->outopts.derv[REP_BROWSUM - FIRST_DERVREP]->cutfn = &Bnextname;
1970   op->outopts.derv[REP_OS - FIRST_DERVREP]->cutfn = &Pnextname;
1971   /* derv[*]->arg is set in finalinit so that lists of search engines and
1972      robots have already been read in */
1973   op->outopts.suborgs = NULL;
1974   for (i = 0; i < LOGDATA_NUMBER; i++)
1975     op->miscopts.data[i] = 0;
1976   op->miscopts.bytes = 0.0;
1977   op->miscopts.bytes7 = 0.0;
1978   confline(op, "REQARGS", "*?*", NULL, -1);
1979   confline(op, "REDIRARGS", "*?*", NULL, -1);
1980   confline(op, "FAILARGS", "*?*", NULL, -1);
1981   confline(op, "REFARGS", "*?*", NULL, -1);
1982   confline(op, "REDIRREFARGS", "*?*", NULL, -1);
1983   confline(op, "FAILREFARGS", "*?*", NULL, -1);
1984   confline(op, "SUBDOMAIN", "*", NULL, -1);
1985   confline(op, "SUBORG2", "*", NULL, -1);
1986   confline(op, "SUBDIR", "*", NULL, -1);
1987   confline(op, "SUBTYPE", "*", NULL, -1);
1988   confline(op, "REFDIR", "*", NULL, -1);
1989   confline(op, "SUBBROW", "*", NULL, -1);
1990   confline(op, "SUBOS", "*:*", NULL, -1);
1991   for (i = 0; i < ITEM_NUMBER; i++) {
1992     op->wanthead[i] = NULL;
1993     op->aliashead[i] = NULL;
1994     op->hash[i] = rehash(NULL, HASHSIZE, NULL);
1995     op->miscopts.lowmem[i] = 0;
1996   }
1997   for (i = 0; i < MIN_SC; i++)
1998     op->code2type[i] = UNWANTED;
1999   for ( ; i < SC_NUMBER; i++)
2000     op->code2type[i] = UNSET;
2001   op->code2type[0] = UNSET;  /* code2type[0] used as a special marker in ... */
2002   op->succ304 = TRUE;    /* ... configsinex(), correctlogfmt() & finalinit() */
2003   for (i = 0; i < ARRAYREP_NUMBER; i++) {
2004     if (i == REP_CODE - FIRST_ARRAYREP)
2005       thresh = codethresh;
2006     else if (i == REP_SIZE - FIRST_ARRAYREP)
2007       thresh = sizethresh;
2008     else
2009       thresh = ptthresh;
2010     for (k = 0; thresh[k] > -0.5; k++)
2011       ;  /* find size of array */
2012     k++;
2013     op->arraydata[i] = (Arraydata *)xmalloc(k * sizeof(Arraydata));
2014     for (j = 0; j < k; j++) {
2015       op->arraydata[i][j].threshold = thresh[j];
2016       op->arraydata[i][j].reqs = 0;
2017       op->arraydata[i][j].pages = 0;
2018       op->arraydata[i][j].bytes = 0.0;
2019       op->arraydata[i][j].reqs7 = 0;
2020       op->arraydata[i][j].pages7 = 0;
2021       op->arraydata[i][j].bytes7 = 0.0;
2022       op->arraydata[i][j].lastdate = 0;
2023       op->arraydata[i][j].firstdate = LAST_TIME;
2024     }
2025   }
2026   op->searchengines = NULL;
2027   op->intsearchengines = NULL;
2028   op->robots = NULL;
2029   op->ispagehead = NULL;
2030   op->argshead = NULL;
2031   op->refargshead = NULL;
2032   confline(op, "PAGEINCLUDE", "*/", NULL, -1);
2033   confline(op, "PAGEINCLUDE", "REGEXPI:\\.html?$", NULL, -1);
2034   op->dman.fromstr = NULL;
2035   op->dman.tostr = NULL;
2036   op->dman.currdp = NULL;
2037   op->dman.firstdp = NULL;
2038   op->dman.lastdp = NULL;
2039   op->dman.firsttime = LAST_TIME;
2040   op->dman.lasttime = FIRST_TIME;
2041 }
2042