Source
zbx_error("invalid entry \"%s\" (not following \"parameter=value\" notation) in config file \"%s\", line %d",
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
static const char *program_type_str = NULL;
static const char *main_cfg_file = NULL;
static int __parse_cfg_file(const char *cfg_file, zbx_cfg_line_t *cfg, int level, int optional, int strict,
int noexit);
ZBX_PTR_VECTOR_IMPL(addr_ptr, zbx_addr_t *)
void zbx_init_library_cfg(unsigned char program_type, const char *cfg_file)
{
program_type_str = get_program_type_string(program_type);
main_cfg_file = cfg_file;
}
/******************************************************************************
* *
* Purpose: Checks whether a file (e.g., "parameter.conf") *
* matches a pattern (e.g., "p*.conf"). *
* *
* Return value: SUCCEED - file matches pattern *
* FAIL - otherwise *
* *
******************************************************************************/
static int match_glob(const char *file, const char *pattern)
{
const char *f, *g, *p, *q;
f = file;
p = pattern;
while (1)
{
/* corner case */
if ('\0' == *p)
return '\0' == *f ? SUCCEED : FAIL;
/* find a set of literal characters */
while ('*' == *p)
p++;
for (q = p; '\0' != *q && '*' != *q; q++)
;
/* if literal characters are at the beginning... */
if (pattern == p)
{
if (0 != zbx_strncasecmp(f, p, q - p))
if (0 != strncmp(f, p, q - p))
return FAIL;
f += q - p;
p = q;
continue;
}