FreeBSD/contrib/ntp/ntpq/ntpq-subs.c
/*
 * mreadvar - send a read variables request for multiple associations
 */
send a read variables request for multiple associations
send a read variables request for multiple associations
static void
mreadvar(
	struct parse *pcmd,
	FILE *fp
	)
{
	int i;
	int from;
	int to;
	struct varlist tmplist[MAXLIST];
	struct varlist *pvars;
	if (!findassidrange(pcmd->argval[0].uval, pcmd->argval[1].uval,
				&from, &to, fp))
		return;
	ZERO(tmplist);
	if (pcmd->nargs >= 3) {
		doaddvlist(tmplist, pcmd->argval[2].string);
		pvars = tmplist;
	} else {
		pvars = g_varlist;
	}
	for (i = from; i <= to; i++) {
		if (!dolist(pvars, assoc_cache[i].assid, CTL_OP_READVAR,
			    TYPE_PEER, fp))
			break;
	}
	if (pvars == tmplist)
		doclearvlist(tmplist);
	return;
}
static void mreadvar ( struct parse * pcmd , FILE * fp ) { int i ; int from ; int to ; struct varlist tmplist [ MAXLIST ] ; struct varlist * pvars ; if ( ! findassidrange ( pcmd -> argval [ 0 ] . uval , pcmd -> argval [ 1 ] . uval , & from , & to , fp ) ) return ; ZERO ( tmplist ) ; if ( pcmd -> nargs >= 3 ) { doaddvlist ( tmplist , pcmd -> argval [ 2 ] . string ) ; pvars = tmplist ; } else { pvars = g_varlist ; } for ( i = from ; i <= to ; i ++ ) { if ( ! dolist ( pvars , assoc_cache [ i ] . assid , CTL_OP_READVAR , TYPE_PEER , fp ) ) break ; } if ( pvars == tmplist ) doclearvlist ( tmplist ) ; return ; }
mreadvar - send a read variables request for multiple associations
mreadvar - send a read variables request for multiple associations