Source
return ' ' == c || '(' == c || '\r' == c || '\n' == c || '\t' == c || ')' == c || '\0' == c ? SUCCEED : FAIL;
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/******************************************************************************
* *
* Module for evaluating expressions *
* --------------------------------------- *
* *
* Global variables are used for efficiency reasons so that arguments do not *
* have to be passed to each of evaluate_termX() functions. For this reason, *
* too, this module is isolated into a separate file. *
* *
* The priority of supported operators is as follows: *
* *
* - (unary) evaluate_term8() *
* not evaluate_term7() *
* * / evaluate_term6() *
* + - evaluate_term5() *
* < <= >= > evaluate_term4() *
* = <> evaluate_term3() *
* and evaluate_term2() *
* or evaluate_term1() *
* *
* Function evaluate_term9() is used for parsing tokens on the lowest level: *
* those can be suffixed numbers like "12.345K" or parenthesized expressions. *
* *
******************************************************************************/
static const char *ptr; /* character being looked at */
static int level; /* expression nesting level */
static char *buffer; /* error message buffer */
static size_t max_buffer_len; /* error message buffer size */
/******************************************************************************
* *
* Purpose: check whether the character delimits a numeric token *
* *
******************************************************************************/
static int is_number_delimiter(char c)
{