Example #1
0
static int     add_parameter(char *key)
{
	char	*command;

	if (NULL == (command = strchr(key, ',')))
		return  FAIL;

	*command++ = '\0';

	return add_user_parameter(key, command);
}
Example #2
0
File: zbxconf.c Project: Shmuma/z
static int     add_parameter(char *key)
{
	char    *command;

	command = strstr(key,",");
	if(NULL == command)
	{
		return  FAIL;
	}
	command[0]=0;
	command++;
	add_user_parameter(key, command);
	return  SUCCEED;
}
Example #3
0
/******************************************************************************
 *                                                                            *
 * Function: load_user_parameters                                             *
 *                                                                            *
 * Purpose: load user parameters from configuration                           *
 *                                                                            *
 * Parameters: lines - user parameter entries from configuration file         *
 *                                                                            *
 * Return value:                                                              *
 *                                                                            *
 * Author: Vladimir Levijev                                                   *
 *                                                                            *
 * Comments: calls add_user_parameter() for each entry                        *
 *                                                                            *
 ******************************************************************************/
void	load_user_parameters(char **lines)
{
	char	*command, **pline;

	for (pline = lines; NULL != *pline; pline++)
	{
		if (NULL == (command = strchr(*pline, ',')))
		{
			zabbix_log(LOG_LEVEL_CRIT, "UserParameter \"%s\" FAILED: not comma-separated", *pline);
			exit(FAIL);
		}
		*command++ = '\0';

		add_user_parameter(*pline, command);
	}
}
Example #4
0
/******************************************************************************
 *                                                                            *
 * Function: load_user_parameters                                             *
 *                                                                            *
 * Purpose: load user parameters from configuration                           *
 *                                                                            *
 * Parameters: lines - user parameter entries from configuration file         *
 *                                                                            *
 * Author: Vladimir Levijev                                                   *
 *                                                                            *
 * Comments: calls add_user_parameter() for each entry                        *
 *                                                                            *
 ******************************************************************************/
void	load_user_parameters(char **lines)
{
	char	*p, **pline, error[MAX_STRING_LEN];

	for (pline = lines; NULL != *pline; pline++)
	{
		if (NULL == (p = strchr(*pline, ',')))
		{
			zabbix_log(LOG_LEVEL_CRIT, "cannot add user parameter \"%s\": not comma-separated", *pline);
			exit(EXIT_FAILURE);
		}
		*p = '\0';

		if (FAIL == add_user_parameter(*pline, p + 1, error, sizeof(error)))
		{
			*p = ',';
			zabbix_log(LOG_LEVEL_CRIT, "cannot add user parameter \"%s\": %s", *pline, error);
			exit(EXIT_FAILURE);
		}
		*p = ',';
	}
}