Source
int zbx_calculate_macro_function(const char *expression, const zbx_token_func_macro_t *func_macro, char **out)
/*
** 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/>.
**/
/* strptime() on newer and older GNU/Linux systems */
typedef struct
{
const char *macro;
const char *functions;
}
zbx_macro_functions_t;
typedef struct
{
char character;
const char* html_entity;
}
zbx_htmlentity_t;
static const zbx_htmlentity_t zbx_html_translation[] =
{
{'&', "&"},
{'"', """},
{'\'', "'"},
{'<', "<"},
{'>', ">"},
{'\'', "'"}
};
/******************************************************************************
* *
* Purpose: calculates regular expression substitution. *
* *
* Parameters: params - [IN] function parameters *
* nparam - [IN] function parameter count *
* out - [IN/OUT] input/output value *
* *
* Return value: SUCCEED - function was calculated successfully *
* FAIL - the function calculation failed *
* *
******************************************************************************/
static int macrofunc_regsub(char **params, size_t nparam, char **out)