]>
jfr.im git - irc/thales.git/blob - src/conf.h
1 /* Thales - IRC to Relational Database Gateway
2 * Copyright (C) 2002 Lucas Nussbaum <lucas@lucas-nussbaum.net>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 /* Configuration file handling. */
25 /* Configuration directives. */
26 #define THALES_CONF "thales.conf"
34 int type
; /* PARAM_* below */
36 void *ptr
; /* Pointer to where to store the value */
44 #define PARAM_POSINT 2 /* Positive integer only */
45 #define PARAM_PORT 3 /* 1..65535 only */
46 #define PARAM_STRING 4
48 #define PARAM_STRING_ARRAY 6 /* Array of string */
49 #define PARAM_SET -1 /* Not a real parameter; just set the
50 * * given integer variable to 1 */
51 #define PARAM_DEPRECATED -2 /* Set for deprecated directives; `ptr'
52 * * is a function pointer to call */
55 #define PARAM_OPTIONAL 0x01
56 #define PARAM_FULLONLY 0x02 /* Directive only allowed if !STREAMLINED */
57 #define PARAM_RELOAD 0x04 /* Directive is reloadable */
59 /* Print an error message to the log (and the console, if open). */
60 void error(int linenum
, char *message
, ...);
62 /* Parse a configuration line. Return 1 on success; otherwise, print an
63 * appropriate error message and return 0. Destroys the buffer by side
67 int parse(char *buf
, int linenum
, int reload
);
69 /* Read the entire configuration file. If an error occurs while reading
70 * the file or a required directive is not found, print and log an
71 * appropriate error message and return 0; otherwise, return 1.
73 * If reload is 1, will reload the configuration file.
78 int read_config(void);