|
a/src/index/recollindex.cpp |
|
b/src/index/recollindex.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.23 2006-10-16 15:33:08 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.24 2006-10-17 14:41:59 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
171 |
"recollindex [-h] \n"
|
171 |
"recollindex [-h] \n"
|
172 |
" Print help\n"
|
172 |
" Print help\n"
|
173 |
"recollindex [-z] \n"
|
173 |
"recollindex [-z] \n"
|
174 |
" Index everything according to configuration file\n"
|
174 |
" Index everything according to configuration file\n"
|
175 |
" -z : reset database before starting indexation\n"
|
175 |
" -z : reset database before starting indexation\n"
|
|
|
176 |
#ifdef RCL_MONITOR
|
176 |
"recollindex -m [-D]\n"
|
177 |
"recollindex -m [-D]\n"
|
177 |
" Perform real time indexation. Don't become a daemon if -D is set\n"
|
178 |
" Perform real time indexation. Don't become a daemon if -D is set\n"
|
|
|
179 |
#endif
|
178 |
"recollindex -i <filename [filename ...]>\n"
|
180 |
"recollindex -i <filename [filename ...]>\n"
|
179 |
" Index individual files. No database purge or stem database updates\n"
|
181 |
" Index individual files. No database purge or stem database updates\n"
|
180 |
"recollindex -s <lang>\n"
|
182 |
"recollindex -s <lang>\n"
|
181 |
" Build stem database for additional language <lang>\n"
|
183 |
" Build stem database for additional language <lang>\n"
|
182 |
#ifdef RCL_USE_ASPELL
|
184 |
#ifdef RCL_USE_ASPELL
|
|
... |
|
... |
208 |
while (**argv)
|
210 |
while (**argv)
|
209 |
switch (*(*argv)++) {
|
211 |
switch (*(*argv)++) {
|
210 |
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
|
212 |
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
|
211 |
a_config = *(++argv);
|
213 |
a_config = *(++argv);
|
212 |
argc--; goto b1;
|
214 |
argc--; goto b1;
|
|
|
215 |
#ifdef RCL_MONITOR
|
213 |
case 'D': op_flags |= OPT_D; break;
|
216 |
case 'D': op_flags |= OPT_D; break;
|
|
|
217 |
#endif
|
214 |
case 'h': op_flags |= OPT_h; break;
|
218 |
case 'h': op_flags |= OPT_h; break;
|
215 |
case 'i': op_flags |= OPT_i; break;
|
219 |
case 'i': op_flags |= OPT_i; break;
|
|
|
220 |
#ifdef RCL_MONITOR
|
216 |
case 'm': op_flags |= OPT_m; break;
|
221 |
case 'm': op_flags |= OPT_m; break;
|
|
|
222 |
#endif
|
217 |
case 's': op_flags |= OPT_s; break;
|
223 |
case 's': op_flags |= OPT_s; break;
|
218 |
#ifdef RCL_USE_ASPELL
|
224 |
#ifdef RCL_USE_ASPELL
|
219 |
case 'S': op_flags |= OPT_S; break;
|
225 |
case 'S': op_flags |= OPT_S; break;
|
220 |
#endif
|
226 |
#endif
|
221 |
case 'z': op_flags |= OPT_z; break;
|
227 |
case 'z': op_flags |= OPT_z; break;
|
|
... |
|
... |
254 |
} else if (op_flags & OPT_s) {
|
260 |
} else if (op_flags & OPT_s) {
|
255 |
if (argc != 1)
|
261 |
if (argc != 1)
|
256 |
Usage();
|
262 |
Usage();
|
257 |
string lang = *argv++; argc--;
|
263 |
string lang = *argv++; argc--;
|
258 |
exit(!createstemdb(config, lang));
|
264 |
exit(!createstemdb(config, lang));
|
|
|
265 |
|
|
|
266 |
#ifdef RCL_MONITOR
|
259 |
} else if (op_flags & OPT_m) {
|
267 |
} else if (op_flags & OPT_m) {
|
260 |
if (argc != 0)
|
268 |
if (argc != 0)
|
261 |
Usage();
|
269 |
Usage();
|
262 |
if (!(op_flags&OPT_D)) {
|
270 |
if (!(op_flags&OPT_D)) {
|
263 |
LOGDEB(("Daemonizing\n"));
|
271 |
LOGDEB(("Daemonizing\n"));
|
264 |
daemon(0,0);
|
272 |
daemon(0,0);
|
265 |
}
|
273 |
}
|
266 |
if (startMonitor(config, (op_flags&OPT_D)!=0))
|
274 |
if (startMonitor(config, (op_flags&OPT_D)!=0))
|
267 |
exit(0);
|
275 |
exit(0);
|
268 |
exit(1);
|
276 |
exit(1);
|
|
|
277 |
#endif // MONITOR
|
|
|
278 |
|
269 |
#ifdef RCL_USE_ASPELL
|
279 |
#ifdef RCL_USE_ASPELL
|
270 |
} else if (op_flags & OPT_S) {
|
280 |
} else if (op_flags & OPT_S) {
|
271 |
makeDbIndexer(config);
|
281 |
makeDbIndexer(config);
|
272 |
if (dbindexer)
|
282 |
if (dbindexer)
|
273 |
exit(!dbindexer->createAspellDict());
|
283 |
exit(!dbindexer->createAspellDict());
|
274 |
else
|
284 |
else
|
275 |
exit(1);
|
285 |
exit(1);
|
276 |
#endif
|
286 |
#endif // ASPELL
|
|
|
287 |
|
277 |
} else {
|
288 |
} else {
|
278 |
confindexer = new ConfIndexer(config, &updater);
|
289 |
confindexer = new ConfIndexer(config, &updater);
|
279 |
bool rezero(op_flags & OPT_z);
|
290 |
bool rezero(op_flags & OPT_z);
|
280 |
exit(!confindexer->index(rezero));
|
291 |
exit(!confindexer->index(rezero));
|
281 |
}
|
292 |
}
|