Пример #1
0
/*****************************************************************************
 *
 *  ntpq_get_sysvars
 *
 *  The system variables of a NTP host can be requested by using this function
 *  and afterwards using ntpq_get_sysvar to read the single variable values.
 *
 ****************************************************************************
 * Parameters:
 *	- none -
 *
 * Returns:
 *	int		nonzero if the variable set could be read
 * 			- OR - 
 *			0 (zero) if an error occured and the sysvars
 *			could not be read
 ****************************************************************************/
 int  ntpq_get_sysvars( void )
{
        sysvarlen = ( ntpq_read_sysvars( sysvars, sizeof(sysvars )) );
        if ( sysvarlen <= 0 ) {
            return 0;
        } else {
            return 1;
        }
}
Пример #2
0
/*****************************************************************************
 *
 *  ntpq_get_sysvars
 *
 *  The system variables of a NTP host can be requested by using this function
 *  and afterwards using ntpq_get_sysvar to read the single variable values.
 *
 ****************************************************************************
 * Parameters:
 *	- none -
 *
 * Returns:
 *	int		nonzero if the variable set could be read
 * 			- OR - 
 *			0 (zero) if an error occured and the sysvars
 *			could not be read
 ****************************************************************************/
int
ntpq_get_sysvars(void)
{
	sysvarlen = ntpq_read_sysvars(sysvars, sizeof(sysvars));
	if (sysvarlen <= 0)
		return 0;
	else
		return 1;
}
Пример #3
0
size_t
read_ntp_value(
	const char *	variable,
	char *		value,
	size_t		valuesize
	)
{
	size_t	sv_len;
	char	sv_data[NTPQ_BUFLEN];
	
	memset(sv_data, 0, sizeof(sv_data));
	sv_len = ntpq_read_sysvars(sv_data, sizeof(sv_data));

	if (0 == sv_len)
		return 0;
	else
		return ntpq_getvar(sv_data, sv_len, variable, value,
				   valuesize);
}