File: search.h

package info (click to toggle)
swish++ 6.1.5-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,256 kB
  • ctags: 1,759
  • sloc: ansic: 11,931; lisp: 804; sh: 629; perl: 366; makefile: 80
file content (108 lines) | stat: -rw-r--r-- 3,112 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
**	SWISH++
**	search.h
**
**	Copyright (C) 1998  Paul J. Lucas
**
**	This program is free software; you can redistribute it and/or modify
**	it under the terms of the GNU General Public License as published by
**	the Free Software Foundation; either version 2 of the License, or
**	(at your option) any later version.
**
**	This program is distributed in the hope that it will be useful,
**	but WITHOUT ANY WARRANTY; without even the implied warranty of
**	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**	GNU General Public License for more details.
**
**	You should have received a copy of the GNU General Public License
**	along with this program; if not, write to the Free Software
**	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef	search_H
#define	search_H

// standard
#include <iostream>

// local
#include "option_stream.h"

//*****************************************************************************
//
// SYNOPSIS
//
	struct search_options
//
// DESCRIPTION
//
//	A search_options is the set of command-line options to the "search"
//	executable.  These are all packaged into a structure because, in
//	addition to parsing command-line options initially, "search," if run as
//	a daemon, needs to parse "command-line" options per request via a
//	socket.  The options are therefore packaged together into an object so
//	each thread can have its own set of options, i.e., be thread-safe.
//
//	Structure member names are such that those that end in "_arg" are the
//	value of the argument of the option (which implies that the option was
//	given) and those that end in "_opt" are Boolean options and, if true,
//	mean that the option was given.
//
//*****************************************************************************
{
	char const*	config_file_name_arg;
	bool		dump_entire_index_opt;
	int		dump_match_arg;
	bool		dump_meta_names_opt;
	bool		dump_stop_words_opt;
	int		dump_window_size_arg;
	bool		dump_word_index_opt;
	char const*	index_file_name_arg;
	char const*	max_results_arg;
	char const*	results_format_arg;
	char const*	result_separator_arg;
	int		skip_results_arg;
	bool		stem_words_opt;
	char const*	word_files_max_arg;
	char const*	word_percent_max_arg;
#ifdef	FEATURE_word_pos
	int		words_near_arg;
#endif
#ifdef	SEARCH_DAEMON
	char const*	daemon_type_arg;
	char const*	group_arg;
#ifdef	__APPLE__
	bool		launchd_opt;
#endif
	int		max_threads_arg;
	int		min_threads_arg;
	char const*	pid_file_name_arg;
	bool		search_background_opt;
	char const*	socket_address_arg;
	char const*	socket_file_name_arg;
	int		socket_queue_size_arg;
	int		socket_timeout_arg;
	int		thread_timeout_arg;
	char const*	user_arg;
#endif	/* SEARCH_DAEMON */
	search_options(
		int *argc, char ***argv,
		PJL::option_stream::spec const[],
		std::ostream& = std::cerr
	);

	operator bool() const			{ return !bad_; }
private:
	bool	bad_;
};

bool		service_request(
			char *argv[],
			search_options const&,
			std::ostream& = std::cout, std::ostream& = std::cerr
		);

std::ostream&	usage( std::ostream& );

#endif	/* search_H */
/* vim:set noet sw=8 ts=8: */