From beccb842f6e5cc31ddfc8b7b66d899809ad6c2b8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 19:26:21 -1000 Subject: Report a word where cgitrc expects a number atoi reads "yes" or "true" as 0, so repo.hide=yes, or cgit.hide true in a scanned repository's git config, silently did nothing. The values keep that meaning, since honouring them now would hide repositories on upgrade, but each one is logged with its file and line. --- source/config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/config.h') diff --git a/source/config.h b/source/config.h index 30cf74d..b6dfa2b 100644 --- a/source/config.h +++ b/source/config.h @@ -9,10 +9,30 @@ 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 -- cgit 2.12.1