Diff options
Diffstat (limited to 'source/config.h')
| -rw-r--r-- | source/config.h | 20 |
1 file changed, 20 insertions, 0 deletions
diff --git a/source/config.h b/source/config.h index 30cf74d..b6dfa2b 100644 --- a/source/config.h +++ b/source/config.h @@ -10,9 +10,29 @@ typedef void (*config_file_value_fn)(const char *name, const char *value); /* + * Where the setting being applied was written, for a warning about it to name. + * The file is NULL while no config file is being read. + */ +struct config_origin { + const char *file; + int line; +}; + +extern struct config_origin config_origin; + +/* * Returns 0, or an errno value when filename could not be opened or read. A * missing file is ordinary for some callers, so reporting one is left to them. + * filename has to stay as it is until the parse returns, since a warning about + * a setting in the file names it. */ extern int config_file_parse(const char *filename, config_file_value_fn fn); +/* + * Read value as atoi does, which is what a number in cgitrc has always meant, + * and warn on stderr when it is not a plain whole number, since atoi turns a + * word such as "yes" into 0 without a sound. + */ +extern int config_int(const char *name, const char *value); + #endif // CGIT_CONFIG_H |
